blob: dfbe6c4f57044302aa2f029f697dd161d41dabcb [file] [log] [blame]
Colin Cross4d9c2d12016-07-29 12:48:20 -07001// Copyright 2016 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Colin Crossb98c8b02016-07-29 13:44:28 -070015package config
Colin Cross4d9c2d12016-07-29 12:48:20 -070016
17import (
18 "strings"
19
20 "android/soong/android"
Ramy Medhat9a90fe52020-04-13 13:21:23 -040021 "android/soong/remoteexec"
Colin Cross4d9c2d12016-07-29 12:48:20 -070022)
23
Colin Cross4d9c2d12016-07-29 12:48:20 -070024var (
Leo Li8756b372017-05-22 16:11:34 -070025 // Flags used by lots of devices. Putting them in package static variables
26 // will save bytes in build.ninja so they aren't repeated for every file
Colin Cross4d9c2d12016-07-29 12:48:20 -070027 commonGlobalCflags = []string{
28 "-DANDROID",
29 "-fmessage-length=0",
30 "-W",
31 "-Wall",
32 "-Wno-unused",
33 "-Winit-self",
34 "-Wpointer-arith",
George Burgess IVfb81db22020-02-22 19:28:56 -080035 "-Wunreachable-code-loop-increment",
Colin Cross4d9c2d12016-07-29 12:48:20 -070036
Colin Cross7278afc2017-11-02 22:38:32 -070037 // Make paths in deps files relative
38 "-no-canonical-prefixes",
39
Colin Cross4d9c2d12016-07-29 12:48:20 -070040 "-DNDEBUG",
41 "-UDEBUG",
Colin Cross7278afc2017-11-02 22:38:32 -070042
43 "-fno-exceptions",
44 "-Wno-multichar",
45
46 "-O2",
47 "-g",
cmtice5e13f862021-04-22 03:17:16 +000048 "-fdebug-default-version=5",
Yi Kong110cd5f2020-11-04 01:44:15 +080049 "-fdebug-info-for-profiling",
Colin Cross7278afc2017-11-02 22:38:32 -070050
51 "-fno-strict-aliasing",
Dan Willemsen5d980c82019-08-27 19:37:10 -070052
53 "-Werror=date-time",
Elliott Hughes2cdbdf12019-12-03 18:13:00 -080054 "-Werror=pragma-pack",
55 "-Werror=pragma-pack-suspicious-include",
Christopher Di Bella23a991c2020-11-11 22:41:32 +000056 "-Werror=string-plus-int",
George Burgess IVfb81db22020-02-22 19:28:56 -080057 "-Werror=unreachable-code-loop-increment",
Colin Cross9cc59c12021-07-14 17:59:54 -070058
59 "-D__compiler_offsetof=__builtin_offsetof",
60
61 // Emit address-significance table which allows linker to perform safe ICF. Clang does
62 // not emit the table by default on Android since NDK still uses GNU binutils.
63 "-faddrsig",
64
65 // Turn on -fcommon explicitly, since Clang now defaults to -fno-common. The cleanup bug
66 // tracking this is http://b/151457797.
67 "-fcommon",
68
69 // Help catch common 32/64-bit errors.
70 "-Werror=int-conversion",
71
72 // Enable the new pass manager.
73 "-fexperimental-new-pass-manager",
74
75 // Disable overly aggressive warning for macros defined with a leading underscore
76 // This happens in AndroidConfig.h, which is included nearly everywhere.
77 // TODO: can we remove this now?
78 "-Wno-reserved-id-macro",
79
80 // Workaround for ccache with clang.
81 // See http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html.
82 "-Wno-unused-command-line-argument",
83
84 // Force clang to always output color diagnostics. Ninja will strip the ANSI
85 // color codes if it is not running in a terminal.
86 "-fcolor-diagnostics",
87
88 // Warnings from clang-7.0
89 "-Wno-sign-compare",
90
91 // Warnings from clang-8.0
92 "-Wno-defaulted-function-deleted",
93
94 // Disable -Winconsistent-missing-override until we can clean up the existing
95 // codebase for it.
96 "-Wno-inconsistent-missing-override",
97
98 // Warnings from clang-10
99 // Nested and array designated initialization is nice to have.
100 "-Wno-c99-designator",
101
102 // Warnings from clang-12
103 "-Wno-gnu-folding-constant",
104
105 // Calls to the APIs that are newer than the min sdk version of the caller should be
106 // guarded with __builtin_available.
107 "-Wunguarded-availability",
108 // This macro allows the bionic versioning.h to indirectly determine whether the
109 // option -Wunguarded-availability is on or not.
110 "-D__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__",
Colin Cross4d9c2d12016-07-29 12:48:20 -0700111 }
112
Colin Cross6f6a4282016-10-17 14:19:06 -0700113 commonGlobalConlyflags = []string{}
Elliott Hughes5a0401a2016-10-07 13:12:58 -0700114
Colin Cross4d9c2d12016-07-29 12:48:20 -0700115 deviceGlobalCflags = []string{
Colin Cross133dbe72017-11-02 22:55:19 -0700116 "-ffunction-sections",
Colin Crossea3141d2017-11-06 14:02:02 -0800117 "-fdata-sections",
118 "-fno-short-enums",
Colin Cross133dbe72017-11-02 22:55:19 -0700119 "-funwind-tables",
120 "-fstack-protector-strong",
121 "-Wa,--noexecstack",
122 "-D_FORTIFY_SOURCE=2",
123
124 "-Wstrict-aliasing=2",
125
Colin Cross4d9c2d12016-07-29 12:48:20 -0700126 "-Werror=return-type",
127 "-Werror=non-virtual-dtor",
128 "-Werror=address",
129 "-Werror=sequence-point",
Colin Cross133dbe72017-11-02 22:55:19 -0700130 "-Werror=format-security",
Colin Crossc8bed312021-07-14 17:56:21 -0700131 "-nostdlibinc",
Colin Cross4d9c2d12016-07-29 12:48:20 -0700132 }
133
Colin Cross26f14502017-11-06 13:59:48 -0800134 deviceGlobalCppflags = []string{
135 "-fvisibility-inlines-hidden",
136 }
137
Colin Cross324a4572017-11-02 23:09:41 -0700138 deviceGlobalLdflags = []string{
139 "-Wl,-z,noexecstack",
140 "-Wl,-z,relro",
141 "-Wl,-z,now",
142 "-Wl,--build-id=md5",
143 "-Wl,--warn-shared-textrel",
144 "-Wl,--fatal-warnings",
145 "-Wl,--no-undefined-version",
Ryan Prichardb35a85e2021-01-13 19:18:53 -0800146 // TODO: Eventually we should link against a libunwind.a with hidden symbols, and then these
147 // --exclude-libs arguments can be removed.
Christopher Ferrisc3a1e222019-04-10 17:57:50 -0700148 "-Wl,--exclude-libs,libgcc.a",
Yi Kong3d8792f2019-05-06 16:18:33 -0700149 "-Wl,--exclude-libs,libgcc_stripped.a",
Peter Collingbournee5ba2862019-12-10 18:37:45 -0800150 "-Wl,--exclude-libs,libunwind_llvm.a",
Ryan Prichardb35a85e2021-01-13 19:18:53 -0800151 "-Wl,--exclude-libs,libunwind.a",
Ryo Hashimoto5818b932021-03-23 15:05:22 +0900152 "-Wl,--icf=safe",
Colin Cross4d9c2d12016-07-29 12:48:20 -0700153 }
154
Colin Cross33bac242021-07-14 17:03:16 -0700155 deviceGlobalLldflags = append(deviceGlobalLdflags,
Chih-Hung Hsieh02b4da52018-04-03 11:33:34 -0700156 []string{
Chih-Hung Hsieh02b4da52018-04-03 11:33:34 -0700157 "-fuse-ld=lld",
158 }...)
159
Colin Cross4d9c2d12016-07-29 12:48:20 -0700160 hostGlobalCflags = []string{}
161
Colin Cross26f14502017-11-06 13:59:48 -0800162 hostGlobalCppflags = []string{}
163
Colin Cross324a4572017-11-02 23:09:41 -0700164 hostGlobalLdflags = []string{}
165
Chih-Hung Hsieh3101a962018-04-17 14:16:05 -0700166 hostGlobalLldflags = []string{"-fuse-ld=lld"}
Chih-Hung Hsieh02b4da52018-04-03 11:33:34 -0700167
Colin Cross4d9c2d12016-07-29 12:48:20 -0700168 commonGlobalCppflags = []string{
169 "-Wsign-promo",
Colin Crossc8bed312021-07-14 17:56:21 -0700170
171 // -Wimplicit-fallthrough is not enabled by -Wall.
172 "-Wimplicit-fallthrough",
173
174 // Enable clang's thread-safety annotations in libcxx.
175 "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
176
177 // libc++'s math.h has an #include_next outside of system_headers.
178 "-Wno-gnu-include-next",
Colin Cross4d9c2d12016-07-29 12:48:20 -0700179 }
180
181 noOverrideGlobalCflags = []string{
Christopher Di Bella23a991c2020-11-11 22:41:32 +0000182 "-Werror=bool-operation",
183 "-Werror=implicit-int-float-conversion",
184 "-Werror=int-in-bool-context",
Colin Cross4d9c2d12016-07-29 12:48:20 -0700185 "-Werror=int-to-pointer-cast",
186 "-Werror=pointer-to-int-cast",
Christopher Di Bella23a991c2020-11-11 22:41:32 +0000187 "-Werror=string-compare",
188 "-Werror=xor-used-as-pow",
Stephen Hines2210e722020-07-15 11:11:57 -0700189 // http://b/161386391 for -Wno-void-pointer-to-enum-cast
190 "-Wno-void-pointer-to-enum-cast",
191 // http://b/161386391 for -Wno-void-pointer-to-int-cast
192 "-Wno-void-pointer-to-int-cast",
193 // http://b/161386391 for -Wno-pointer-to-int-cast
194 "-Wno-pointer-to-int-cast",
George Burgess IV6c691642019-09-18 17:52:05 -0700195 "-Werror=fortify-source",
Colin Crossc8bed312021-07-14 17:56:21 -0700196
197 "-Werror=address-of-temporary",
198 // Bug: http://b/29823425 Disable -Wnull-dereference until the
199 // new cases detected by this warning in Clang r271374 are
200 // fixed.
201 //"-Werror=null-dereference",
202 "-Werror=return-type",
203
204 // http://b/72331526 Disable -Wtautological-* until the instances detected by these
205 // new warnings are fixed.
206 "-Wno-tautological-constant-compare",
207 "-Wno-tautological-type-limit-compare",
208 // http://b/145210666
209 "-Wno-reorder-init-list",
210 // http://b/145211066
211 "-Wno-implicit-int-float-conversion",
212 // New warnings to be fixed after clang-r377782.
213 "-Wno-int-in-bool-context", // http://b/148287349
214 "-Wno-sizeof-array-div", // http://b/148815709
215 "-Wno-tautological-overlap-compare", // http://b/148815696
216 // New warnings to be fixed after clang-r383902.
217 "-Wno-deprecated-copy", // http://b/153746672
218 "-Wno-range-loop-construct", // http://b/153747076
219 "-Wno-misleading-indentation", // http://b/153746954
220 "-Wno-zero-as-null-pointer-constant", // http://b/68236239
221 "-Wno-deprecated-anon-enum-enum-conversion", // http://b/153746485
222 "-Wno-deprecated-enum-enum-conversion", // http://b/153746563
223 "-Wno-string-compare", // http://b/153764102
224 "-Wno-enum-enum-conversion", // http://b/154138986
225 "-Wno-enum-float-conversion", // http://b/154255917
226 "-Wno-pessimizing-move", // http://b/154270751
227 // New warnings to be fixed after clang-r399163
228 "-Wno-non-c-typedef-for-linkage", // http://b/161304145
229 // New warnings to be fixed after clang-r407598
230 "-Wno-string-concatenation", // http://b/175068488
231 }
232
233 // Extra cflags for external third-party projects to disable warnings that
234 // are infeasible to fix in all the external projects and their upstream repos.
235 extraExternalCflags = []string{
236 "-Wno-enum-compare",
237 "-Wno-enum-compare-switch",
238
239 // http://b/72331524 Allow null pointer arithmetic until the instances detected by
240 // this new warning are fixed.
241 "-Wno-null-pointer-arithmetic",
242
243 // Bug: http://b/29823425 Disable -Wnull-dereference until the
244 // new instances detected by this warning are fixed.
245 "-Wno-null-dereference",
246
247 // http://b/145211477
248 "-Wno-pointer-compare",
249 // http://b/145211022
250 "-Wno-xor-used-as-pow",
251 // http://b/145211022
252 "-Wno-final-dtor-non-final-class",
253
254 // http://b/165945989
255 "-Wno-psabi",
Colin Cross4d9c2d12016-07-29 12:48:20 -0700256 }
257
Colin Crossb98c8b02016-07-29 13:44:28 -0700258 IllegalFlags = []string{
Colin Cross4d9c2d12016-07-29 12:48:20 -0700259 "-w",
260 }
Colin Cross6f6a4282016-10-17 14:19:06 -0700261
Dan Albert043833c2017-02-03 16:13:38 -0800262 CStdVersion = "gnu99"
Elliott Hughes34e4e412018-11-30 16:03:06 +0000263 CppStdVersion = "gnu++17"
Dan Albert043833c2017-02-03 16:13:38 -0800264 ExperimentalCStdVersion = "gnu11"
Elliott Hughes37976122018-11-28 14:16:39 -0800265 ExperimentalCppStdVersion = "gnu++2a"
Jayant Chowdhary6e8115a2017-05-09 10:21:52 -0700266
Leo Li8756b372017-05-22 16:11:34 -0700267 // prebuilts/clang default settings.
268 ClangDefaultBase = "prebuilts/clang/host"
Pirama Arumuga Nainar3e545082021-06-23 22:39:37 -0700269 ClangDefaultVersion = "clang-r416183b1"
270 ClangDefaultShortVersion = "12.0.7"
Chih-Hung Hsieh64a38dc2017-11-14 14:09:14 -0800271
Chih-Hung Hsieh775edde2017-12-24 22:24:47 -0800272 // Directories with warnings from Android.bp files.
Chih-Hung Hsieh64a38dc2017-11-14 14:09:14 -0800273 WarningAllowedProjects = []string{
Chih-Hung Hsieh64a38dc2017-11-14 14:09:14 -0800274 "device/",
Chih-Hung Hsieh64a38dc2017-11-14 14:09:14 -0800275 "vendor/",
276 }
277
Chih-Hung Hsieh775edde2017-12-24 22:24:47 -0800278 // Directories with warnings from Android.mk files.
279 WarningAllowedOldProjects = []string{}
Colin Cross4d9c2d12016-07-29 12:48:20 -0700280)
281
Colin Crossb98c8b02016-07-29 13:44:28 -0700282var pctx = android.NewPackageContext("android/soong/cc/config")
283
Colin Cross4d9c2d12016-07-29 12:48:20 -0700284func init() {
Kousik Kumard207cbe2020-10-20 05:52:49 +0000285 if android.BuildOs == android.Linux {
286 commonGlobalCflags = append(commonGlobalCflags, "-fdebug-prefix-map=/proc/self/cwd=")
287 }
288
Jingwen Chen51a1e1c2021-05-20 13:40:14 +0000289 exportStringListStaticVariable("CommonGlobalConlyflags", commonGlobalConlyflags)
290 exportStringListStaticVariable("DeviceGlobalCppflags", deviceGlobalCppflags)
291 exportStringListStaticVariable("DeviceGlobalLdflags", deviceGlobalLdflags)
292 exportStringListStaticVariable("DeviceGlobalLldflags", deviceGlobalLldflags)
293 exportStringListStaticVariable("HostGlobalCppflags", hostGlobalCppflags)
294 exportStringListStaticVariable("HostGlobalLdflags", hostGlobalLdflags)
295 exportStringListStaticVariable("HostGlobalLldflags", hostGlobalLldflags)
Jingwen Chenbf61afb2021-05-06 13:31:18 +0000296
Colin Cross0523ba22021-07-14 18:45:05 -0700297 // Export the static default CommonGlobalCflags to Bazel.
Jingwen Chenbf61afb2021-05-06 13:31:18 +0000298 // TODO(187086342): handle cflags that are set in VariableFuncs.
Colin Cross0523ba22021-07-14 18:45:05 -0700299 bazelCommonGlobalCflags := append(
Colin Cross33bac242021-07-14 17:03:16 -0700300 commonGlobalCflags,
Jingwen Chenbf61afb2021-05-06 13:31:18 +0000301 []string{
Jingwen Chenbf61afb2021-05-06 13:31:18 +0000302 // Default to zero initialization.
303 "-ftrivial-auto-var-init=zero",
304 "-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang",
305 }...)
Colin Cross0523ba22021-07-14 18:45:05 -0700306 exportedStringListVars.Set("CommonGlobalCflags", bazelCommonGlobalCflags)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700307
Colin Cross0523ba22021-07-14 18:45:05 -0700308 pctx.VariableFunc("CommonGlobalCflags", func(ctx android.PackageVarContext) string {
Colin Cross33bac242021-07-14 17:03:16 -0700309 flags := commonGlobalCflags
Stephen Hines66c8b442019-06-10 17:40:12 -0700310
311 // http://b/131390872
312 // Automatically initialize any uninitialized stack variables.
Stephen Hines5c873ac2020-05-14 00:59:09 +0000313 // Prefer zero-init if multiple options are set.
Stephen Hines66c8b442019-06-10 17:40:12 -0700314 if ctx.Config().IsEnvTrue("AUTO_ZERO_INITIALIZE") {
315 flags = append(flags, "-ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang")
316 } else if ctx.Config().IsEnvTrue("AUTO_PATTERN_INITIALIZE") {
317 flags = append(flags, "-ftrivial-auto-var-init=pattern")
Stephen Hines797e1952020-01-28 14:43:11 -0800318 } else if ctx.Config().IsEnvTrue("AUTO_UNINITIALIZE") {
319 flags = append(flags, "-ftrivial-auto-var-init=uninitialized")
Stephen Hines0e1d5d82020-01-30 15:06:00 -0800320 } else {
Stephen Hines5c873ac2020-05-14 00:59:09 +0000321 // Default to zero initialization.
322 flags = append(flags, "-ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang")
Stephen Hines66c8b442019-06-10 17:40:12 -0700323 }
Stephen Hines66c8b442019-06-10 17:40:12 -0700324 return strings.Join(flags, " ")
325 })
326
Colin Cross0523ba22021-07-14 18:45:05 -0700327 // Export the static default DeviceGlobalCflags to Bazel.
Jingwen Chenbf61afb2021-05-06 13:31:18 +0000328 // TODO(187086342): handle cflags that are set in VariableFuncs.
Colin Cross0523ba22021-07-14 18:45:05 -0700329 exportedStringListVars.Set("DeviceGlobalCflags", deviceGlobalCflags)
Jingwen Chenbf61afb2021-05-06 13:31:18 +0000330
Colin Cross0523ba22021-07-14 18:45:05 -0700331 pctx.VariableFunc("DeviceGlobalCflags", func(ctx android.PackageVarContext) string {
Colin Crossc8bed312021-07-14 17:56:21 -0700332 return strings.Join(deviceGlobalCflags, " ")
Doug Hornc32c6b02019-01-17 14:44:05 -0800333 })
Colin Cross4d9c2d12016-07-29 12:48:20 -0700334
Colin Cross0523ba22021-07-14 18:45:05 -0700335 exportStringListStaticVariable("HostGlobalCflags", hostGlobalCflags)
336 exportStringListStaticVariable("NoOverrideGlobalCflags", noOverrideGlobalCflags)
337 exportStringListStaticVariable("CommonGlobalCppflags", commonGlobalCppflags)
338 exportStringListStaticVariable("ExternalCflags", extraExternalCflags)
Yi Kongcc80f8d2018-06-06 14:42:44 -0700339
Colin Cross1cfd89a2016-09-15 09:30:46 -0700340 // Everything in these lists is a crime against abstraction and dependency tracking.
Colin Cross4d9c2d12016-07-29 12:48:20 -0700341 // Do not add anything to this list.
Jingwen Chen21999952021-05-19 05:53:51 +0000342 commonGlobalIncludes := []string{
343 "system/core/include",
344 "system/logging/liblog/include",
345 "system/media/audio/include",
346 "hardware/libhardware/include",
347 "hardware/libhardware_legacy/include",
348 "hardware/ril/include",
349 "frameworks/native/include",
350 "frameworks/native/opengl/include",
351 "frameworks/av/include",
352 }
Jingwen Chen51a1e1c2021-05-20 13:40:14 +0000353 exportedStringListVars.Set("CommonGlobalIncludes", commonGlobalIncludes)
Jingwen Chen21999952021-05-19 05:53:51 +0000354 pctx.PrefixedExistentPathsForSourcesVariable("CommonGlobalIncludes", "-I", commonGlobalIncludes)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700355
Leo Li8756b372017-05-22 16:11:34 -0700356 pctx.SourcePathVariable("ClangDefaultBase", ClangDefaultBase)
Dan Willemsen54daaf02018-03-12 13:24:09 -0700357 pctx.VariableFunc("ClangBase", func(ctx android.PackageVarContext) string {
358 if override := ctx.Config().Getenv("LLVM_PREBUILTS_BASE"); override != "" {
359 return override
Colin Cross4d9c2d12016-07-29 12:48:20 -0700360 }
Dan Willemsen54daaf02018-03-12 13:24:09 -0700361 return "${ClangDefaultBase}"
Colin Cross4d9c2d12016-07-29 12:48:20 -0700362 })
Dan Willemsen54daaf02018-03-12 13:24:09 -0700363 pctx.VariableFunc("ClangVersion", func(ctx android.PackageVarContext) string {
364 if override := ctx.Config().Getenv("LLVM_PREBUILTS_VERSION"); override != "" {
365 return override
Colin Cross4d9c2d12016-07-29 12:48:20 -0700366 }
Dan Willemsen54daaf02018-03-12 13:24:09 -0700367 return ClangDefaultVersion
Colin Cross4d9c2d12016-07-29 12:48:20 -0700368 })
Colin Crossb98c8b02016-07-29 13:44:28 -0700369 pctx.StaticVariable("ClangPath", "${ClangBase}/${HostPrebuiltTag}/${ClangVersion}")
370 pctx.StaticVariable("ClangBin", "${ClangPath}/bin")
371
Dan Willemsen54daaf02018-03-12 13:24:09 -0700372 pctx.VariableFunc("ClangShortVersion", func(ctx android.PackageVarContext) string {
373 if override := ctx.Config().Getenv("LLVM_RELEASE_VERSION"); override != "" {
374 return override
Stephen Hinese55a4cc2016-11-18 17:12:38 -0800375 }
Dan Willemsen54daaf02018-03-12 13:24:09 -0700376 return ClangDefaultShortVersion
Stephen Hinese55a4cc2016-11-18 17:12:38 -0800377 })
Stephen Hines755fe072018-01-24 19:58:36 -0800378 pctx.StaticVariable("ClangAsanLibDir", "${ClangBase}/linux-x86/${ClangVersion}/lib64/clang/${ClangShortVersion}/lib/linux")
Alistair Strachan777475c2016-08-26 12:55:49 -0700379
Jayant Chowdharye622d202017-02-01 19:19:52 -0800380 // These are tied to the version of LLVM directly in external/llvm, so they might trail the host prebuilts
381 // being used for the rest of the build process.
382 pctx.SourcePathVariable("RSClangBase", "prebuilts/clang/host")
383 pctx.SourcePathVariable("RSClangVersion", "clang-3289846")
384 pctx.SourcePathVariable("RSReleaseVersion", "3.8")
385 pctx.StaticVariable("RSLLVMPrebuiltsPath", "${RSClangBase}/${HostPrebuiltTag}/${RSClangVersion}/bin")
386 pctx.StaticVariable("RSIncludePath", "${RSLLVMPrebuiltsPath}/../lib64/clang/${RSReleaseVersion}/include")
387
Jeff Gaston734e3802017-04-10 15:47:24 -0700388 pctx.PrefixedExistentPathsForSourcesVariable("RsGlobalIncludes", "-I",
Colin Cross2a252be2017-05-01 17:37:24 -0700389 []string{
390 "external/clang/lib/Headers",
391 "frameworks/rs/script_api/include",
392 })
393
Dan Willemsen54daaf02018-03-12 13:24:09 -0700394 pctx.VariableFunc("CcWrapper", func(ctx android.PackageVarContext) string {
395 if override := ctx.Config().Getenv("CC_WRAPPER"); override != "" {
396 return override + " "
Alistair Strachan777475c2016-08-26 12:55:49 -0700397 }
Dan Willemsen54daaf02018-03-12 13:24:09 -0700398 return ""
Alistair Strachan777475c2016-08-26 12:55:49 -0700399 })
Ramy Medhat9a90fe52020-04-13 13:21:23 -0400400
Colin Cross77cdcfd2021-03-12 11:28:25 -0800401 pctx.StaticVariableWithEnvOverride("RECXXPool", "RBE_CXX_POOL", remoteexec.DefaultPool)
402 pctx.StaticVariableWithEnvOverride("RECXXLinksPool", "RBE_CXX_LINKS_POOL", remoteexec.DefaultPool)
403 pctx.StaticVariableWithEnvOverride("REClangTidyPool", "RBE_CLANG_TIDY_POOL", remoteexec.DefaultPool)
404 pctx.StaticVariableWithEnvOverride("RECXXLinksExecStrategy", "RBE_CXX_LINKS_EXEC_STRATEGY", remoteexec.LocalExecStrategy)
405 pctx.StaticVariableWithEnvOverride("REClangTidyExecStrategy", "RBE_CLANG_TIDY_EXEC_STRATEGY", remoteexec.LocalExecStrategy)
406 pctx.StaticVariableWithEnvOverride("REAbiDumperExecStrategy", "RBE_ABI_DUMPER_EXEC_STRATEGY", remoteexec.LocalExecStrategy)
407 pctx.StaticVariableWithEnvOverride("REAbiLinkerExecStrategy", "RBE_ABI_LINKER_EXEC_STRATEGY", remoteexec.LocalExecStrategy)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700408}
409
410var HostPrebuiltTag = pctx.VariableConfigMethod("HostPrebuiltTag", android.Config.PrebuiltOS)