version 2.28.1
CMake pip_code_model now accept optional NAME field PIByteArray helpers: * piSerialize * piDeserialize
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#[[
|
||||
|
||||
pip_code_model(<out_var> file0 [file1 ...] [OPTIONS opt0 [opt1 ...] ])
|
||||
pip_code_model(<out_var> file0 [file1 ...] [OPTIONS opt0 [opt1 ...] ] [NAME name])
|
||||
|
||||
Generate code model files for source files file0 [file1 ...]
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
Relative files pathes read from CMAKE_CURRENT_SOURCE_DIR
|
||||
You should add ${<out_var>} to your target
|
||||
|
||||
If NAME specified then "<name>.h" and "<name>.cpp" files will be generated instead
|
||||
of default "ccm_<PROJECT_NAME>"
|
||||
|
||||
|
||||
|
||||
@@ -19,30 +21,32 @@
|
||||
]]
|
||||
|
||||
|
||||
macro(PIP_EXTRACT_OPTIONS _pip_files _pip_options _abs)
|
||||
macro(PIP_EXTRACT_OPTIONS _pip_files _pip_options _name _abs)
|
||||
set(${_pip_files})
|
||||
set(${_pip_options})
|
||||
set(_PIP_DOING_OPTIONS FALSE)
|
||||
set(_cur_opt 0)
|
||||
foreach(_currentArg ${ARGN})
|
||||
if("x${_currentArg}" STREQUAL "xABSOLUTE")
|
||||
if ("x${_currentArg}" STREQUAL "xABSOLUTE")
|
||||
set(${_abs} TRUE)
|
||||
elseif ("x${_currentArg}" STREQUAL "xOPTIONS")
|
||||
set(_cur_opt 1)
|
||||
elseif ("x${_currentArg}" STREQUAL "xNAME")
|
||||
set(_cur_opt 2)
|
||||
elseif (_cur_opt EQUAL 1)
|
||||
list(APPEND ${_pip_options} "${_currentArg}")
|
||||
elseif (_cur_opt EQUAL 2)
|
||||
set(${_name} "${_currentArg}")
|
||||
set(_cur_opt 0)
|
||||
else()
|
||||
if("x${_currentArg}" STREQUAL "xOPTIONS")
|
||||
set(_PIP_DOING_OPTIONS TRUE)
|
||||
else()
|
||||
if(_PIP_DOING_OPTIONS)
|
||||
list(APPEND ${_pip_options} "${_currentArg}")
|
||||
else()
|
||||
list(APPEND ${_pip_files} "${_currentArg}")
|
||||
endif()
|
||||
endif()
|
||||
list(APPEND ${_pip_files} "${_currentArg}")
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
|
||||
macro(pip_code_model RESULT)
|
||||
PIP_EXTRACT_OPTIONS(CCM_SRC OPTS ABS ${ARGN})
|
||||
set(_name "ccm_${PROJECT_NAME}")
|
||||
PIP_EXTRACT_OPTIONS(CCM_SRC OPTS _name ABS ${ARGN})
|
||||
#message(STATUS "src = ${CCM_SRC}")
|
||||
#message(STATUS "result = ${RESULT}")
|
||||
#message(STATUS "options = \"${CCM_OPTS}\"")
|
||||
@@ -50,7 +54,7 @@ macro(pip_code_model RESULT)
|
||||
foreach(pi ${PIP_INCLUDES})
|
||||
list(APPEND CMG_INCLUDES "-I${pi}")
|
||||
endforeach()
|
||||
set(CCM_OUT ${CMAKE_CURRENT_BINARY_DIR}/ccm_${PROJECT_NAME}.cpp)
|
||||
set(CCM_OUT ${CMAKE_CURRENT_BINARY_DIR}/${_name}.cpp)
|
||||
set(${RESULT} ${${RESULT}} ${CCM_OUT})
|
||||
set(CCM_FILES)
|
||||
foreach(csrc ${CCM_SRC})
|
||||
@@ -66,10 +70,10 @@ macro(pip_code_model RESULT)
|
||||
endif()
|
||||
add_custom_command(OUTPUT ${CCM_OUT}
|
||||
COMMAND ${PIP_CMG}
|
||||
ARGS -q ${OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/ccm_${PROJECT_NAME} ${CMG_INCLUDES} ${CCM_FILES}
|
||||
ARGS -q ${OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/${_name} ${CMG_INCLUDES} ${CCM_FILES}
|
||||
DEPENDS ${CCM_SRC}
|
||||
WORKING_DIRECTORY ${PIP_DLL_DIR}
|
||||
COMMENT "Generating ccm_${PROJECT_NAME}.h, ccm_${PROJECT_NAME}.cpp"
|
||||
COMMENT "Generating ${_name}.h, ${_name}.cpp"
|
||||
VERBATIM)
|
||||
endmacro()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user