mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:58:29 +00:00
Build for Android x64
This change adds standalone VM build targets for x64 Android. Build with, e.g.: ./tools/build.py -m debug -a x64 --os=android runtime R=iposva@google.com Review URL: https://codereview.chromium.org/1762043002 .
This commit is contained in:
parent
3d5b6017c1
commit
7a2512540a
|
@ -48,9 +48,9 @@ def main():
|
|||
link_args = sys.argv[4:]
|
||||
|
||||
# Check arguments.
|
||||
if target_arch not in ['arm', 'arm64', 'ia32']:
|
||||
if target_arch not in ['arm', 'arm64', 'ia32', 'x64']:
|
||||
raise Exception(sys.argv[0] +
|
||||
" first argument must be 'arm', 'arm64', or 'ia32'")
|
||||
" first argument must be 'arm', 'arm64', 'ia32', or 'x64'")
|
||||
if link_type not in ['executable', 'library', 'shared_library']:
|
||||
raise Exception(sys.argv[0] +
|
||||
" second argument must be 'executable' or 'library'")
|
||||
|
@ -81,6 +81,8 @@ def main():
|
|||
toolchain_arch = 'aarch64-linux-android-4.9'
|
||||
if target_arch == 'ia32':
|
||||
toolchain_arch = 'x86-4.9'
|
||||
if target_arch == 'x64':
|
||||
toolchain_arch = 'x86_64-4.9'
|
||||
toolchain_dir = 'linux-x86_64'
|
||||
android_toolchain = os.path.join(android_ndk_root,
|
||||
'toolchains', toolchain_arch,
|
||||
|
@ -94,6 +96,8 @@ def main():
|
|||
android_toolchain, 'aarch64-linux-android-c++')
|
||||
if target_arch == 'ia32':
|
||||
android_linker = os.path.join(android_toolchain, 'i686-linux-android-g++')
|
||||
if target_arch == 'x64':
|
||||
android_linker = os.path.join(android_toolchain, 'x86_64-linux-android-g++')
|
||||
|
||||
# Grab the path to libgcc.a, which we must explicitly add to the link,
|
||||
# by invoking the cross-compiler with the -print-libgcc-file-name flag.
|
||||
|
@ -102,6 +106,8 @@ def main():
|
|||
android_gcc = os.path.join(android_toolchain, 'aarch64-linux-android-gcc')
|
||||
if target_arch == 'ia32':
|
||||
android_gcc = os.path.join(android_toolchain, 'i686-linux-android-gcc')
|
||||
if target_arch == 'x64':
|
||||
android_gcc = os.path.join(android_toolchain, 'x86_64-linux-android-gcc')
|
||||
android_libgcc = subprocess.check_output(
|
||||
[android_gcc, '-print-libgcc-file-name']).strip()
|
||||
|
||||
|
@ -109,14 +115,19 @@ def main():
|
|||
# Android specific system includes and libraries.
|
||||
android_ndk_sysroot = os.path.join(android_ndk_root,
|
||||
'platforms', 'android-14', 'arch-arm')
|
||||
libdir = 'lib'
|
||||
if target_arch == 'arm64':
|
||||
android_ndk_sysroot = os.path.join(android_ndk_root,
|
||||
'platforms', 'android-21', 'arch-arm64')
|
||||
if target_arch == 'ia32':
|
||||
android_ndk_sysroot = os.path.join(android_ndk_root,
|
||||
'platforms', 'android-14', 'arch-x86')
|
||||
if target_arch == 'x64':
|
||||
android_ndk_sysroot = os.path.join(android_ndk_root,
|
||||
'platforms', 'android-21', 'arch-x86_64')
|
||||
libdir = 'lib64'
|
||||
CheckDirExists(android_ndk_sysroot, 'Android sysroot')
|
||||
android_ndk_lib = os.path.join(android_ndk_sysroot,'usr','lib')
|
||||
android_ndk_lib = os.path.join(android_ndk_sysroot, 'usr', libdir)
|
||||
crtend_android = os.path.join(android_ndk_lib, 'crtend_android.o')
|
||||
|
||||
if link_target == 'target':
|
||||
|
|
|
@ -119,7 +119,7 @@ def ProcessOptions(options, args):
|
|||
print ("Cross-compilation to %s is not supported on host os %s."
|
||||
% (os_name, HOST_OS))
|
||||
return False
|
||||
if not arch in ['ia32', 'arm', 'armv6', 'armv5te', 'arm64', 'mips']:
|
||||
if not arch in ['ia32', 'x64', 'arm', 'armv6', 'armv5te', 'arm64', 'mips']:
|
||||
print ("Cross-compilation to %s is not supported for architecture %s."
|
||||
% (os_name, arch))
|
||||
return False
|
||||
|
@ -143,6 +143,8 @@ def GetToolchainPrefix(target_os, arch, options):
|
|||
return os.path.join(android_toolchain, 'aarch64-linux-android')
|
||||
if arch == 'ia32':
|
||||
return os.path.join(android_toolchain, 'i686-linux-android')
|
||||
if arch == 'x64':
|
||||
return os.path.join(android_toolchain, 'x86_64-linux-android')
|
||||
|
||||
# If no cross compiler is specified, only try to figure one out on Linux.
|
||||
if not HOST_OS in ['linux']:
|
||||
|
@ -195,7 +197,7 @@ def GetAndroidToolchainDir(host_os, target_arch):
|
|||
global THIRD_PARTY_ROOT
|
||||
if host_os not in ['linux']:
|
||||
raise Exception('Unsupported host os %s' % host_os)
|
||||
if target_arch not in ['ia32', 'arm', 'arm64']:
|
||||
if target_arch not in ['ia32', 'x64', 'arm', 'arm64']:
|
||||
raise Exception('Unsupported target architecture %s' % target_arch)
|
||||
|
||||
# Set up path to the Android NDK.
|
||||
|
@ -211,6 +213,8 @@ def GetAndroidToolchainDir(host_os, target_arch):
|
|||
toolchain_arch = 'aarch64-linux-android-4.9'
|
||||
if target_arch == 'ia32':
|
||||
toolchain_arch = 'x86-4.9'
|
||||
if target_arch == 'x64':
|
||||
toolchain_arch = 'x86_64-4.9'
|
||||
toolchain_dir = 'linux-x86_64'
|
||||
android_toolchain = os.path.join(android_ndk_root,
|
||||
'toolchains', toolchain_arch,
|
||||
|
|
|
@ -660,6 +660,33 @@
|
|||
],
|
||||
},
|
||||
|
||||
'DebugAndroidX64': {
|
||||
'inherit_from': [
|
||||
'Dart_Base', 'Dart_x64_Base', 'Dart_Debug',
|
||||
'Dart_Android_Base',
|
||||
'Dart_Android_x64_Base',
|
||||
'Dart_Android_Debug',
|
||||
],
|
||||
},
|
||||
|
||||
'ReleaseAndroidX64': {
|
||||
'inherit_from': [
|
||||
'Dart_Base', 'Dart_x64_Base', 'Dart_Release',
|
||||
'Dart_Android_Base',
|
||||
'Dart_Android_x64_Base',
|
||||
'Dart_Android_Release',
|
||||
],
|
||||
},
|
||||
|
||||
'ProductAndroidX64': {
|
||||
'inherit_from': [
|
||||
'Dart_Base', 'Dart_x64_Base', 'Dart_Product',
|
||||
'Dart_Android_Base',
|
||||
'Dart_Android_x64_Base',
|
||||
'Dart_Android_Product',
|
||||
],
|
||||
},
|
||||
|
||||
'DebugAndroidARM': {
|
||||
'inherit_from': [
|
||||
'Dart_Base', 'Dart_arm_Base', 'Dart_Debug',
|
||||
|
|
|
@ -148,6 +148,58 @@
|
|||
}],
|
||||
],
|
||||
},
|
||||
'Dart_Android_x64_Base': {
|
||||
'abstract': 1,
|
||||
'variables': {
|
||||
'android_sysroot': '<(android_ndk_root)/platforms/android-21/arch-x86_64',
|
||||
'android_ndk_include': '<(android_sysroot)/usr/include',
|
||||
'android_ndk_lib': '<(android_sysroot)/usr/lib64',
|
||||
},
|
||||
'target_conditions': [
|
||||
['_toolset=="target"', {
|
||||
'cflags': [
|
||||
'-fPIE',
|
||||
'--sysroot=<(android_sysroot)',
|
||||
'-I<(android_ndk_include)',
|
||||
'-I<(android_ndk_root)/sources/cxx-stl/stlport/stlport',
|
||||
],
|
||||
'target_conditions': [
|
||||
['_type=="executable"', {
|
||||
'ldflags!': ['-Wl,--exclude-libs=ALL,-shared',],
|
||||
}],
|
||||
['_type=="shared_library"', {
|
||||
'ldflags': ['-Wl,-shared,-Bsymbolic',],
|
||||
}],
|
||||
],
|
||||
'ldflags': [
|
||||
'x64', '>(_type)', 'target',
|
||||
'-nostdlib',
|
||||
'-Wl,--no-undefined',
|
||||
# Don't export symbols from statically linked libraries.
|
||||
'-Wl,--exclude-libs=ALL',
|
||||
'-Wl,-rpath-link=<(android_ndk_lib)',
|
||||
'-L<(android_ndk_lib)',
|
||||
'-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/x86_64',
|
||||
'-z',
|
||||
'muldefs',
|
||||
'-Bdynamic',
|
||||
'-pie',
|
||||
'-Wl,-dynamic-linker,/system/bin/linker',
|
||||
'-Wl,--gc-sections',
|
||||
'-Wl,-z,nocopyreloc',
|
||||
# crtbegin_dynamic.o should be the last item in ldflags.
|
||||
'<(android_ndk_lib)/crtbegin_dynamic.o',
|
||||
],
|
||||
'ldflags!': [
|
||||
'-pthread', # Not supported by Android toolchain.
|
||||
],
|
||||
}],
|
||||
['_toolset=="host"', {
|
||||
'cflags': [ '-pthread' ],
|
||||
'ldflags': [ '-pthread' ],
|
||||
}],
|
||||
],
|
||||
},
|
||||
'Dart_Android_arm_Base': {
|
||||
'abstract': 1,
|
||||
'variables': {
|
||||
|
|
Loading…
Reference in a new issue