first release of translation facility
* runtime - loading and translating * design-time - works with *.ts file (pip_tr utility) * compile-time - CMake macro for compile *.ts
This commit is contained in:
@@ -45,10 +45,12 @@ endif()
|
||||
if (BUILDING_PIP AND (NOT CMAKE_CROSSCOMPILING))
|
||||
set(PIP_CMG "$<TARGET_FILE_DIR:pip_cmg>/$<TARGET_FILE_NAME:pip_cmg>" CACHE STRING "")
|
||||
set(PIP_RC "$<TARGET_FILE_DIR:pip_rc>/$<TARGET_FILE_NAME:pip_rc>" CACHE STRING "")
|
||||
set(PIP_TR "$<TARGET_FILE_DIR:pip_tr>/$<TARGET_FILE_NAME:pip_tr>" CACHE STRING "")
|
||||
set(PIP_DEPLOY_TOOL "$<TARGET_FILE_DIR:deploy_tool>/$<TARGET_FILE_NAME:deploy_tool>" CACHE STRING "")
|
||||
else()
|
||||
find_program(PIP_CMG pip_cmg${PIP_BINEXT} HINTS ${PIP_BINDIR} ${PIP_FIND_PROGRAM_ARG})
|
||||
find_program(PIP_RC pip_rc${PIP_BINEXT} HINTS ${PIP_BINDIR} ${PIP_FIND_PROGRAM_ARG})
|
||||
find_program(PIP_TR pip_tr${PIP_BINEXT} HINTS ${PIP_BINDIR} ${PIP_FIND_PROGRAM_ARG})
|
||||
find_program(PIP_DEPLOY_TOOL deploy_tool${PIP_BINEXT} HINTS ${PIP_BINDIR} ${PIP_FIND_PROGRAM_ARG})
|
||||
endif()
|
||||
if (NOT PIP_LIBRARY)
|
||||
|
||||
@@ -18,6 +18,14 @@
|
||||
Generate C++ files for resource file
|
||||
You should add ${<out_var>} to your target
|
||||
|
||||
|
||||
|
||||
pip_translation(<out_var> ts_file)
|
||||
|
||||
Generate *.btf (binary translation file) from *.ts file
|
||||
You should add ${<out_var>} to your target and then install it to somewhere
|
||||
for later loading in runtime by PITranslator
|
||||
|
||||
]]
|
||||
|
||||
|
||||
@@ -119,3 +127,34 @@ macro(pip_resources RESULT INPUT)
|
||||
VERBATIM)
|
||||
endmacro()
|
||||
|
||||
|
||||
macro(pip_translation RESULT INPUT)
|
||||
#message(STATUS "src = ${CCM_SRC}")
|
||||
#message(STATUS "result = ${RESULT}")
|
||||
#message(STATUS "options = \"${CCM_OPTS}\"")
|
||||
get_filename_component(BTF_FILENAME "${INPUT}" NAME_WE)
|
||||
set(BTF_FILENAME "${BTF_FILENAME}.btf")
|
||||
set(BTF_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BTF_FILENAME})
|
||||
list(APPEND ${RESULT} "${BTF_OUTPUT}")
|
||||
if(IS_ABSOLUTE "${INPUT}")
|
||||
set(IN_FILES "${INPUT}")
|
||||
else()
|
||||
set(IN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${INPUT}")
|
||||
endif()
|
||||
#message(STATUS "CCM = ${RESULT}")
|
||||
if(NOT DEFINED PIP_DLL_DIR)
|
||||
set(PIP_DLL_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif()
|
||||
#message("PIP_TR: ${PIP_TR}")
|
||||
#message("BTF_OUTPUT: ${BTF_OUTPUT}")
|
||||
#message("IN_FILES: ${IN_FILES}")
|
||||
#message("PIP_DLL_DIR: ${PIP_DLL_DIR}")
|
||||
add_custom_command(OUTPUT ${BTF_OUTPUT}
|
||||
COMMAND ${PIP_TR}
|
||||
ARGS -C -o "${BTF_OUTPUT}" "${IN_FILES}"
|
||||
DEPENDS ${IN_FILES}
|
||||
WORKING_DIRECTORY ${PIP_DLL_DIR}
|
||||
COMMENT "Generating ${BTF_FILENAME}"
|
||||
VERBATIM)
|
||||
endmacro()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user