Add support for include_files

Support include_files and local_include_files to pass -include arguments
to gcc.

Change-Id: Ie3f03218fcbc9732741da91671b20e240f3de3a6
This commit is contained in:
Colin Cross 2015-09-14 12:30:50 -07:00
parent 485e572aeb
commit 39d97f2a56
2 changed files with 21 additions and 0 deletions

View File

@ -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,

View File

@ -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")
}