Fixed android arm64v8

This commit is contained in:
Colin Kinloch 2017-12-18 15:39:09 +00:00
parent 9969c5c6a1
commit 853b1daa49
3 changed files with 23 additions and 9 deletions

View file

@ -333,7 +333,7 @@ if webm_cpu_x86:
if webm_cpu_arm:
if env["platform"] == 'iphone':
env_libvpx["ASFLAGS"] = '-arch armv7'
elif env["platform"] == 'android' or env["platform"] == 'x11' or env["platform"] == 'server':
elif env["platform"] == 'android' and env["android_arch"] == 'armv7' or env["platform"] == 'x11' or env["platform"] == 'server':
env_libvpx["ASFLAGS"] = '-mfpu=neon'
elif env["platform"] == 'uwp':
env_libvpx["AS"] = 'armasm'
@ -389,5 +389,5 @@ elif webm_cpu_arm:
env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_armasm_ms)
elif env["platform"] == 'iphone':
env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_gas_apple)
else:
elif not env["android_arch"] == 'arm64v8':
env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_gas)

View file

@ -14,10 +14,13 @@ def get_name():
def can_build():
return ("ANDROID_NDK_ROOT" in os.environ)
def get_platform(platform):
return int(platform.split("-")[1])
def get_opts():
from SCons.Variables import BoolVariable, EnumVariable
@ -124,6 +127,9 @@ def configure(env):
else:
env.extra_suffix = ".armv7" + env.extra_suffix
elif env["android_arch"] == "arm64v8":
if get_platform(env["ndk_platform"]) < 21:
print("WARNING: android_arch=arm64v8 is not supported by ndk_platform lower than andorid-21; setting ndk_platform=android-21")
env["ndk_platform"] = "android-21"
env['ARCH'] = 'arch-arm64'
target_subpath = "aarch64-linux-android-4.9"
abi_subpath = "aarch64-linux-android"
@ -160,12 +166,13 @@ def configure(env):
elif (sys.platform.startswith('win')):
if (platform.machine().endswith('64')):
host_subpath = "windows-x86_64"
if env["android_arch"] == "arm64v8":
mt_link = False
else:
mt_link = False
host_subpath = "windows"
if env["android_arch"] == "arm64v8":
mt_link = False
compiler_path = env["ANDROID_NDK_ROOT"] + "/toolchains/llvm/prebuilt/" + host_subpath + "/bin"
gcc_toolchain_path = env["ANDROID_NDK_ROOT"] + "/toolchains/" + target_subpath + "/prebuilt/" + host_subpath
tools_path = gcc_toolchain_path + "/" + abi_subpath + "/bin"
@ -199,7 +206,7 @@ def configure(env):
env.Append(CPPFLAGS=["-isystem", sysroot + "/usr/include"])
env.Append(CPPFLAGS=["-isystem", sysroot + "/usr/include/" + abi_subpath])
# For unified headers this define has to be set manually
env.Append(CPPFLAGS=["-D__ANDROID_API__=" + str(int(env['ndk_platform'].split("-")[1]))])
env.Append(CPPFLAGS=["-D__ANDROID_API__=" + str(get_platform(env['ndk_platform']))])
else:
print("Using NDK deprecated headers")
env.Append(CPPFLAGS=["-isystem", lib_sysroot + "/usr/include"])
@ -254,10 +261,10 @@ def configure(env):
env.Append(LINKFLAGS=target_opts)
env.Append(LINKFLAGS=common_opts)
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + '/toolchains/arm-linux-androideabi-4.9/prebuilt/' +
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + '/toolchains/' + target_subpath + '/prebuilt/' +
host_subpath + '/lib/gcc/' + abi_subpath + '/4.9.x'])
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] +
'/toolchains/arm-linux-androideabi-4.9/prebuilt/' + host_subpath + '/' + abi_subpath + '/lib'])
'/toolchains/' + target_subpath + '/prebuilt/' + host_subpath + '/' + abi_subpath + '/lib'])
env.Append(CPPPATH=['#platform/android'])
env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED', '-DNO_FCNTL', '-DMPC_FIXED_POINT'])

View file

@ -42,13 +42,20 @@
#define HAVE_SSE2 1
#define HAVE_SSSE3 1
#define HAVE_AVX2 1
#elif defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(__aarch64__)
#elif defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM)
#define ARCH_X86 0
#define ARCH_X86_64 0
#define ARCH_ARM 1
#define HAVE_NEON 1
#define HAVE_NEON_ASM 1
#elif defined(__aarch64__)
#define ARCH_X86 0
#define ARCH_X86_64 0
#define ARCH_ARM 1
#define HAVE_NEON 0
#define HAVE_NEON_ASM 0
#else
#define ARCH_X86 0
#define ARCH_X86_64 0