Update gtest flags from Make
There's a different libgtest to use for NDK libraries built with different STLs. And we no longer need to add the gtest include path, as it's exported. Change-Id: I2f804cf98e074cfd4ea6b70a445e304a8a8bce50
This commit is contained in:
parent
2630213418
commit
8146b2f1c9
1 changed files with 20 additions and 1 deletions
19
cc/cc.go
19
cc/cc.go
|
@ -456,6 +456,7 @@ type ModuleContextIntf interface {
|
|||
noDefaultCompilerFlags() bool
|
||||
sdk() bool
|
||||
sdkVersion() string
|
||||
selectedStl() string
|
||||
}
|
||||
|
||||
type ModuleContext interface {
|
||||
|
@ -637,6 +638,13 @@ func (ctx *moduleContextImpl) sdkVersion() string {
|
|||
return ctx.mod.Properties.Sdk_version
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) selectedStl() string {
|
||||
if stl := ctx.mod.stl; stl != nil {
|
||||
return stl.Properties.SelectedStl
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func newBaseModule(hod common.HostOrDeviceSupported, multilib common.Multilib) *Module {
|
||||
return &Module{
|
||||
hod: hod,
|
||||
|
@ -2058,8 +2066,19 @@ func (test *testLinker) flags(ctx ModuleContext, flags Flags) Flags {
|
|||
|
||||
func (test *testLinker) deps(ctx BaseModuleContext, deps Deps) Deps {
|
||||
if test.Properties.Gtest {
|
||||
if ctx.sdk() && ctx.Device() {
|
||||
switch ctx.selectedStl() {
|
||||
case "ndk_libc++_shared", "ndk_libc++_static":
|
||||
deps.StaticLibs = append(deps.StaticLibs, "libgtest_main_ndk_libcxx", "libgtest_ndk_libcxx")
|
||||
case "ndk_libgnustl_static":
|
||||
deps.StaticLibs = append(deps.StaticLibs, "libgtest_main_ndk_gnustl", "libgtest_ndk_gnustl")
|
||||
default:
|
||||
deps.StaticLibs = append(deps.StaticLibs, "libgtest_main_ndk", "libgtest_ndk")
|
||||
}
|
||||
} else {
|
||||
deps.StaticLibs = append(deps.StaticLibs, "libgtest_main", "libgtest")
|
||||
}
|
||||
}
|
||||
deps = test.binaryLinker.deps(ctx, deps)
|
||||
return deps
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue