Android: Restore support for android_stl=no builds
Two modules fail building with this option, so we force users to disable them.
Small cleanup based on 2.1 branch and cherry-pick 01e65c4555
to fix support for NDK r20 (fixes #30688).
This commit is contained in:
parent
d092798038
commit
b87d819aad
|
@ -214,6 +214,11 @@ def configure(env):
|
|||
env.Append(CPPFLAGS=["-isystem", env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++abi/include"])
|
||||
env.Append(CXXFLAGS=['-frtti',"-std=gnu++14"])
|
||||
else:
|
||||
# Bullet and Webm need STL, so they can't be used with this option.
|
||||
if (env['module_bullet_enabled'] or env['module_webm_enabled']):
|
||||
print("\nERROR: The `android_stl=no` option is not compatible with the bullet and webm modules.\n"
|
||||
"If you want to use it, disable those modules with `module_bullet_enabled=no module_webm_enabled=no`.\n")
|
||||
sys.exit(255)
|
||||
env.Append(CXXFLAGS=['-fno-rtti', '-fno-exceptions', '-DNO_SAFE_CAST'])
|
||||
|
||||
ndk_version = get_ndk_version(env["ANDROID_NDK_ROOT"])
|
||||
|
@ -264,17 +269,20 @@ def configure(env):
|
|||
|
||||
## Link flags
|
||||
if ndk_version != None and LooseVersion(ndk_version) >= LooseVersion("15.0.4075724"):
|
||||
if env['android_stl']:
|
||||
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"])
|
||||
else:
|
||||
env.Append(LINKFLAGS=['-shared', '--sysroot=' + lib_sysroot, '-Wl,--warn-shared-textrel'])
|
||||
# This is the legacy and minimal 'System STL' with support for basic features like new and delete
|
||||
env.Append(LINKFLAGS=['-stdlib=libstdc++'])
|
||||
else:
|
||||
if mt_link:
|
||||
env.Append(LINKFLAGS=['-Wl,--threads'])
|
||||
env.Append(LINKFLAGS=['-shared', '--sysroot=' + lib_sysroot, '-Wl,--warn-shared-textrel'])
|
||||
|
||||
if env["android_arch"] == "armv7":
|
||||
env.Append(LINKFLAGS='-Wl,--fix-cortex-a8'.split())
|
||||
|
|
Loading…
Reference in New Issue