Skip to content

Commit 6467beb

Browse files
committed
SCons: Move swappy option to android and slightly refactor detect.py
Signed-off-by: Yevhen Babiichuk (DustDFG) <dfgdust@gmail.com>
1 parent a0cd8f1 commit 6467beb

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

SConstruct

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ opts.Add(BoolVariable("use_volk", "Use the volk library to load the Vulkan loade
227227
opts.Add(BoolVariable("disable_exceptions", "Force disabling exception handling code", True))
228228
opts.Add("custom_modules", "A list of comma-separated directory paths containing custom modules to build.", "")
229229
opts.Add(BoolVariable("custom_modules_recursive", "Detect custom modules recursively for each specified path.", True))
230-
opts.Add(BoolVariable("swappy", "Use Swappy Frame Pacing Library in Android builds.", False))
231230

232231
# Advanced options
233232
opts.Add(

platform/android/detect.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def get_opts():
3131
),
3232
BoolVariable("store_release", "Editor build for Google Play Store (for official builds only)", False),
3333
BoolVariable("generate_apk", "Generate an APK/AAB after building Android library by calling Gradle", False),
34+
BoolVariable("swappy", "Use Swappy Frame Pacing library", False),
3435
]
3536

3637

@@ -100,7 +101,7 @@ def detect_swappy():
100101
archs = ["arm64-v8a", "armeabi-v7a", "x86", "x86_64"]
101102
has_swappy = True
102103
for arch in archs:
103-
if not os.path.isfile("thirdparty/swappy-frame-pacing/" + arch + "/libswappy_static.a"):
104+
if not os.path.isfile(f"thirdparty/swappy-frame-pacing/{arch}/libswappy_static.a"):
104105
has_swappy = False
105106
return has_swappy
106107

@@ -176,7 +177,7 @@ def configure(env: "SConsEnvironment"):
176177
env["AS"] = compiler_path + "/clang"
177178

178179
env.Append(
179-
CCFLAGS=("-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -fvisibility=hidden".split())
180+
CCFLAGS=(["-fpic", "-ffunction-sections", "-funwind-tables", "-fstack-protector-strong", "-fvisibility=hidden"])
180181
)
181182

182183
has_swappy = detect_swappy()
@@ -200,28 +201,28 @@ def configure(env: "SConsEnvironment"):
200201
# The NDK adds this if targeting API < 24, so we can drop it when Godot targets it at least
201202
env.Append(CCFLAGS=["-mstackrealign"])
202203
if has_swappy:
203-
env.Append(LIBPATH=["../../thirdparty/swappy-frame-pacing/x86"])
204+
env.Append(LIBPATH=["#thirdparty/swappy-frame-pacing/x86"])
204205
elif env["arch"] == "x86_64":
205206
if has_swappy:
206-
env.Append(LIBPATH=["../../thirdparty/swappy-frame-pacing/x86_64"])
207+
env.Append(LIBPATH=["#thirdparty/swappy-frame-pacing/x86_64"])
207208
elif env["arch"] == "arm32":
208-
env.Append(CCFLAGS="-march=armv7-a -mfloat-abi=softfp".split())
209+
env.Append(CCFLAGS=["-march=armv7-a", "-mfloat-abi=softfp"])
209210
env.Append(CPPDEFINES=["__ARM_ARCH_7__", "__ARM_ARCH_7A__"])
210211
env.Append(CPPDEFINES=["__ARM_NEON__"])
211212
if has_swappy:
212-
env.Append(LIBPATH=["../../thirdparty/swappy-frame-pacing/armeabi-v7a"])
213+
env.Append(LIBPATH=["#thirdparty/swappy-frame-pacing/armeabi-v7a"])
213214
elif env["arch"] == "arm64":
214215
env.Append(CCFLAGS=["-mfix-cortex-a53-835769"])
215216
env.Append(CPPDEFINES=["__ARM_ARCH_8A__"])
216217
if has_swappy:
217-
env.Append(LIBPATH=["../../thirdparty/swappy-frame-pacing/arm64-v8a"])
218+
env.Append(LIBPATH=["#thirdparty/swappy-frame-pacing/arm64-v8a"])
218219

219220
env.Append(CCFLAGS=["-ffp-contract=off"])
220221

221222
# Link flags
222223

223-
env.Append(LINKFLAGS="-Wl,--gc-sections -Wl,--no-undefined -Wl,-z,now".split())
224-
env.Append(LINKFLAGS="-Wl,-soname,libgodot_android.so")
224+
env.Append(LINKFLAGS=["-Wl,--gc-sections", "-Wl,--no-undefined", "-Wl,-z,now"])
225+
env.Append(LINKFLAGS=["-Wl,-soname,libgodot_android.so"])
225226

226227
env.Prepend(CPPPATH=["#platform/android"])
227228
env.Append(CPPDEFINES=["ANDROID_ENABLED", "UNIX_ENABLED"])

0 commit comments

Comments
 (0)