1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

SCons: Make builders prettier, utilize constexpr

This commit is contained in:
Thaddeus Crews
2024-10-29 14:23:08 -05:00
parent 7893202fba
commit be429eb404
21 changed files with 510 additions and 723 deletions

View File

@@ -1,6 +1,8 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
import methods
Import("env")
Import("env_modules")
@@ -8,28 +10,21 @@ env_text_server_adv = env_modules.Clone()
def make_icu_data(target, source, env):
dst = target[0].srcnode().abspath
buffer = methods.get_buffer(str(source[0]))
with methods.generated_wrapper(str(target[0])) as file:
file.write(f"""\
/* (C) 2016 and later: Unicode, Inc. and others. */
/* License & terms of use: https://www.unicode.org/copyright.html */
with open(dst, "w", encoding="utf-8", newline="\n") as g:
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
g.write("/* (C) 2016 and later: Unicode, Inc. and others. */\n")
g.write("/* License & terms of use: https://www.unicode.org/copyright.html */\n")
g.write("#ifndef _ICU_DATA_H\n")
g.write("#define _ICU_DATA_H\n")
g.write('#include "unicode/utypes.h"\n')
g.write('#include "unicode/udata.h"\n')
g.write('#include "unicode/uversion.h"\n')
#include <unicode/utypes.h>
#include <unicode/udata.h>
#include <unicode/uversion.h>
with open(source[0].srcnode().abspath, "rb") as f:
buf = f.read()
g.write('extern "C" U_EXPORT const size_t U_ICUDATA_SIZE = ' + str(len(buf)) + ";\n")
g.write('extern "C" U_EXPORT const unsigned char U_ICUDATA_ENTRY_POINT[] = {\n')
for i in range(len(buf)):
g.write("\t" + str(buf[i]) + ",\n")
g.write("};\n")
g.write("#endif")
extern "C" U_EXPORT const size_t U_ICUDATA_SIZE = {len(buffer)};
extern "C" U_EXPORT const unsigned char U_ICUDATA_ENTRY_POINT[] = {{
{methods.format_buffer(buffer, 1)}
}};
""")
# Thirdparty source files