gn build: Add support for building lldb-server on Android.

The cross-compiled lldb-server targets are added to the lldb deps if
Android cross compilation is enabled.

Differential Revision: https://reviews.llvm.org/D109464
This commit is contained in:
Peter Collingbourne 2021-09-08 12:53:30 -07:00
parent 9449f441fc
commit 883e93cb28
3 changed files with 18 additions and 1 deletions

View File

@ -1,4 +1,4 @@
declare_args() { declare_args() {
# Whether to include code that links against libxml2. # Whether to include code that links against libxml2.
llvm_enable_libxml2 = host_os != "win" llvm_enable_libxml2 = current_os != "win" && current_os != "android"
} }

View File

@ -1,4 +1,5 @@
import("//llvm/utils/TableGen/tablegen.gni") import("//llvm/utils/TableGen/tablegen.gni")
import("//llvm/utils/gn/build/toolchain/compiler.gni")
import("//llvm/utils/gn/build/write_cmake_config.gni") import("//llvm/utils/gn/build/write_cmake_config.gni")
import("//llvm/version.gni") import("//llvm/version.gni")
@ -15,6 +16,14 @@ if (current_os == "mac") {
} }
} }
supported_toolchains = []
if (android_ndk_path != "") {
supported_toolchains += [
"//llvm/utils/gn/build/toolchain:stage2_android_aarch64",
"//llvm/utils/gn/build/toolchain:stage2_android_arm",
]
}
executable("lldb") { executable("lldb") {
configs += [ "//llvm/utils/gn/build:lldb_code" ] configs += [ "//llvm/utils/gn/build:lldb_code" ]
deps = [ deps = [
@ -34,6 +43,9 @@ executable("lldb") {
if (current_os == "linux") { if (current_os == "linux") {
deps += [ "//lldb/tools/lldb-server" ] deps += [ "//lldb/tools/lldb-server" ]
} }
foreach (toolchain, supported_toolchains) {
deps += [ "//lldb/tools/lldb-server($toolchain)" ]
}
sources = [ sources = [
"Driver.cpp", "Driver.cpp",

View File

@ -1,3 +1,4 @@
import("//compiler-rt/target.gni")
import("//llvm/utils/TableGen/tablegen.gni") import("//llvm/utils/TableGen/tablegen.gni")
tablegen("LLGSOptions") { tablegen("LLGSOptions") {
@ -57,4 +58,8 @@ executable("lldb-server") {
"lldb-platform.cpp", "lldb-platform.cpp",
"lldb-server.cpp", "lldb-server.cpp",
] ]
if (current_os == "android") {
output_dir = "$root_build_dir/runtimes_ndk_cxx/$crt_current_target_arch"
}
} }