Cdroid/cmake/common_functions.cmake

29 lines
1.1 KiB
CMake
Raw Normal View History

2021-06-24 10:12:55 +08:00
2021-12-10 11:55:27 +08:00
function(CreatePAK ResourceDIR PakPath projectname)
2021-12-17 16:59:10 +08:00
add_custom_target(${projectname}_res
COMMAND zip -r -0 ${PakPath} ./
2021-06-24 10:12:55 +08:00
WORKING_DIRECTORY ${ResourceDIR})
add_dependencies(${projectname} ${projectname}_res)
2021-06-24 10:12:55 +08:00
message("Package ${ResourceDIR} to:${PakPath}")
2022-01-14 16:49:02 +08:00
install(FILES ${PakPath} DESTINATION data)
2021-06-24 10:12:55 +08:00
endfunction()
2021-12-10 11:55:27 +08:00
function(CreatePO SourceDIR POPath projectname)
2021-12-17 16:59:10 +08:00
add_custom_target(${projectname}_po
2021-06-24 10:12:55 +08:00
COMMAND touch ${POPath}
COMMAND xgettext -d ntvplus -j -c -p${PROJECT_BINARY_DIR} -kTEXT ${SRCS_NTV_PLUS}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_dependencies( ${projectname} ${projectname}_po)
2021-06-24 10:12:55 +08:00
endfunction()
2022-01-14 16:49:02 +08:00
function(Translate pofile transtopath)
add_custom_target(translate
COMMAND python ${CMAKE_SOURCE_DIR}/src/tools/po2json.py ${pofile}
COMMAND cp ${PROJECT_BINARY_DIR}/string*.json ${PROJECT_SOURCE_DIR}/assets/strings
BYPRODUCTS ntvplus
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
COMMENT "Translate strings resource...${PROJECT_BINARY_DIR}"
)
endfunction()