blob: 0f6e62f108737024f5f993534048d7d327cba918 [file] [log] [blame]
Hao Chen1c8ea5b2023-10-20 23:03:45 +00001<<$srcs := getSources .M>>
2<<$includeDirs := getIncludeDirs .Ctx .M>>
Cole Fauste96c16a2024-06-13 14:51:14 -07003<<$cflags := getCflagsProperty .Ctx .M>>
Tomasz Wasilczyk1e831bf2024-05-10 15:15:21 -07004<<$deps := mapLibraries .Ctx .M (concat5
Cole Faustf0006e72024-08-19 14:39:19 -07005(getWholeStaticLibsProperty .Ctx .M)
6(getStaticLibsProperty .Ctx .M)
7(getSharedLibsProperty .Ctx .M)
8(getHeaderLibsProperty .Ctx .M)
Hao Chen1c8ea5b2023-10-20 23:03:45 +00009(getExtraLibs .M)
10) .Pprop.LibraryMapping>>
Tomasz Wasilczykc3177e02024-06-10 14:38:45 -070011<<$moduleType := getModuleType .M>>
12<<$moduleTypeCmake := "executable">>
13<<if eq $moduleType "library">>
14<<$moduleTypeCmake = "library">>
15<<end>>
Hao Chen1c8ea5b2023-10-20 23:03:45 +000016
17# <<.M.Name>>
18<<if $srcs>>
19<<setList .M.Name "_SRCS" "${ANDROID_BUILD_TOP}/" (toStrings $srcs)>>
Tomasz Wasilczykc3177e02024-06-10 14:38:45 -070020add_<<$moduleTypeCmake>>(<<.M.Name>> ${<<.M.Name>>_SRCS})
Hao Chen1c8ea5b2023-10-20 23:03:45 +000021<<- else>>
Tomasz Wasilczykc3177e02024-06-10 14:38:45 -070022add_<<$moduleTypeCmake>>(<<.M.Name>> INTERFACE)
Hao Chen1c8ea5b2023-10-20 23:03:45 +000023<<- end>>
Tomasz Wasilczykc3177e02024-06-10 14:38:45 -070024<<- if eq $moduleType "library">>
25add_library(android::<<.M.Name>> ALIAS <<.M.Name>>)
26<<- else if eq $moduleType "test">>
27add_test(NAME <<.M.Name>> COMMAND <<.M.Name>>)
28<<- end>>
Hao Chen1c8ea5b2023-10-20 23:03:45 +000029<<print "">>
30
31<<- if $includeDirs>>
32<<setList .M.Name "_INCLUDES" "${ANDROID_BUILD_TOP}/" $includeDirs>>
33target_include_directories(<<.M.Name>> <<if $srcs>>PUBLIC<<else>>INTERFACE<<end>> ${<<.M.Name>>_INCLUDES})
34<<end>>
35
36<<- if and $srcs $cflags>>
37<<cflagsList .M.Name "_CFLAGS" $cflags .Snapshot.Properties.Unportable_flags .Snapshot.Properties.Cflags_ignored>>
38target_compile_options(<<.M.Name>> PRIVATE ${<<.M.Name>>_CFLAGS})
39<<end>>
40
41<<- if $deps>>
42<<setList .M.Name "_DEPENDENCIES" "" $deps>>
43target_link_libraries(<<.M.Name>> <<if not $srcs>>INTERFACE <<end ->> ${<<.M.Name>>_DEPENDENCIES})
44<<end>>