mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
makepanda: Android build fixes
This commit is contained in:
parent
cdadd00e72
commit
a99a1ed991
@ -1308,10 +1308,6 @@ def CompileCxx(obj,src,opts):
|
||||
if "SYSROOT" in SDK:
|
||||
if GetTarget() != "android":
|
||||
cmd += ' --sysroot=%s' % (SDK["SYSROOT"])
|
||||
else:
|
||||
ndk_dir = SDK["ANDROID_NDK"].replace('\\', '/')
|
||||
cmd += ' -isystem %s/sysroot/usr/include' % (ndk_dir)
|
||||
cmd += ' -isystem %s/sysroot/usr/include/%s' % (ndk_dir, SDK["ANDROID_TRIPLE"])
|
||||
cmd += ' -no-canonical-prefixes'
|
||||
|
||||
# Android-specific flags.
|
||||
@ -1320,33 +1316,24 @@ def CompileCxx(obj,src,opts):
|
||||
if GetTarget() == "android":
|
||||
# Most of the specific optimization flags here were
|
||||
# just copied from the default Android Makefiles.
|
||||
if "ANDROID_API" in SDK:
|
||||
cmd += ' -D__ANDROID_API__=' + str(SDK["ANDROID_API"])
|
||||
if "ANDROID_GCC_TOOLCHAIN" in SDK:
|
||||
cmd += ' -gcc-toolchain ' + SDK["ANDROID_GCC_TOOLCHAIN"].replace('\\', '/')
|
||||
cmd += ' -ffunction-sections -funwind-tables'
|
||||
cmd += ' -target ' + SDK["ANDROID_TRIPLE"]
|
||||
if arch == 'armv7a':
|
||||
cmd += ' -target armv7-none-linux-androideabi'
|
||||
cmd += ' -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16'
|
||||
cmd += ' -fno-integrated-as'
|
||||
elif arch == 'arm':
|
||||
cmd += ' -target armv5te-none-linux-androideabi'
|
||||
cmd += ' -march=armv5te -mtune=xscale -msoft-float'
|
||||
cmd += ' -fno-integrated-as'
|
||||
elif arch == 'aarch64':
|
||||
cmd += ' -target aarch64-none-linux-android'
|
||||
elif arch == 'mips':
|
||||
cmd += ' -target mipsel-none-linux-android'
|
||||
cmd += ' -mips32'
|
||||
elif arch == 'mips64':
|
||||
cmd += ' -target mips64el-none-linux-android'
|
||||
cmd += ' -fintegrated-as'
|
||||
elif arch == 'x86':
|
||||
cmd += ' -target i686-none-linux-android'
|
||||
cmd += ' -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32'
|
||||
cmd += ' -mstackrealign'
|
||||
elif arch == 'x86_64':
|
||||
cmd += ' -target x86_64-none-linux-android'
|
||||
cmd += ' -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel'
|
||||
|
||||
cmd += " -Wa,--noexecstack"
|
||||
@ -1848,28 +1835,16 @@ def CompileLink(dll, obj, opts):
|
||||
if "ANDROID_GCC_TOOLCHAIN" in SDK:
|
||||
cmd += ' -gcc-toolchain ' + SDK["ANDROID_GCC_TOOLCHAIN"].replace('\\', '/')
|
||||
cmd += " -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now"
|
||||
cmd += ' -target ' + SDK["ANDROID_TRIPLE"]
|
||||
if arch == 'armv7a':
|
||||
cmd += ' -target armv7-none-linux-androideabi'
|
||||
cmd += " -march=armv7-a -Wl,--fix-cortex-a8"
|
||||
elif arch == 'arm':
|
||||
cmd += ' -target armv5te-none-linux-androideabi'
|
||||
elif arch == 'aarch64':
|
||||
cmd += ' -target aarch64-none-linux-android'
|
||||
elif arch == 'mips':
|
||||
cmd += ' -target mipsel-none-linux-android'
|
||||
cmd += ' -mips32'
|
||||
elif arch == 'mips64':
|
||||
cmd += ' -target mips64el-none-linux-android'
|
||||
elif arch == 'x86':
|
||||
cmd += ' -target i686-none-linux-android'
|
||||
elif arch == 'x86_64':
|
||||
cmd += ' -target x86_64-none-linux-android'
|
||||
cmd += ' -lc -lm'
|
||||
else:
|
||||
cmd += " -pthread"
|
||||
|
||||
if "SYSROOT" in SDK:
|
||||
cmd += " --sysroot=%s -no-canonical-prefixes" % (SDK["SYSROOT"])
|
||||
if "SYSROOT" in SDK:
|
||||
cmd += " --sysroot=%s -no-canonical-prefixes" % (SDK["SYSROOT"])
|
||||
|
||||
if LDFLAGS != "":
|
||||
cmd += " " + LDFLAGS
|
||||
@ -2446,6 +2421,7 @@ def WriteConfigSettings():
|
||||
dtool_config["PHAVE_GLOB_H"] = 'UNDEF'
|
||||
dtool_config["PHAVE_LOCKF"] = 'UNDEF'
|
||||
dtool_config["HAVE_VIDEO4LINUX"] = 'UNDEF'
|
||||
dtool_config["HAVE_X11"] = 'UNDEF'
|
||||
|
||||
if (GetOptimize() <= 2 and GetTarget() == "windows"):
|
||||
dtool_config["USE_DEBUG_PYTHON"] = '1'
|
||||
|
@ -404,8 +404,8 @@ def SetTarget(target, arch=None):
|
||||
# 64-bit platforms were introduced in Android 21.
|
||||
ANDROID_API = 21
|
||||
else:
|
||||
# Default to the lowest API level supported by NDK r16.
|
||||
ANDROID_API = 14
|
||||
# Default to the lowest API level still supported by Google.
|
||||
ANDROID_API = 19
|
||||
|
||||
# Determine the prefix for our gcc tools, eg. arm-linux-androideabi-gcc
|
||||
global ANDROID_ABI, ANDROID_TRIPLE
|
||||
@ -433,6 +433,7 @@ def SetTarget(target, arch=None):
|
||||
else:
|
||||
exit('Android architecture must be arm, armv7a, aarch64, mips, mips64, x86 or x86_64')
|
||||
|
||||
ANDROID_TRIPLE += str(ANDROID_API)
|
||||
TOOLCHAIN_PREFIX = ANDROID_TRIPLE + '-'
|
||||
|
||||
elif target == 'linux':
|
||||
@ -2540,15 +2541,6 @@ def SdkLocateAndroid():
|
||||
SDK["SYSROOT"] = os.path.join(ndk_root, 'platforms', 'android-%s' % (api), arch_dir).replace('\\', '/')
|
||||
#IncDirectory("ALWAYS", os.path.join(SDK["SYSROOT"], 'usr', 'include'))
|
||||
|
||||
# Starting with NDK r16, libc++ is the recommended STL to use.
|
||||
stdlibc = os.path.join(ndk_root, 'sources', 'cxx-stl', 'llvm-libc++')
|
||||
IncDirectory("ALWAYS", os.path.join(stdlibc, 'include').replace('\\', '/'))
|
||||
LibDirectory("ALWAYS", os.path.join(stdlibc, 'libs', abi).replace('\\', '/'))
|
||||
|
||||
stl_lib = os.path.join(stdlibc, 'libs', abi, 'libc++_shared.so')
|
||||
LibName("ALWAYS", stl_lib.replace('\\', '/'))
|
||||
CopyFile(os.path.join(GetOutputDir(), 'lib', 'libc++_shared.so'), stl_lib)
|
||||
|
||||
# The Android support library polyfills C++ features not available in the
|
||||
# STL that ships with Android.
|
||||
support = os.path.join(ndk_root, 'sources', 'android', 'support', 'include')
|
||||
@ -2957,12 +2949,7 @@ def SetupBuildEnvironment(compiler):
|
||||
|
||||
# Now extract the preprocessor's include directories.
|
||||
cmd = GetCXX() + " -x c++ -v -E " + os.devnull
|
||||
if "ANDROID_NDK" in SDK:
|
||||
ndk_dir = SDK["ANDROID_NDK"].replace('\\', '/')
|
||||
cmd += ' -isystem %s/sysroot/usr/include' % (ndk_dir)
|
||||
cmd += ' -isystem %s/sysroot/usr/include/%s' % (ndk_dir, SDK["ANDROID_TRIPLE"])
|
||||
else:
|
||||
cmd += sysroot_flag
|
||||
cmd += sysroot_flag
|
||||
|
||||
null = open(os.devnull, 'w')
|
||||
handle = subprocess.Popen(cmd, stdout=null, stderr=subprocess.PIPE, shell=True)
|
||||
|
Loading…
x
Reference in New Issue
Block a user