mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 12:43:36 +01:00
[gn] Support for per-target runtime directory layout
This change also introduces the clang_enable_per_target_runtime_dir to enable the use of per-target runtime directory layout which is the equivalent of LLVM_ENABLE_PER_TARGET_RUNTIME_DIR CMake option. Differential Revision: https://reviews.llvm.org/D60332 llvm-svn: 357850
This commit is contained in:
parent
e77fbc7181
commit
cfdca6e9ce
13
utils/gn/secondary/clang/runtimes.gni
Normal file
13
utils/gn/secondary/clang/runtimes.gni
Normal file
@ -0,0 +1,13 @@
|
||||
import("//clang/resource_dir.gni")
|
||||
import("//llvm/triples.gni")
|
||||
|
||||
declare_args() {
|
||||
# Use target triple as the name of the runtimes directory.
|
||||
clang_enable_per_target_runtime_dir = false
|
||||
}
|
||||
|
||||
if (clang_enable_per_target_runtime_dir) {
|
||||
runtimes_dir = "$clang_resource_dir/$llvm_target_triple/lib"
|
||||
} else {
|
||||
runtimes_dir = "$root_build_dir/lib"
|
||||
}
|
@ -11,7 +11,7 @@ declare_args() {
|
||||
|
||||
static_library("builtins") {
|
||||
output_dir = crt_current_out_dir
|
||||
output_name = "clang_rt.builtins-$crt_current_target"
|
||||
output_name = "clang_rt.builtins$crt_current_target_suffix"
|
||||
complete_static_lib = true
|
||||
cflags = [
|
||||
"-fPIC",
|
||||
|
@ -16,10 +16,10 @@ action("version_script") {
|
||||
"--version-list",
|
||||
"--extra",
|
||||
rebase_path(sources[0], root_build_dir),
|
||||
rebase_path("$crt_current_out_dir/libclang_rt.hwasan-$crt_current_target.a",
|
||||
rebase_path("$crt_current_out_dir/libclang_rt.hwasan$crt_current_target_suffix.a",
|
||||
root_build_dir),
|
||||
rebase_path(
|
||||
"$crt_current_out_dir/libclang_rt.hwasan_cxx-$crt_current_target.a",
|
||||
"$crt_current_out_dir/libclang_rt.hwasan_cxx$crt_current_target_suffix.a",
|
||||
root_build_dir),
|
||||
"-o",
|
||||
rebase_path(outputs[0], root_build_dir),
|
||||
@ -75,7 +75,7 @@ source_set("cxx_sources") {
|
||||
|
||||
static_library("hwasan") {
|
||||
output_dir = crt_current_out_dir
|
||||
output_name = "clang_rt.hwasan-$crt_current_target"
|
||||
output_name = "clang_rt.hwasan$crt_current_target_suffix"
|
||||
complete_static_lib = true
|
||||
configs -= [
|
||||
"//llvm/utils/gn/build:llvm_code",
|
||||
@ -89,7 +89,7 @@ static_library("hwasan") {
|
||||
|
||||
static_library("hwasan_cxx") {
|
||||
output_dir = crt_current_out_dir
|
||||
output_name = "clang_rt.hwasan_cxx-$crt_current_target"
|
||||
output_name = "clang_rt.hwasan_cxx$crt_current_target_suffix"
|
||||
complete_static_lib = true
|
||||
configs -= [
|
||||
"//llvm/utils/gn/build:llvm_code",
|
||||
@ -103,7 +103,7 @@ static_library("hwasan_cxx") {
|
||||
|
||||
shared_library("hwasan_shared") {
|
||||
output_dir = crt_current_out_dir
|
||||
output_name = "clang_rt.hwasan-$crt_current_target"
|
||||
output_name = "clang_rt.hwasan$crt_current_target_suffix"
|
||||
configs -= [ "//llvm/utils/gn/build:llvm_code" ]
|
||||
configs += [ "//llvm/utils/gn/build:crt_code" ]
|
||||
deps = [
|
||||
|
@ -1,10 +1,5 @@
|
||||
import("//clang/resource_dir.gni")
|
||||
|
||||
if (current_os == "linux" || current_os == "android") {
|
||||
crt_current_out_dir = "$clang_resource_dir/lib/linux"
|
||||
} else {
|
||||
assert(false, "unimplemented current_os " + current_os)
|
||||
}
|
||||
import("//clang/runtimes.gni")
|
||||
|
||||
if (current_cpu == "x86") {
|
||||
crt_current_target_arch = "i386"
|
||||
@ -16,7 +11,17 @@ if (current_cpu == "x86") {
|
||||
assert(false, "unimplemented current_cpu " + current_cpu)
|
||||
}
|
||||
|
||||
crt_current_target = crt_current_target_arch
|
||||
if (current_os == "android") {
|
||||
crt_current_target += "-android"
|
||||
if (clang_enable_per_target_runtime_dir) {
|
||||
crt_current_out_dir = runtimes_dir
|
||||
|
||||
crt_current_target_suffix = ""
|
||||
} else if (current_os == "linux" || current_os == "android") {
|
||||
crt_current_out_dir = "$clang_resource_dir/lib/linux"
|
||||
|
||||
crt_current_target_suffix = "-$crt_current_target_arch"
|
||||
if (current_os == "android") {
|
||||
crt_current_target_suffix += "-android"
|
||||
}
|
||||
} else {
|
||||
assert(false, "unimplemented current_os " + current_os)
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ write_cmake_config("lit_site_cfg") {
|
||||
values = [
|
||||
"LIT_SITE_CFG_IN_HEADER=## Autogenerated from $input, do not edit",
|
||||
|
||||
"HWASAN_TEST_CONFIG_SUFFIX=-$crt_current_target",
|
||||
"HWASAN_TEST_CONFIG_SUFFIX=$crt_current_target_suffix",
|
||||
"HWASAN_TEST_TARGET_CFLAGS=$target_flags_string",
|
||||
"HWASAN_TEST_TARGET_ARCH=$crt_current_target_arch",
|
||||
|
||||
@ -21,7 +21,7 @@ write_cmake_config("lit_site_cfg") {
|
||||
|
||||
if (current_os == "android") {
|
||||
values += [ "HWASAN_ANDROID_FILES_TO_PUSH=[\"" + rebase_path(
|
||||
"$crt_current_out_dir/libclang_rt.hwasan-$crt_current_target.so") + "\", \"" + rebase_path(
|
||||
"$crt_current_out_dir/libclang_rt.hwasan$crt_current_target_suffix.so") + "\", \"" + rebase_path(
|
||||
"$root_out_dir/bin/llvm-symbolizer") + "\"]" ]
|
||||
} else {
|
||||
values += [ "HWASAN_ANDROID_FILES_TO_PUSH=[]" ]
|
||||
|
Loading…
Reference in New Issue
Block a user