You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
SCons: Move swappy option to android and slightly refactor detect.py
Signed-off-by: Yevhen Babiichuk (DustDFG) <dfgdust@gmail.com>
This commit is contained in:
@@ -227,7 +227,6 @@ opts.Add(BoolVariable("use_volk", "Use the volk library to load the Vulkan loade
|
|||||||
opts.Add(BoolVariable("disable_exceptions", "Force disabling exception handling code", True))
|
opts.Add(BoolVariable("disable_exceptions", "Force disabling exception handling code", True))
|
||||||
opts.Add("custom_modules", "A list of comma-separated directory paths containing custom modules to build.", "")
|
opts.Add("custom_modules", "A list of comma-separated directory paths containing custom modules to build.", "")
|
||||||
opts.Add(BoolVariable("custom_modules_recursive", "Detect custom modules recursively for each specified path.", True))
|
opts.Add(BoolVariable("custom_modules_recursive", "Detect custom modules recursively for each specified path.", True))
|
||||||
opts.Add(BoolVariable("swappy", "Use Swappy Frame Pacing Library in Android builds.", False))
|
|
||||||
|
|
||||||
# Advanced options
|
# Advanced options
|
||||||
opts.Add(
|
opts.Add(
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ def get_opts():
|
|||||||
),
|
),
|
||||||
BoolVariable("store_release", "Editor build for Google Play Store (for official builds only)", False),
|
BoolVariable("store_release", "Editor build for Google Play Store (for official builds only)", False),
|
||||||
BoolVariable("generate_apk", "Generate an APK/AAB after building Android library by calling Gradle", False),
|
BoolVariable("generate_apk", "Generate an APK/AAB after building Android library by calling Gradle", False),
|
||||||
|
BoolVariable("swappy", "Use Swappy Frame Pacing library", False),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -100,7 +101,7 @@ def detect_swappy():
|
|||||||
archs = ["arm64-v8a", "armeabi-v7a", "x86", "x86_64"]
|
archs = ["arm64-v8a", "armeabi-v7a", "x86", "x86_64"]
|
||||||
has_swappy = True
|
has_swappy = True
|
||||||
for arch in archs:
|
for arch in archs:
|
||||||
if not os.path.isfile("thirdparty/swappy-frame-pacing/" + arch + "/libswappy_static.a"):
|
if not os.path.isfile(f"thirdparty/swappy-frame-pacing/{arch}/libswappy_static.a"):
|
||||||
has_swappy = False
|
has_swappy = False
|
||||||
return has_swappy
|
return has_swappy
|
||||||
|
|
||||||
@@ -176,7 +177,7 @@ def configure(env: "SConsEnvironment"):
|
|||||||
env["AS"] = compiler_path + "/clang"
|
env["AS"] = compiler_path + "/clang"
|
||||||
|
|
||||||
env.Append(
|
env.Append(
|
||||||
CCFLAGS=("-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -fvisibility=hidden".split())
|
CCFLAGS=(["-fpic", "-ffunction-sections", "-funwind-tables", "-fstack-protector-strong", "-fvisibility=hidden"])
|
||||||
)
|
)
|
||||||
|
|
||||||
has_swappy = detect_swappy()
|
has_swappy = detect_swappy()
|
||||||
@@ -200,28 +201,28 @@ def configure(env: "SConsEnvironment"):
|
|||||||
# The NDK adds this if targeting API < 24, so we can drop it when Godot targets it at least
|
# The NDK adds this if targeting API < 24, so we can drop it when Godot targets it at least
|
||||||
env.Append(CCFLAGS=["-mstackrealign"])
|
env.Append(CCFLAGS=["-mstackrealign"])
|
||||||
if has_swappy:
|
if has_swappy:
|
||||||
env.Append(LIBPATH=["../../thirdparty/swappy-frame-pacing/x86"])
|
env.Append(LIBPATH=["#thirdparty/swappy-frame-pacing/x86"])
|
||||||
elif env["arch"] == "x86_64":
|
elif env["arch"] == "x86_64":
|
||||||
if has_swappy:
|
if has_swappy:
|
||||||
env.Append(LIBPATH=["../../thirdparty/swappy-frame-pacing/x86_64"])
|
env.Append(LIBPATH=["#thirdparty/swappy-frame-pacing/x86_64"])
|
||||||
elif env["arch"] == "arm32":
|
elif env["arch"] == "arm32":
|
||||||
env.Append(CCFLAGS="-march=armv7-a -mfloat-abi=softfp".split())
|
env.Append(CCFLAGS=["-march=armv7-a", "-mfloat-abi=softfp"])
|
||||||
env.Append(CPPDEFINES=["__ARM_ARCH_7__", "__ARM_ARCH_7A__"])
|
env.Append(CPPDEFINES=["__ARM_ARCH_7__", "__ARM_ARCH_7A__"])
|
||||||
env.Append(CPPDEFINES=["__ARM_NEON__"])
|
env.Append(CPPDEFINES=["__ARM_NEON__"])
|
||||||
if has_swappy:
|
if has_swappy:
|
||||||
env.Append(LIBPATH=["../../thirdparty/swappy-frame-pacing/armeabi-v7a"])
|
env.Append(LIBPATH=["#thirdparty/swappy-frame-pacing/armeabi-v7a"])
|
||||||
elif env["arch"] == "arm64":
|
elif env["arch"] == "arm64":
|
||||||
env.Append(CCFLAGS=["-mfix-cortex-a53-835769"])
|
env.Append(CCFLAGS=["-mfix-cortex-a53-835769"])
|
||||||
env.Append(CPPDEFINES=["__ARM_ARCH_8A__"])
|
env.Append(CPPDEFINES=["__ARM_ARCH_8A__"])
|
||||||
if has_swappy:
|
if has_swappy:
|
||||||
env.Append(LIBPATH=["../../thirdparty/swappy-frame-pacing/arm64-v8a"])
|
env.Append(LIBPATH=["#thirdparty/swappy-frame-pacing/arm64-v8a"])
|
||||||
|
|
||||||
env.Append(CCFLAGS=["-ffp-contract=off"])
|
env.Append(CCFLAGS=["-ffp-contract=off"])
|
||||||
|
|
||||||
# Link flags
|
# Link flags
|
||||||
|
|
||||||
env.Append(LINKFLAGS="-Wl,--gc-sections -Wl,--no-undefined -Wl,-z,now".split())
|
env.Append(LINKFLAGS=["-Wl,--gc-sections", "-Wl,--no-undefined", "-Wl,-z,now"])
|
||||||
env.Append(LINKFLAGS="-Wl,-soname,libgodot_android.so")
|
env.Append(LINKFLAGS=["-Wl,-soname,libgodot_android.so"])
|
||||||
|
|
||||||
env.Prepend(CPPPATH=["#platform/android"])
|
env.Prepend(CPPPATH=["#platform/android"])
|
||||||
env.Append(CPPDEFINES=["ANDROID_ENABLED", "UNIX_ENABLED"])
|
env.Append(CPPDEFINES=["ANDROID_ENABLED", "UNIX_ENABLED"])
|
||||||
|
|||||||
Reference in New Issue
Block a user