Merge "Make __ANDROID_APEX_<NAME>__ macro optional"

This commit is contained in:
Jooyung Han
2020-03-03 23:35:02 +00:00
committed by Gerrit Code Review
2 changed files with 40 additions and 12 deletions

View File

@@ -176,6 +176,9 @@ type BaseCompilerProperties struct {
// Build and link with OpenMP
Openmp *bool `android:"arch_variant"`
// Adds __ANDROID_APEX_<APEX_MODULE_NAME>__ macro defined for apex variants in addition to __ANDROID_APEX__
Use_apex_name_macro *bool
}
func NewBaseCompiler() *baseCompiler {
@@ -321,9 +324,10 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
}
if ctx.apexName() != "" {
flags.Global.CommonFlags = append(flags.Global.CommonFlags,
"-D__ANDROID_APEX__",
"-D__ANDROID_APEX_"+makeDefineString(ctx.apexName())+"__")
flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_APEX__")
if Bool(compiler.Properties.Use_apex_name_macro) {
flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_APEX_"+makeDefineString(ctx.apexName())+"__")
}
}
instructionSet := String(compiler.Properties.Instruction_set)