diff --git a/cc/cc.go b/cc/cc.go index e9d388418..2ade59cc1 100644 --- a/cc/cc.go +++ b/cc/cc.go @@ -218,10 +218,20 @@ type CCBaseProperties struct { // that module. Include_dirs []string `android:"arch_variant"` + // list of files relative to the root of the source tree that will be included + // using -include. + // If possible, don't use this. + Include_files []string `android:"arch_variant"` + // list of directories relative to the Blueprints file that will // be added to the include path using -I Local_include_dirs []string `android:"arch_variant"` + // list of files relative to the Blueprints file that will be included + // using -include. + // If possible, don't use this. + Local_include_files []string `android:"arch_variant"` + // list of directories relative to the Blueprints file that will // be added to the include path using -I for any module that links against this module Export_include_dirs []string `android:"arch_variant"` @@ -447,6 +457,13 @@ func (c *CCBase) collectFlags(ctx common.AndroidModuleContext, toolchain Toolcha includeDirsToFlags(rootIncludeDirs), includeDirsToFlags(localIncludeDirs)) + rootIncludeFiles := pathtools.PrefixPaths(c.Properties.Include_files, ctx.AConfig().SrcDir()) + localIncludeFiles := pathtools.PrefixPaths(c.Properties.Local_include_files, common.ModuleSrcDir(ctx)) + + flags.GlobalFlags = append(flags.GlobalFlags, + includeFilesToFlags(rootIncludeFiles), + includeFilesToFlags(localIncludeFiles)) + if !c.Properties.No_default_compiler_flags { if c.Properties.Sdk_version == "" || ctx.Host() { flags.GlobalFlags = append(flags.GlobalFlags, diff --git a/cc/util.go b/cc/util.go index 9ce84ee72..efc89f05c 100644 --- a/cc/util.go +++ b/cc/util.go @@ -28,6 +28,10 @@ func includeDirsToFlags(dirs []string) string { return common.JoinWithPrefix(dirs, "-I") } +func includeFilesToFlags(dirs []string) string { + return common.JoinWithPrefix(dirs, "-include ") +} + func ldDirsToFlags(dirs []string) string { return common.JoinWithPrefix(dirs, "-L") }