Add basic VNDK support in Soong
Export a list of libraries in the VNDK, which is currently empty. Take in Make's global BOARD_VNDK_VERSION, and use that as the SDK version for modules that specify use_vndk: true. Modules that use the vndk have some configuration as if they were building against the NDK (the absence of globally defined headers), but in other cases look like platform modules (using the platform libc++, for now). This change does not attempt to enforce any linking constraints, that will come in a later patch. Test: out/soong/build.ninja doesn't change Change-Id: I3be206b67015ac5177b7eef4a451c579e3dc903f
This commit is contained in:
31
cc/cc.go
31
cc/cc.go
@@ -125,6 +125,9 @@ type BaseProperties struct {
|
||||
// Minimum sdk version supported when compiling against the ndk
|
||||
Sdk_version string
|
||||
|
||||
// Whether to compile against the VNDK
|
||||
Use_vndk bool
|
||||
|
||||
// don't insert default compiler flags into asflags, cflags,
|
||||
// cppflags, conlyflags, ldflags, or include_dirs
|
||||
No_default_compiler_flags *bool
|
||||
@@ -132,6 +135,7 @@ type BaseProperties struct {
|
||||
AndroidMkSharedLibs []string `blueprint:"mutated"`
|
||||
HideFromMake bool `blueprint:"mutated"`
|
||||
PreventInstall bool `blueprint:"mutated"`
|
||||
Vndk_version string `blueprint:"mutated"`
|
||||
}
|
||||
|
||||
type UnusedProperties struct {
|
||||
@@ -147,6 +151,7 @@ type ModuleContextIntf interface {
|
||||
noDefaultCompilerFlags() bool
|
||||
sdk() bool
|
||||
sdkVersion() string
|
||||
vndk() bool
|
||||
selectedStl() string
|
||||
baseModuleName() string
|
||||
}
|
||||
@@ -345,11 +350,22 @@ func (ctx *moduleContextImpl) sdk() bool {
|
||||
|
||||
func (ctx *moduleContextImpl) sdkVersion() string {
|
||||
if ctx.ctx.Device() {
|
||||
return ctx.mod.Properties.Sdk_version
|
||||
if ctx.mod.Properties.Use_vndk {
|
||||
return ctx.mod.Properties.Vndk_version
|
||||
} else {
|
||||
return ctx.mod.Properties.Sdk_version
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) vndk() bool {
|
||||
if ctx.ctx.Device() {
|
||||
return ctx.mod.Properties.Use_vndk
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) selectedStl() string {
|
||||
if stl := ctx.mod.stl; stl != nil {
|
||||
return stl.Properties.SelectedStl
|
||||
@@ -493,11 +509,22 @@ func (c *Module) begin(ctx BaseModuleContext) {
|
||||
feature.begin(ctx)
|
||||
}
|
||||
if ctx.sdk() {
|
||||
if ctx.vndk() {
|
||||
ctx.PropertyErrorf("use_vndk",
|
||||
"sdk_version and use_vndk cannot be used at the same time")
|
||||
}
|
||||
|
||||
version, err := normalizeNdkApiLevel(ctx.sdkVersion(), ctx.Arch())
|
||||
if err != nil {
|
||||
ctx.PropertyErrorf("sdk_version", err.Error())
|
||||
}
|
||||
c.Properties.Sdk_version = version
|
||||
} else if ctx.vndk() {
|
||||
version, err := normalizeNdkApiLevel(ctx.DeviceConfig().VndkVersion(), ctx.Arch())
|
||||
if err != nil {
|
||||
ctx.ModuleErrorf("Bad BOARD_VNDK_VERSION: %s", err.Error())
|
||||
}
|
||||
c.Properties.Vndk_version = version
|
||||
}
|
||||
}
|
||||
|
||||
@@ -579,7 +606,7 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
||||
|
||||
variantNdkLibs := []string{}
|
||||
variantLateNdkLibs := []string{}
|
||||
if ctx.sdk() {
|
||||
if ctx.sdk() || ctx.vndk() {
|
||||
version := ctx.sdkVersion()
|
||||
|
||||
// Rewrites the names of shared libraries into the names of the NDK
|
||||
|
Reference in New Issue
Block a user