Debian Codegraph @

modules/text_server_adv/gdextension_build/methods.py

raw symbols SCIP
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 make_icu_data(target, source, env):
29 dst = target[0].srcnode().abspath
30 with open(dst, "w", encoding="utf-8", newline="\n") as g:
31 g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
32 g.write("/* (C) 2016 and later: Unicode, Inc. and others. */\n")
33 g.write("/* License & terms of use: https://www.unicode.org/copyright.html */\n")
34 g.write("#ifndef _ICU_DATA_H\n")
35 g.write("#define _ICU_DATA_H\n")
36 g.write('#include "unicode/utypes.h"\n')
37 g.write('#include "unicode/udata.h"\n')
38 g.write('#include "unicode/uversion.h"\n')
39
40 with open(source[0].srcnode().abspath, "rb") as f:
41 buf = f.read()
42
43 g.write('extern "C" U_EXPORT const size_t U_ICUDATA_SIZE = ' + str(len(buf)) + ";\n")
44 g.write('extern "C" U_EXPORT const unsigned char U_ICUDATA_ENTRY_POINT[] = {\n')
45 for i in range(len(buf)):
46 g.write("\t" + str(buf[i]) + ",\n")
47
48 g.write("};\n")
49 g.write("#endif")
50
51
52 def write_macos_plist(target, binary_name, identifier, name):
53 import os
54
55 os.makedirs(f"{target}/Resource/", exist_ok=True)
56 with open(f"{target}/Resource/Info.plist", "w", encoding="utf-8", newline="\n") as f:
57 f.write(f"""\
58 <?xml version="1.0" encoding="UTF-8"?>
59 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
60 <plist version="1.0">
61 <dict>
62 <key>CFBundleExecutable</key>
63 <string>{binary_name}</string>
64 <key>CFBundleIdentifier</key>
65 <string>{identifier}</string>
66 <key>CFBundleInfoDictionaryVersion</key>
67 <string>6.0</string>
68 <key>CFBundleName</key>
69 <string>{name}</string>
70 <key>CFBundlePackageType</key>
71 <string>FMWK</string>
72 <key>CFBundleShortVersionString</key>
73 <string>1.0.0</string>
74 <key>CFBundleSupportedPlatforms</key>
75 <array>
76 <string>MacOSX</string>
77 </array>
78 <key>CFBundleVersion</key>
79 <string>1.0.0</string>
80 <key>LSMinimumSystemVersion</key>
81 <string>10.14</string>
82 </dict>
83 </plist>
84 """)