Add external projects only CFlags option

am: 6a350878d8

Change-Id: I002a196d1b9b02f226537ddaf8b0a96c98bfbb5a
This commit is contained in:
Yi Kong
2018-06-05 13:55:19 -07:00
committed by android-build-merger
3 changed files with 15 additions and 4 deletions

View File

@@ -392,6 +392,12 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
fmt.Sprintf("${config.%sGlobalCflags}", hod))
}
if flags.Clang {
if strings.HasPrefix(android.PathForModuleSrc(ctx).String(), "external/") {
flags.GlobalFlags = append([]string{"${config.ClangExternalCflags}"}, flags.GlobalFlags...)
}
}
if ctx.Device() {
if Bool(compiler.Properties.Rtti) {
flags.CppFlags = append(flags.CppFlags, "-frtti")

View File

@@ -173,14 +173,17 @@ func init() {
// this new warning are fixed.
"-Wno-null-pointer-arithmetic",
// Disable c++98-specific warning since Android is not concerned with C++98
// compatibility.
"-Wno-c++98-compat-extra-semi",
}, " "))
// Extra cflags for projects under external/ directory
pctx.StaticVariable("ClangExtraExternalCflags", strings.Join([]string{
// http://b/72330874 Disable -Wenum-compare until the instances detected by this new
// warning are fixed.
"-Wno-enum-compare",
"-Wno-enum-compare-switch",
// Disable c++98-specific warning since Android is not concerned with C++98
// compatibility.
"-Wno-c++98-compat-extra-semi",
}, " "))
}

View File

@@ -170,6 +170,8 @@ func init() {
pctx.StaticVariable("CommonClangGlobalCppflags",
strings.Join(append(ClangFilterUnknownCflags(commonGlobalCppflags), "${ClangExtraCppflags}"), " "))
pctx.StaticVariable("ClangExternalCflags", "${ClangExtraExternalCflags}")
// Everything in these lists is a crime against abstraction and dependency tracking.
// Do not add anything to this list.
pctx.PrefixedExistentPathsForSourcesVariable("CommonGlobalIncludes", "-I",