summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-07-30 18:52:39 +0200
committerGitHub <noreply@github.com>2019-07-30 18:52:39 +0200
commitc9a1a69ad67d1d270627d11cb095d5bafb1beeb1 (patch)
treeae1149aaa836a86de74fa3947a198f14c31b0454 /platform/android
parentdfa324eb8ea4a1f9a53dd6e29e9016b7f5dcd232 (diff)
parentd6ef5daf48a2137b7dd87b389e76fad0af625946 (diff)
Merge pull request #30967 from akien-mga/android-drop-ndk-pre-15
Android: Drop support for NDK < r15
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/SCsub7
-rw-r--r--platform/android/detect.py43
2 files changed, 21 insertions, 29 deletions
diff --git a/platform/android/SCsub b/platform/android/SCsub
index d772dc9d71..e355caf0f9 100644
--- a/platform/android/SCsub
+++ b/platform/android/SCsub
@@ -53,7 +53,6 @@ if lib_arch_dir != '':
out_dir = '#platform/android/java/libs/' + lib_type_dir + '/' + lib_arch_dir
env_android.Command(out_dir + '/libgodot_android.so', '#bin/libgodot' + env['SHLIBSUFFIX'], Move("$TARGET", "$SOURCE"))
- ndk_version = get_ndk_version(env["ANDROID_NDK_ROOT"])
- if ndk_version != None and LooseVersion(ndk_version) >= LooseVersion("15.0.4075724"):
- stl_lib_path = str(env['ANDROID_NDK_ROOT']) + '/sources/cxx-stl/llvm-libc++/libs/' + lib_arch_dir + '/libc++_shared.so'
- env_android.Command(out_dir + '/libc++_shared.so', stl_lib_path, Copy("$TARGET", "$SOURCE"))
+
+ stl_lib_path = str(env['ANDROID_NDK_ROOT']) + '/sources/cxx-stl/llvm-libc++/libs/' + lib_arch_dir + '/libc++_shared.so'
+ env_android.Command(out_dir + '/libc++_shared.so', stl_lib_path, Copy("$TARGET", "$SOURCE"))
diff --git a/platform/android/detect.py b/platform/android/detect.py
index 3f179e3a65..4c5c70717b 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -205,9 +205,8 @@ def configure(env):
common_opts = ['-fno-integrated-as', '-gcc-toolchain', gcc_toolchain_path]
- lib_sysroot = env["ANDROID_NDK_ROOT"] + "/platforms/" + env['ndk_platform'] + "/" + env['ARCH']
-
## Compile flags
+
# Disable exceptions and rtti on non-tools (template) builds
if env['tools'] or env['android_stl']:
env.Append(CPPFLAGS=["-isystem", env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/include"])
@@ -218,18 +217,15 @@ def configure(env):
# Don't use dynamic_cast, necessary with no-rtti.
env.Append(CPPDEFINES=['NO_SAFE_CAST'])
- ndk_version = get_ndk_version(env["ANDROID_NDK_ROOT"])
- if ndk_version != None and LooseVersion(ndk_version) >= LooseVersion("15.0.4075724"):
- print("Using NDK unified headers")
- sysroot = env["ANDROID_NDK_ROOT"] + "/sysroot"
- env.Append(CPPFLAGS=["--sysroot=" + sysroot])
- env.Append(CPPFLAGS=["-isystem", sysroot + "/usr/include/" + abi_subpath])
- env.Append(CPPFLAGS=["-isystem", env["ANDROID_NDK_ROOT"] + "/sources/android/support/include"])
- # For unified headers this define has to be set manually
- env.Append(CPPDEFINES=[('__ANDROID_API__', str(get_platform(env['ndk_platform'])))])
- else:
- print("Using NDK deprecated headers")
- env.Append(CPPFLAGS=["-isystem", lib_sysroot + "/usr/include"])
+ lib_sysroot = env["ANDROID_NDK_ROOT"] + "/platforms/" + env['ndk_platform'] + "/" + env['ARCH']
+
+ # Using NDK unified headers (NDK r15+)
+ sysroot = env["ANDROID_NDK_ROOT"] + "/sysroot"
+ env.Append(CPPFLAGS=["--sysroot=" + sysroot])
+ env.Append(CPPFLAGS=["-isystem", sysroot + "/usr/include/" + abi_subpath])
+ env.Append(CPPFLAGS=["-isystem", env["ANDROID_NDK_ROOT"] + "/sources/android/support/include"])
+ # For unified headers this define has to be set manually
+ env.Append(CPPDEFINES=[('__ANDROID_API__', str(get_platform(env['ndk_platform'])))])
env.Append(CCFLAGS='-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -fvisibility=hidden -fno-strict-aliasing'.split())
env.Append(CPPDEFINES=['NO_STATVFS', 'GLES_ENABLED'])
@@ -263,18 +259,15 @@ def configure(env):
env.Append(CCFLAGS=common_opts)
## Link flags
- if ndk_version != None and LooseVersion(ndk_version) >= LooseVersion("15.0.4075724"):
- if LooseVersion(ndk_version) >= LooseVersion("17.1.4828580"):
- env.Append(LINKFLAGS=['-Wl,--exclude-libs,libgcc.a', '-Wl,--exclude-libs,libatomic.a', '-nostdlib++'])
- else:
- env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/libandroid_support.a"])
- env.Append(LINKFLAGS=['-shared', '--sysroot=' + lib_sysroot, '-Wl,--warn-shared-textrel'])
- env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/"])
- env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"] +"/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/libc++_shared.so"])
+
+ ndk_version = get_ndk_version(env["ANDROID_NDK_ROOT"])
+ if ndk_version != None and LooseVersion(ndk_version) >= LooseVersion("17.1.4828580"):
+ env.Append(LINKFLAGS=['-Wl,--exclude-libs,libgcc.a', '-Wl,--exclude-libs,libatomic.a', '-nostdlib++'])
else:
- env.Append(LINKFLAGS=['-shared', '--sysroot=' + lib_sysroot, '-Wl,--warn-shared-textrel'])
- if mt_link:
- env.Append(LINKFLAGS=['-Wl,--threads'])
+ env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/libandroid_support.a"])
+ env.Append(LINKFLAGS=['-shared', '--sysroot=' + lib_sysroot, '-Wl,--warn-shared-textrel'])
+ env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/"])
+ env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"] +"/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/libc++_shared.so"])
if env["android_arch"] == "armv7":
env.Append(LINKFLAGS='-Wl,--fix-cortex-a8'.split())