| 1 |
def disable_warnings(self): |
| 2 |
|
| 3 |
if self["platform"] == "windows" and not self["use_mingw"]: |
| 4 |
|
| 5 |
|
| 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 |
""") |