feat: updated engine version to 4.4-rc1

This commit is contained in:
Sara 2025-02-23 14:38:14 +01:00
parent ee00efde1f
commit 21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions

View file

@ -1,28 +1,8 @@
#!/usr/bin/env python
import atexit
import sys
import time
# ruff: noqa: F821
import methods
# Enable ANSI escape code support on Windows 10 and later (for colored console output).
# <https://github.com/python/cpython/issues/73245>
if sys.stdout.isatty() and sys.platform == "win32":
try:
from ctypes import WinError, byref, windll # type: ignore
from ctypes.wintypes import DWORD # type: ignore
stdout_handle = windll.kernel32.GetStdHandle(DWORD(-11))
mode = DWORD(0)
if not windll.kernel32.GetConsoleMode(stdout_handle, byref(mode)):
raise WinError()
mode = DWORD(mode.value | 4)
if not windll.kernel32.SetConsoleMode(stdout_handle, mode):
raise WinError()
except Exception as e:
methods._colorize = False
methods.print_error(f"Failed to enable ANSI escape code support, disabling color output.\n{e}")
# For the reference:
# - CCFLAGS are compilation flags shared between C and C++
# - CFLAGS are for C-specific compilation flags
@ -31,8 +11,6 @@ if sys.stdout.isatty() and sys.platform == "win32":
# - CPPDEFINES are for pre-processor defines
# - LINKFLAGS are for linking flags
time_at_start = time.time()
env = SConscript("./godot-cpp/SConstruct")
env.__class__.disable_warnings = methods.disable_warnings
@ -47,9 +25,6 @@ opts.Add(BoolVariable("verbose", "Enable verbose output for the compilation", Fa
opts.Update(env)
if not env["verbose"]:
methods.no_verbose(env)
if env["platform"] == "windows" and not env["use_mingw"]:
env.AppendUnique(CCFLAGS=["/utf-8"]) # Force to use Unicode encoding.
@ -135,7 +110,7 @@ if env["thorvg_enabled"] and env["freetype_enabled"]:
env.Append(CPPDEFINES=["MODULE_SVG_ENABLED"])
lib = env_tvg.Library(
f'tvg_builtin{env["suffix"]}{env["LIBSUFFIX"]}',
f"tvg_builtin{env['suffix']}{env['LIBSUFFIX']}",
thirdparty_tvg_sources,
)
env.Append(LIBS=[lib])
@ -148,6 +123,7 @@ if env["msdfgen_enabled"] and env["freetype_enabled"]:
thirdparty_msdfgen_dir = "../../../thirdparty/msdfgen/"
thirdparty_msdfgen_sources = [
"core/Contour.cpp",
"core/DistanceMapping.cpp",
"core/EdgeHolder.cpp",
"core/MSDFErrorCorrection.cpp",
"core/Projection.cpp",
@ -158,10 +134,15 @@ if env["msdfgen_enabled"] and env["freetype_enabled"]:
"core/edge-segments.cpp",
"core/edge-selectors.cpp",
"core/equation-solver.cpp",
# "core/export-svg.cpp",
"core/msdf-error-correction.cpp",
"core/msdfgen.cpp",
"core/rasterization.cpp",
"core/render-sdf.cpp",
# "core/save-bmp.cpp",
# "core/save-fl32.cpp",
# "core/save-rgba.cpp",
# "core/save-tiff.cpp",
"core/sdf-error-estimation.cpp",
"core/shape-description.cpp",
]
@ -174,7 +155,7 @@ if env["msdfgen_enabled"] and env["freetype_enabled"]:
env.Append(CPPDEFINES=["MODULE_MSDFGEN_ENABLED"])
lib = env_msdfgen.Library(
f'msdfgen_builtin{env["suffix"]}{env["LIBSUFFIX"]}',
f"msdfgen_builtin{env['suffix']}{env['LIBSUFFIX']}",
thirdparty_msdfgen_sources,
)
env.Append(LIBS=[lib])
@ -303,7 +284,7 @@ if env["freetype_enabled"]:
env.Append(CPPDEFINES=["MODULE_FREETYPE_ENABLED"])
lib = env_freetype.Library(
f'freetype_builtin{env["suffix"]}{env["LIBSUFFIX"]}',
f"freetype_builtin{env['suffix']}{env['LIBSUFFIX']}",
thirdparty_freetype_sources,
)
env.Append(LIBS=[lib])
@ -323,7 +304,8 @@ thirdparty_harfbuzz_sources = [
# "src/hb-cairo-utils.cc",
# "src/hb-cairo.cc",
"src/hb-common.cc",
# "src/hb-coretext.cc",
# "src/hb-coretext-font.cc",
# "src/hb-coretext-shape.cc",
# "src/hb-directwrite.cc",
"src/hb-draw.cc",
"src/hb-face-builder.cc",
@ -385,6 +367,7 @@ thirdparty_harfbuzz_sources = [
"src/hb-ucd.cc",
"src/hb-unicode.cc",
# "src/hb-uniscribe.cc",
"src/OT/Var/VARC/VARC.cc",
]
if env["freetype_enabled"]:
@ -415,6 +398,7 @@ if env["platform"] == "android" or env["platform"] == "linuxbsd":
env_harfbuzz.Append(
CCFLAGS=[
"-DU_STATIC_IMPLEMENTATION",
"-DU_HAVE_LIB_SUFFIX=1",
"-DU_LIB_SUFFIX_C_NAME=_godot",
"-DHAVE_ICU_BUILTIN",
@ -434,7 +418,7 @@ if env["freetype_enabled"]:
env.Append(CPPPATH=["../../../thirdparty/harfbuzz/src"])
lib = env_harfbuzz.Library(
f'harfbuzz_builtin{env["suffix"]}{env["LIBSUFFIX"]}',
f"harfbuzz_builtin{env['suffix']}{env['LIBSUFFIX']}",
thirdparty_harfbuzz_sources,
)
env.Prepend(LIBS=[lib])
@ -494,7 +478,7 @@ if env["graphite_enabled"] and env["freetype_enabled"]:
)
lib = env_graphite.Library(
f'graphite_builtin{env["suffix"]}{env["LIBSUFFIX"]}',
f"graphite_builtin{env['suffix']}{env['LIBSUFFIX']}",
thirdparty_graphite_sources,
)
env.Append(LIBS=[lib])
@ -713,12 +697,10 @@ thirdparty_icu_sources = [
]
thirdparty_icu_sources = [thirdparty_icu_dir + file for file in thirdparty_icu_sources]
icu_data_name = "icudt75l.dat"
if env["static_icu_data"]:
env_icu.Depends("../../../thirdparty/icu4c/icudata.gen.h", "../../../thirdparty/icu4c/" + icu_data_name)
env_icu.Depends("../../../thirdparty/icu4c/icudata.gen.h", "../../../thirdparty/icu4c/icudt_godot.dat")
env_icu.Command(
"../../../thirdparty/icu4c/icudata.gen.h", "../../../thirdparty/icu4c/" + icu_data_name, methods.make_icu_data
"../../../thirdparty/icu4c/icudata.gen.h", "../../../thirdparty/icu4c/icudt_godot.dat", methods.make_icu_data
)
env.Append(CXXFLAGS=["-DICU_STATIC_DATA"])
env.Append(CPPPATH=["../../../thirdparty/icu4c/"])
@ -741,14 +723,13 @@ env_icu.Append(
"-DU_ENABLE_DYLOAD=0",
"-DU_HAVE_LIB_SUFFIX=1",
"-DU_LIB_SUFFIX_C_NAME=_godot",
"-DICU_DATA_NAME=" + icu_data_name,
]
)
env.Append(
CXXFLAGS=[
"-DU_STATIC_IMPLEMENTATION",
"-DU_HAVE_LIB_SUFFIX=1",
"-DU_LIB_SUFFIX_C_NAME=_godot",
"-DICU_DATA_NAME=" + icu_data_name,
]
)
env.Append(CPPPATH=["../../../thirdparty/icu4c/common/", "../../../thirdparty/icu4c/i18n/"])
@ -756,7 +737,7 @@ env.Append(CPPPATH=["../../../thirdparty/icu4c/common/", "../../../thirdparty/ic
if env["platform"] == "windows":
env.Append(LIBS=["advapi32"])
lib = env_icu.Library(f'icu_builtin{env["suffix"]}{env["LIBSUFFIX"]}', thirdparty_icu_sources)
lib = env_icu.Library(f"icu_builtin{env['suffix']}{env['LIBSUFFIX']}", thirdparty_icu_sources)
env.Append(LIBS=[lib])
env.Append(CPPDEFINES=["GDEXTENSION"])
@ -765,35 +746,21 @@ sources = Glob("../*.cpp")
if env["platform"] == "macos":
methods.write_macos_plist(
f'./bin/libtextserver_advanced.macos.{env["target"]}.framework',
f'libtextserver_advanced.macos.{env["target"]}',
f"./bin/libtextserver_advanced.macos.{env['target']}.framework",
f"libtextserver_advanced.macos.{env['target']}",
"org.godotengine.textserver_advanced",
"ICU / HarfBuzz / Graphite Text Server",
)
library = env.SharedLibrary(
f'./bin/libtextserver_advanced.macos.{env["target"]}.framework/libtextserver_advanced.macos.{env["target"]}',
f"./bin/libtextserver_advanced.macos.{env['target']}.framework/libtextserver_advanced.macos.{env['target']}",
source=sources,
)
else:
library = env.SharedLibrary(
f'./bin/libtextserver_advanced{env["suffix"]}{env["SHLIBSUFFIX"]}',
f"./bin/libtextserver_advanced{env['suffix']}{env['SHLIBSUFFIX']}",
source=sources,
)
Default(library)
def print_elapsed_time():
elapsed_time_sec = round(time.time() - time_at_start, 2)
time_centiseconds = round((elapsed_time_sec % 1) * 100)
print(
"{}[Time elapsed: {}.{:02}]{}".format(
methods.ANSI.GRAY,
time.strftime("%H:%M:%S", time.gmtime(elapsed_time_sec)),
time_centiseconds,
methods.ANSI.RESET,
)
)
atexit.register(print_elapsed_time)
methods.prepare_timer()

View file

@ -1,93 +1,28 @@
import os
import sys
from enum import Enum
# Colors are disabled in non-TTY environments such as pipes. This means
# that if output is redirected to a file, it won't contain color codes.
# Colors are always enabled on continuous integration.
_colorize = bool(sys.stdout.isatty() or os.environ.get("CI"))
class ANSI(Enum):
"""
Enum class for adding ansi colorcodes directly into strings.
Automatically converts values to strings representing their
internal value, or an empty string in a non-colorized scope.
"""
RESET = "\x1b[0m"
BOLD = "\x1b[1m"
ITALIC = "\x1b[3m"
UNDERLINE = "\x1b[4m"
STRIKETHROUGH = "\x1b[9m"
REGULAR = "\x1b[22;23;24;29m"
BLACK = "\x1b[30m"
RED = "\x1b[31m"
GREEN = "\x1b[32m"
YELLOW = "\x1b[33m"
BLUE = "\x1b[34m"
MAGENTA = "\x1b[35m"
CYAN = "\x1b[36m"
WHITE = "\x1b[37m"
PURPLE = "\x1b[38;5;93m"
PINK = "\x1b[38;5;206m"
ORANGE = "\x1b[38;5;214m"
GRAY = "\x1b[38;5;244m"
def __str__(self) -> str:
global _colorize
return str(self.value) if _colorize else ""
def no_verbose(env):
colors = [ANSI.BLUE, ANSI.BOLD, ANSI.REGULAR, ANSI.RESET]
# There is a space before "..." to ensure that source file names can be
# Ctrl + clicked in the VS Code terminal.
compile_source_message = "{}Compiling {}$SOURCE{} ...{}".format(*colors)
java_compile_source_message = "{}Compiling {}$SOURCE{} ...{}".format(*colors)
compile_shared_source_message = "{}Compiling shared {}$SOURCE{} ...{}".format(*colors)
link_program_message = "{}Linking Program {}$TARGET{} ...{}".format(*colors)
link_library_message = "{}Linking Static Library {}$TARGET{} ...{}".format(*colors)
ranlib_library_message = "{}Ranlib Library {}$TARGET{} ...{}".format(*colors)
link_shared_library_message = "{}Linking Shared Library {}$TARGET{} ...{}".format(*colors)
java_library_message = "{}Creating Java Archive {}$TARGET{} ...{}".format(*colors)
compiled_resource_message = "{}Creating Compiled Resource {}$TARGET{} ...{}".format(*colors)
generated_file_message = "{}Generating {}$TARGET{} ...{}".format(*colors)
env["CXXCOMSTR"] = compile_source_message
env["CCCOMSTR"] = compile_source_message
env["SHCCCOMSTR"] = compile_shared_source_message
env["SHCXXCOMSTR"] = compile_shared_source_message
env["ARCOMSTR"] = link_library_message
env["RANLIBCOMSTR"] = ranlib_library_message
env["SHLINKCOMSTR"] = link_shared_library_message
env["LINKCOMSTR"] = link_program_message
env["JARCOMSTR"] = java_library_message
env["JAVACCOMSTR"] = java_compile_source_message
env["RCCOMSTR"] = compiled_resource_message
env["GENCOMSTR"] = generated_file_message
def disable_warnings(self):
# 'self' is the environment
if self["platform"] == "windows" and not self["use_mingw"]:
# We have to remove existing warning level defines before appending /w,
# otherwise we get: "warning D9025 : overriding '/W3' with '/w'"
warn_flags = ["/Wall", "/W4", "/W3", "/W2", "/W1", "/WX"]
self.Append(CCFLAGS=["/w"])
self.Append(CFLAGS=["/w"])
self.Append(CXXFLAGS=["/w"])
self["CCFLAGS"] = [x for x in self["CCFLAGS"] if x not in warn_flags]
self["CFLAGS"] = [x for x in self["CFLAGS"] if x not in warn_flags]
self["CXXFLAGS"] = [x for x in self["CXXFLAGS"] if x not in warn_flags]
WARN_FLAGS = ["/Wall", "/W4", "/W3", "/W2", "/W1", "/W0"]
self["CCFLAGS"] = [x for x in self["CCFLAGS"] if x not in WARN_FLAGS]
self["CFLAGS"] = [x for x in self["CFLAGS"] if x not in WARN_FLAGS]
self["CXXFLAGS"] = [x for x in self["CXXFLAGS"] if x not in WARN_FLAGS]
self.AppendUnique(CCFLAGS=["/w"])
else:
self.Append(CCFLAGS=["-w"])
self.Append(CFLAGS=["-w"])
self.Append(CXXFLAGS=["-w"])
self.AppendUnique(CCFLAGS=["-w"])
def prepare_timer():
import atexit
import time
def print_elapsed_time(time_at_start: float):
time_elapsed = time.time() - time_at_start
time_formatted = time.strftime("%H:%M:%S", time.gmtime(time_elapsed))
time_centiseconds = round((time_elapsed % 1) * 100)
print(f"[Time elapsed: {time_formatted}.{time_centiseconds}]")
atexit.register(print_elapsed_time, time.time())
def make_icu_data(target, source, env):
@ -115,6 +50,8 @@ def make_icu_data(target, source, env):
def write_macos_plist(target, binary_name, identifier, name):
import os
os.makedirs(f"{target}/Resource/", exist_ok=True)
with open(f"{target}/Resource/Info.plist", "w", encoding="utf-8", newline="\n") as f:
f.write(f"""\