Enable cmake testing
Bug: 302718225 Test: atest binder_sdk_test Change-Id: Id841d73d11f3b0c75f7bcd523be8ff69300a503e
This commit is contained in:
parent
6ace4cf906
commit
c3177e0ffc
3 changed files with 15 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
||||||
cmake_minimum_required(VERSION 3.18)
|
cmake_minimum_required(VERSION 3.18)
|
||||||
project(<<.M.Name>> CXX)
|
project(<<.M.Name>> CXX)
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
enable_testing()
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
include(AddAidlLibrary)
|
include(AddAidlLibrary)
|
||||||
|
|
|
@ -8,15 +8,24 @@
|
||||||
(getLinkerProperties .M).Header_libs
|
(getLinkerProperties .M).Header_libs
|
||||||
(getExtraLibs .M)
|
(getExtraLibs .M)
|
||||||
) .Pprop.LibraryMapping>>
|
) .Pprop.LibraryMapping>>
|
||||||
|
<<$moduleType := getModuleType .M>>
|
||||||
|
<<$moduleTypeCmake := "executable">>
|
||||||
|
<<if eq $moduleType "library">>
|
||||||
|
<<$moduleTypeCmake = "library">>
|
||||||
|
<<end>>
|
||||||
|
|
||||||
# <<.M.Name>>
|
# <<.M.Name>>
|
||||||
<<if $srcs>>
|
<<if $srcs>>
|
||||||
<<setList .M.Name "_SRCS" "${ANDROID_BUILD_TOP}/" (toStrings $srcs)>>
|
<<setList .M.Name "_SRCS" "${ANDROID_BUILD_TOP}/" (toStrings $srcs)>>
|
||||||
add_<<getModuleType .M>>(<<.M.Name>> ${<<.M.Name>>_SRCS})
|
add_<<$moduleTypeCmake>>(<<.M.Name>> ${<<.M.Name>>_SRCS})
|
||||||
<<- else>>
|
<<- else>>
|
||||||
add_<<getModuleType .M>>(<<.M.Name>> INTERFACE)
|
add_<<$moduleTypeCmake>>(<<.M.Name>> INTERFACE)
|
||||||
|
<<- end>>
|
||||||
|
<<- if eq $moduleType "library">>
|
||||||
|
add_library(android::<<.M.Name>> ALIAS <<.M.Name>>)
|
||||||
|
<<- else if eq $moduleType "test">>
|
||||||
|
add_test(NAME <<.M.Name>> COMMAND <<.M.Name>>)
|
||||||
<<- end>>
|
<<- end>>
|
||||||
add_<<getModuleType .M>>(android::<<.M.Name>> ALIAS <<.M.Name>>)
|
|
||||||
<<print "">>
|
<<print "">>
|
||||||
|
|
||||||
<<- if $includeDirs>>
|
<<- if $includeDirs>>
|
||||||
|
|
|
@ -488,9 +488,9 @@ func getModuleType(m *Module) string {
|
||||||
case *libraryDecorator:
|
case *libraryDecorator:
|
||||||
return "library"
|
return "library"
|
||||||
case *testBinary:
|
case *testBinary:
|
||||||
return "executable"
|
return "test"
|
||||||
case *benchmarkDecorator:
|
case *benchmarkDecorator:
|
||||||
return "executable"
|
return "test"
|
||||||
}
|
}
|
||||||
panic(fmt.Sprintf("Unexpected module type: %T", m.linker))
|
panic(fmt.Sprintf("Unexpected module type: %T", m.linker))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue