Merge "Revert "Revert "Add external projects only CFlags option"""

am: 8d29e1e024

Change-Id: I8806ce876fe68ab36e79e36318af0740b3a9b4c8
This commit is contained in:
Yi Kong 2018-06-06 23:07:12 -07:00 committed by android-build-merger
commit 2090540f19
4 changed files with 14 additions and 0 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

@ -182,6 +182,11 @@ func init() {
// compatibility.
"-Wno-c++98-compat-extra-semi",
}, " "))
// Extra cflags for projects under external/ directory
pctx.StaticVariable("ClangExtraExternalCflags", strings.Join([]string{
// TODO(yikong): Move -Wno flags here
}, " "))
}
func ClangFilterUnknownCflags(cflags []string) []string {

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

View File

@ -83,6 +83,7 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
ctx.Strict("RS_LLVM_AS", "${config.RSLLVMPrebuiltsPath}/llvm-as")
ctx.Strict("RS_LLVM_LINK", "${config.RSLLVMPrebuiltsPath}/llvm-link")
ctx.Strict("CLANG_EXTERNAL_CFLAGS", "${config.ClangExternalCflags}")
ctx.Strict("GLOBAL_CFLAGS_NO_OVERRIDE", "${config.NoOverrideGlobalCflags}")
ctx.Strict("GLOBAL_CLANG_CFLAGS_NO_OVERRIDE", "${config.ClangExtraNoOverrideCflags}")
ctx.Strict("GLOBAL_CPPFLAGS_NO_OVERRIDE", "")