refactoring: simplify compiler version check

This commit is contained in:
Jiri Suchan 2022-06-14 22:23:20 +07:00
parent 111a3ca097
commit 8d94d26caf

View File

@ -197,20 +197,14 @@ def configure(env):
env.Append(CPPDEFINES=["NO_THREADS"]) env.Append(CPPDEFINES=["NO_THREADS"])
if env["gdnative_enabled"]: if env["gdnative_enabled"]:
emcc_version = get_compiler_version(env) cc_version = get_compiler_version(env)
major = int(emcc_version["major"]) cc_semver = (int(cc_version["major"]), int(cc_version["minor"]), int(cc_version["patch"]))
minor = int(emcc_version["minor"]) if cc_semver < (2, 0, 10):
patch = int(emcc_version["patch"]) print("GDNative support requires emscripten >= 2.0.10, detected: %s.%s.%s" % cc_semver)
if major < 2 or (major == 2 and minor == 0 and patch < 10):
print("GDNative support requires emscripten >= 2.0.10, detected: %s.%s.%s" % (major, minor, patch))
sys.exit(255) sys.exit(255)
if (
env["threads_enabled"] if env["threads_enabled"] and cc_semver < (3, 1, 14):
and major < 3 print("Threads and GDNative requires emscripten >= 3.1.14, detected: %s.%s.%s" % cc_semver)
or (major == 3 and minor < 1)
or (major == 3 and minor == 1 and patch < 14)
):
print("Threads and GDNative requires emscripten => 3.1.14, detected: %s.%s.%s" % (major, minor, patch))
sys.exit(255) sys.exit(255)
env.Append(CCFLAGS=["-s", "RELOCATABLE=1"]) env.Append(CCFLAGS=["-s", "RELOCATABLE=1"])
env.Append(LINKFLAGS=["-s", "RELOCATABLE=1"]) env.Append(LINKFLAGS=["-s", "RELOCATABLE=1"])