diff options
Diffstat (limited to 'cc/compiler.go')
-rw-r--r-- | cc/compiler.go | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/cc/compiler.go b/cc/compiler.go index c268dec2b..21da2fc60 100644 --- a/cc/compiler.go +++ b/cc/compiler.go @@ -354,10 +354,16 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_APEX_NAME__='\""+ctx.apexVariationName()+"\"'") } if ctx.Device() { - flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_SDK_VERSION__="+strconv.Itoa(ctx.apexSdkVersion())) + flags.Global.CommonFlags = append(flags.Global.CommonFlags, + fmt.Sprintf("-D__ANDROID_SDK_VERSION__=%d", + ctx.apexSdkVersion().FinalOrFutureInt())) } } + if ctx.Target().NativeBridge == android.NativeBridgeEnabled { + flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_NATIVE_BRIDGE__") + } + instructionSet := String(compiler.Properties.Instruction_set) if flags.RequiredInstructionSet != "" { instructionSet = flags.RequiredInstructionSet @@ -386,7 +392,7 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps if ctx.Os().Class == android.Device { version := ctx.sdkVersion() if version == "" || version == "current" { - target += strconv.Itoa(android.FutureApiLevel) + target += strconv.Itoa(android.FutureApiLevelInt) } else { target += version } @@ -646,3 +652,43 @@ func isThirdParty(path string) bool { } return true } + +// Properties for rust_bindgen related to generating rust bindings. +// This exists here so these properties can be included in a cc_default +// which can be used in both cc and rust modules. +type RustBindgenClangProperties struct { + // 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,variant_prepend"` + + // list of static libraries that provide headers for this binding. + Static_libs []string `android:"arch_variant,variant_prepend"` + + // list of shared libraries that provide headers for this binding. + Shared_libs []string `android:"arch_variant"` + + // list of clang flags required to correctly interpret the headers. + Cflags []string `android:"arch_variant"` + + // list of c++ specific clang flags required to correctly interpret the headers. + // This is provided primarily to make sure cppflags defined in cc_defaults are pulled in. + Cppflags []string `android:"arch_variant"` + + // C standard version to use. Can be a specific version (such as "gnu11"), + // "experimental" (which will use draft versions like C1x when available), + // or the empty string (which will use the default). + // + // If this is set, the file extension will be ignored and this will be used as the std version value. Setting this + // to "default" will use the build system default version. This cannot be set at the same time as cpp_std. + C_std *string + + // C++ standard version to use. Can be a specific version (such as + // "gnu++11"), "experimental" (which will use draft versions like C++1z when + // available), or the empty string (which will use the default). + // + // If this is set, the file extension will be ignored and this will be used as the std version value. Setting this + // to "default" will use the build system default version. This cannot be set at the same time as c_std. + Cpp_std *string + + //TODO(b/161141999) Add support for headers from cc_library_header modules. +} |