[Windows] Add SSE4.2 support runtime check.

This commit is contained in:
Pāvels Nadtočajevs 2025-07-13 00:55:26 +03:00
parent c6d130abd9
commit e363601226
No known key found for this signature in database
GPG key ID: 8413210218EF35D2
2 changed files with 64 additions and 1 deletions

View file

@ -37,6 +37,20 @@ common_win_wrap = [
"console_wrapper_windows.cpp",
]
env_wrap = env.Clone()
if env["arch"] == "x86_64":
env_cpp_check = env.Clone()
env_cpp_check.add_source_files(sources, ["cpu_feature_validation.c"])
if env.msvc:
if "/d2archSSE42" in env_cpp_check["CCFLAGS"]:
env_cpp_check["CCFLAGS"].remove("/d2archSSE42")
env.Append(LINKFLAGS=["/ENTRY:ShimMainCRTStartup"])
else:
if "-msse4.2" in env_cpp_check["CCFLAGS"]:
env_cpp_check["CCFLAGS"].remove("-msse4.2")
env.Append(LINKFLAGS=["-Wl,--entry=ShimMainCRTStartup"])
def arrange_program_clean(prog):
"""
@ -74,7 +88,6 @@ if env.msvc:
# Build console wrapper app.
if env["windows_subsystem"] == "gui":
env_wrap = env.Clone()
res_wrap_file = "godot_res_wrap.rc"
res_wrap_target = "godot_res_wrap" + env["OBJSUFFIX"]
res_wrap_obj = env_wrap.RES(res_wrap_target, res_wrap_file)