diff options
| author | 2018-12-06 11:04:03 -0800 | |
|---|---|---|
| committer | 2018-12-06 11:04:03 -0800 | |
| commit | 899c23e19b347f60ceaaca3a301a248a4f95e168 (patch) | |
| tree | 313f1ca1200bf063fda4f00b6ed7f07e067a9520 /cc/compiler.go | |
| parent | 080c2455a3b96fc8a49e78d3a3c62d4dbb48c621 (diff) | |
Add flag to disable source directory includes.
Not all projects can be built when their base directory (the
directory containing the Android.bp file) is automatically included.
For example, external/jsoncpp has a file named version, which will
override the standard library's <version> header.
It would maybe be reasonable for this to be on by default, but many
projects in the tree currently depend on this behavior.
Test: make checkbuild
Bug: None
Change-Id: I58dff2689270ae56fef7cf83be31262d16794fc4
Diffstat (limited to 'cc/compiler.go')
| -rw-r--r-- | cc/compiler.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/cc/compiler.go b/cc/compiler.go index ea64b6a6c..63d2adee0 100644 --- a/cc/compiler.go +++ b/cc/compiler.go @@ -75,6 +75,10 @@ type BaseCompilerProperties struct { // be added to the include path using -I Local_include_dirs []string `android:"arch_variant,variant_prepend"` + // Add the directory containing the Android.bp file to the list of include + // directories. Defaults to true. + Include_build_directory *bool + // list of generated sources to compile. These are the names of gensrcs or // genrule modules. Generated_sources []string `android:"arch_variant"` @@ -288,8 +292,11 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps flags.YasmFlags = append(flags.YasmFlags, f) } - flags.GlobalFlags = append(flags.GlobalFlags, "-I"+android.PathForModuleSrc(ctx).String()) - flags.YasmFlags = append(flags.YasmFlags, "-I"+android.PathForModuleSrc(ctx).String()) + if compiler.Properties.Include_build_directory == nil || + *compiler.Properties.Include_build_directory { + flags.GlobalFlags = append(flags.GlobalFlags, "-I"+android.PathForModuleSrc(ctx).String()) + flags.YasmFlags = append(flags.YasmFlags, "-I"+android.PathForModuleSrc(ctx).String()) + } if !(ctx.useSdk() || ctx.useVndk()) || ctx.Host() { flags.SystemIncludeFlags = append(flags.SystemIncludeFlags, |