diff --git a/android/config.go b/android/config.go index 4745a1638..94c3d897d 100644 --- a/android/config.go +++ b/android/config.go @@ -1423,6 +1423,10 @@ func (c *deviceConfig) DeviceKernelHeaderDirs() []string { return c.config.productVariables.DeviceKernelHeaders } +func (c *deviceConfig) TargetSpecificHeaderPath() string { + return String(c.config.productVariables.TargetSpecificHeaderPath) +} + // JavaCoverageEnabledForPath returns whether Java code coverage is enabled for // path. Coverage is enabled by default when the product variable // JavaCoveragePaths is empty. If JavaCoveragePaths is not empty, coverage is diff --git a/android/variable.go b/android/variable.go index 2500140f3..e5099a9d1 100644 --- a/android/variable.go +++ b/android/variable.go @@ -362,6 +362,8 @@ type ProductVariables struct { DeviceKernelHeaders []string `json:",omitempty"` + TargetSpecificHeaderPath *string `json:",omitempty"` + ExtraVndkVersions []string `json:",omitempty"` NamespacesToExport []string `json:",omitempty"` diff --git a/cc/compiler.go b/cc/compiler.go index d8446fb84..ec46394b1 100644 --- a/cc/compiler.go +++ b/cc/compiler.go @@ -363,6 +363,16 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps tc := ctx.toolchain() modulePath := ctx.ModuleDir() + additionalIncludeDirs := ctx.DeviceConfig().TargetSpecificHeaderPath() + if len(additionalIncludeDirs) > 0 { + // devices can have multiple paths in TARGET_SPECIFIC_HEADER_PATH + // add -I in front of all of them + if (strings.Contains(additionalIncludeDirs, " ")) { + additionalIncludeDirs = strings.ReplaceAll(additionalIncludeDirs, " ", " -I") + } + flags.Local.CommonFlags = append(flags.Local.CommonFlags, "-I" + additionalIncludeDirs) + } + compiler.srcsBeforeGen = android.PathsForModuleSrcExcludes(ctx, compiler.Properties.Srcs, compiler.Properties.Exclude_srcs) compiler.srcsBeforeGen = append(compiler.srcsBeforeGen, deps.GeneratedSources...)