Path: blob/master/modules/text_server_fb/gdextension_build/methods.py
10278 views
def disable_warnings(self):1# 'self' is the environment2if self["platform"] == "windows" and not self["use_mingw"]:3# We have to remove existing warning level defines before appending /w,4# otherwise we get: "warning D9025 : overriding '/W3' with '/w'"5WARN_FLAGS = ["/Wall", "/W4", "/W3", "/W2", "/W1", "/W0"]6self["CCFLAGS"] = [x for x in self["CCFLAGS"] if x not in WARN_FLAGS]7self["CFLAGS"] = [x for x in self["CFLAGS"] if x not in WARN_FLAGS]8self["CXXFLAGS"] = [x for x in self["CXXFLAGS"] if x not in WARN_FLAGS]9self.AppendUnique(CCFLAGS=["/w"])10else:11self.AppendUnique(CCFLAGS=["-w"])121314def prepare_timer():15import atexit16import time1718def print_elapsed_time(time_at_start: float):19time_elapsed = time.time() - time_at_start20time_formatted = time.strftime("%H:%M:%S", time.gmtime(time_elapsed))21time_centiseconds = round((time_elapsed % 1) * 100)22print(f"[Time elapsed: {time_formatted}.{time_centiseconds}]")2324atexit.register(print_elapsed_time, time.time())252627def write_macos_plist(target, binary_name, identifier, name):28import os2930os.makedirs(f"{target}/Resource/", exist_ok=True)31with open(f"{target}/Resource/Info.plist", "w", encoding="utf-8", newline="\n") as f:32f.write(f"""\33<?xml version="1.0" encoding="UTF-8"?>34<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">35<plist version="1.0">36<dict>37<key>CFBundleExecutable</key>38<string>{binary_name}</string>39<key>CFBundleIdentifier</key>40<string>{identifier}</string>41<key>CFBundleInfoDictionaryVersion</key>42<string>6.0</string>43<key>CFBundleName</key>44<string>{name}</string>45<key>CFBundlePackageType</key>46<string>FMWK</string>47<key>CFBundleShortVersionString</key>48<string>1.0.0</string>49<key>CFBundleSupportedPlatforms</key>50<array>51<string>MacOSX</string>52</array>53<key>CFBundleVersion</key>54<string>1.0.0</string>55<key>LSMinimumSystemVersion</key>56<string>10.14</string>57</dict>58</plist>59""")606162