e96c16a806
So that you can use select statements on it. The current modivation is to convert a module from make to bp with minimal soong config variable boilerplate. Bug: 342006386 Bug: 346922064 Test: m nothing --no-skip-soong-tests Change-Id: I48d5a11ad3aa65c24cc199458634a5fdbeab2f64
44 lines
1.5 KiB
Text
44 lines
1.5 KiB
Text
<<$srcs := getSources .M>>
|
|
<<$includeDirs := getIncludeDirs .Ctx .M>>
|
|
<<$cflags := getCflagsProperty .Ctx .M>>
|
|
<<$deps := mapLibraries .Ctx .M (concat5
|
|
(getLinkerProperties .M).Whole_static_libs
|
|
(getLinkerProperties .M).Static_libs
|
|
(getLinkerProperties .M).Shared_libs
|
|
(getLinkerProperties .M).Header_libs
|
|
(getExtraLibs .M)
|
|
) .Pprop.LibraryMapping>>
|
|
<<$moduleType := getModuleType .M>>
|
|
<<$moduleTypeCmake := "executable">>
|
|
<<if eq $moduleType "library">>
|
|
<<$moduleTypeCmake = "library">>
|
|
<<end>>
|
|
|
|
# <<.M.Name>>
|
|
<<if $srcs>>
|
|
<<setList .M.Name "_SRCS" "${ANDROID_BUILD_TOP}/" (toStrings $srcs)>>
|
|
add_<<$moduleTypeCmake>>(<<.M.Name>> ${<<.M.Name>>_SRCS})
|
|
<<- else>>
|
|
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>>
|
|
<<print "">>
|
|
|
|
<<- if $includeDirs>>
|
|
<<setList .M.Name "_INCLUDES" "${ANDROID_BUILD_TOP}/" $includeDirs>>
|
|
target_include_directories(<<.M.Name>> <<if $srcs>>PUBLIC<<else>>INTERFACE<<end>> ${<<.M.Name>>_INCLUDES})
|
|
<<end>>
|
|
|
|
<<- if and $srcs $cflags>>
|
|
<<cflagsList .M.Name "_CFLAGS" $cflags .Snapshot.Properties.Unportable_flags .Snapshot.Properties.Cflags_ignored>>
|
|
target_compile_options(<<.M.Name>> PRIVATE ${<<.M.Name>>_CFLAGS})
|
|
<<end>>
|
|
|
|
<<- if $deps>>
|
|
<<setList .M.Name "_DEPENDENCIES" "" $deps>>
|
|
target_link_libraries(<<.M.Name>> <<if not $srcs>>INTERFACE <<end ->> ${<<.M.Name>>_DEPENDENCIES})
|
|
<<end>>
|