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