Add GN build support for Android 64-bit platforms.

gn now run with arg target_arch = "x64", arm64 and mips64el
releated changes are added as well but not verified.

BUG=none

Review URL: https://codereview.chromium.org/864173006

Cr-Original-Commit-Position: refs/heads/master@{#315680}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 98de73d11797b1b0ac7ac0b2f4234cb8f57bd2fc
This commit is contained in:
halton.huo 2015-02-10 16:08:27 -08:00 коммит произвёл Commit bot
Родитель 4379c683cb
Коммит ecccd44736
3 изменённых файлов: 61 добавлений и 0 удалений

Просмотреть файл

@ -98,6 +98,13 @@ if (is_android) {
"platforms/android-${_android_api_level}/arch-arm"
mips_android_sysroot_subdir =
"platforms/android-${_android_api_level}/arch-mips"
_android64_api_level = 21
x86_64_android_sysroot_subdir =
"platforms/android-${_android64_api_level}/arch-x86_64"
arm64_android_sysroot_subdir =
"platforms/android-${_android64_api_level}/arch-arm64"
mips64_android_sysroot_subdir =
"platforms/android-${_android64_api_level}/arch-mips64"
# Toolchain root directory for each build. The actual binaries are inside
# a "bin" directory inside of these.
@ -105,6 +112,9 @@ if (is_android) {
x86_android_toolchain_root = "$android_ndk_root/toolchains/x86-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
arm_android_toolchain_root = "$android_ndk_root/toolchains/arm-linux-androideabi-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
mips_android_toolchain_root = "$android_ndk_root/toolchains/mipsel-linux-android-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
x86_64_android_toolchain_root = "$android_ndk_root/toolchains/x86_64-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
arm64_android_toolchain_root = "$android_ndk_root/toolchains/aarch64-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
mips64_android_toolchain_root = "$android_ndk_root/toolchains/mips64el-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
# Location of libgcc. This is only needed for the current GN toolchain, so we
# only need to define the current one, rather than one for every platform
@ -124,6 +134,21 @@ if (is_android) {
_binary_prefix = "mipsel-linux-android"
android_toolchain_root = "$mips_android_toolchain_root"
android_libgcc_file = "$android_toolchain_root/lib/gcc/mipsel-linux-android/${_android_toolchain_version}/libgcc.a"
} else if (cpu_arch == "x64") {
android_prebuilt_arch = "android-x86_64"
_binary_prefix = "x86_64-linux-android"
android_toolchain_root = "$x86_64_android_toolchain_root"
android_libgcc_file = "$android_toolchain_root/lib/gcc/x86_64-linux-android/${_android_toolchain_version}/libgcc.a"
} else if (cpu_arch == "arm64") {
android_prebuilt_arch = "android-arm64"
_binary_prefix = "aarch64-linux-android"
android_toolchain_root = "$arm64_android_toolchain_root"
android_libgcc_file = "$android_toolchain_root/lib/gcc/aarch64-linux-android/${_android_toolchain_version}/libgcc.a"
} else if (cpu_arch == "mips64el") {
android_prebuilt_arch = "android-mips64"
_binary_prefix = "mips64el-linux-android"
android_toolchain_root = "$mips64_android_toolchain_root"
android_libgcc_file = "$android_toolchain_root/lib/gcc/mips64el-linux-android/${_android_toolchain_version}/libgcc.a"
} else {
assert(false, "Need android libgcc support for your target arch.")
}
@ -155,6 +180,12 @@ if (is_android) {
}
} else if (cpu_arch == "mipsel") {
android_app_abi = "mips"
} else if (cpu_arch == "x64") {
android_app_abi = "x86_64"
} else if (cpu_arch == "arm64") {
android_app_abi = "arm64-v8a"
} else if (cpu_arch == "mips64el") {
android_app_abi = "mips64"
} else {
assert(false, "Unknown Android ABI: " + cpu_arch)
}

Просмотреть файл

@ -22,6 +22,12 @@ if (current_toolchain == default_toolchain && target_sysroot != "") {
sysroot = rebase_path("$android_ndk_root/$arm_android_sysroot_subdir")
} else if (cpu_arch == "mipsel") {
sysroot = rebase_path("$android_ndk_root/$mips_android_sysroot_subdir")
} else if (cpu_arch == "x64") {
sysroot = rebase_path("$android_ndk_root/$x86_64_android_sysroot_subdir")
} else if (cpu_arch == "arm64") {
sysroot = rebase_path("$android_ndk_root/$arm64_android_sysroot_subdir")
} else if (cpu_arch == "mips64") {
sysroot = rebase_path("$android_ndk_root/$mips64_android_sysroot_subdir")
} else {
sysroot = ""
}

Просмотреть файл

@ -103,3 +103,27 @@ android_gcc_toolchain("mipsel") {
tool_prefix = "$mips_android_toolchain_root/bin/mipsel-linux-android-"
toolchain_cpu_arch = "mipsel"
}
android_gcc_toolchain("x64") {
android_ndk_sysroot = "$android_ndk_root/$x86_64_android_sysroot_subdir"
android_ndk_lib_dir = "usr/lib"
tool_prefix = "$x86_64_android_toolchain_root/bin/x86_64-linux-android-"
toolchain_cpu_arch = "x86_64"
}
android_gcc_toolchain("arm64") {
android_ndk_sysroot = "$android_ndk_root/$arm64_android_sysroot_subdir"
android_ndk_lib_dir = "usr/lib"
tool_prefix = "$arm64_android_toolchain_root/bin/arm-linux-androideabi-"
toolchain_cpu_arch = "aarch64"
}
android_gcc_toolchain("mips64el") {
android_ndk_sysroot = "$android_ndk_root/$mips64_android_sysroot_subdir"
android_ndk_lib_dir = "usr/lib"
tool_prefix = "$mips64_android_toolchain_root/bin/mipsel-linux-android-"
toolchain_cpu_arch = "mipsel64el"
}