aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/cpp
diff options
context:
space:
mode:
authorGravatar hlopko <hlopko@google.com>2017-09-12 10:51:44 +0200
committerGravatar Philipp Wollermann <philwo@google.com>2017-09-12 14:07:23 +0200
commitb05bff63d4738a4db1641a13735864ed8e787d96 (patch)
tree6a337d592a00d17baf14a1e8ab7b1953f0cb119e /tools/cpp
parentfc06a7568fa4b9e2e425652e6ff83b6662f602d2 (diff)
Expose sysroot as a build variable
This cl removes hardcoded --sysroot flag generation from bazel when constructing command line for C++ actions. The hardcoded flag is still exposed to Skylark (to stay backwards compatible). RELNOTES: None. PiperOrigin-RevId: 168346711
Diffstat (limited to 'tools/cpp')
-rw-r--r--tools/cpp/CROSSTOOL23
-rw-r--r--tools/cpp/CROSSTOOL.tpl23
2 files changed, 46 insertions, 0 deletions
diff --git a/tools/cpp/CROSSTOOL b/tools/cpp/CROSSTOOL
index b9b78f5c0b..0a96846be1 100644
--- a/tools/cpp/CROSSTOOL
+++ b/tools/cpp/CROSSTOOL
@@ -711,6 +711,7 @@ toolchain {
}
implies: 'legacy_compile_flags'
implies: 'user_compile_flags'
+ implies: 'sysroot'
implies: 'unfiltered_compile_flags'
}
@@ -747,6 +748,7 @@ toolchain {
}
implies: 'legacy_compile_flags'
implies: 'user_compile_flags'
+ implies: 'sysroot'
implies: 'unfiltered_compile_flags'
}
@@ -833,6 +835,27 @@ toolchain {
}
feature {
+ name: 'sysroot'
+ flag_set {
+ expand_if_all_available: 'sysroot'
+ action: 'assemble'
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-header-preprocessing'
+ action: 'c++-module-compile'
+ action: 'c++-module-codegen'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ flag_group {
+ iterate_over: 'sysroot'
+ flag: '--sysroot=%{sysroot}'
+ }
+ }
+ }
+
+ feature {
name: 'unfiltered_compile_flags'
flag_set {
expand_if_all_available: 'unfiltered_compile_flags'
diff --git a/tools/cpp/CROSSTOOL.tpl b/tools/cpp/CROSSTOOL.tpl
index 7b7630bd0b..f2dff43c63 100644
--- a/tools/cpp/CROSSTOOL.tpl
+++ b/tools/cpp/CROSSTOOL.tpl
@@ -284,6 +284,7 @@ toolchain {
implies: 'msvc_env'
implies: 'parse_showincludes'
implies: 'user_compile_flags'
+ implies: 'sysroot'
implies: 'unfiltered_compile_flags'
}
@@ -323,6 +324,7 @@ toolchain {
implies: 'msvc_env'
implies: 'parse_showincludes'
implies: 'user_compile_flags'
+ implies: 'sysroot'
implies: 'unfiltered_compile_flags'
}
@@ -897,6 +899,27 @@ toolchain {
}
feature {
+ name: 'sysroot'
+ flag_set {
+ expand_if_all_available: 'sysroot'
+ action: 'assemble'
+ action: 'preprocess-assemble'
+ action: 'c-compile'
+ action: 'c++-compile'
+ action: 'c++-header-parsing'
+ action: 'c++-header-preprocessing'
+ action: 'c++-module-compile'
+ action: 'c++-module-codegen'
+ action: 'c++-link-executable'
+ action: 'c++-link-dynamic-library'
+ flag_group {
+ iterate_over: 'sysroot'
+ flag: '--sysroot=%{sysroot}'
+ }
+ }
+ }
+
+ feature {
name: 'unfiltered_compile_flags'
flag_set {
expand_if_all_available: 'unfiltered_compile_flags'