git-svn-id: svn://db.shs.com.ru/pip@291 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -15,8 +15,6 @@ else ()
|
|||||||
set(PIP_CMG /usr/bin/pip_cmg)
|
set(PIP_CMG /usr/bin/pip_cmg)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
#set(PIP_CMG /usr/bin/pip_cmg)
|
|
||||||
|
|
||||||
if (NOT PIP_VERSION)
|
if (NOT PIP_VERSION)
|
||||||
file(STRINGS "${PIP_INCLUDES}/pip_version_str.h" _VERSION REGEX "\".*\"")
|
file(STRINGS "${PIP_INCLUDES}/pip_version_str.h" _VERSION REGEX "\".*\"")
|
||||||
string(REGEX MATCH "\".*\"" _VERSION ${_VERSION})
|
string(REGEX MATCH "\".*\"" _VERSION ${_VERSION})
|
||||||
@@ -30,5 +28,5 @@ if (PIP_FIND_VERSION VERSION_GREATER PIP_VERSION)
|
|||||||
message(FATAL_ERROR "PIP version ${PIP_VERSION} is available, but ${PIP_FIND_VERSION} requested!")
|
message(FATAL_ERROR "PIP version ${PIP_VERSION} is available, but ${PIP_FIND_VERSION} requested!")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
include(${CMAKE_ROOT}/Modules/PIPMacros2.cmake)
|
include(PIPMacros)
|
||||||
|
|
||||||
|
|||||||
@@ -1,61 +1,36 @@
|
|||||||
|
macro(PIP_EXTRACT_OPTIONS _pip_files _pip_options)
|
||||||
macro (pip_code_model SRC RESULT)
|
set(${_pip_files})
|
||||||
set(RESULT "")
|
set(${_pip_options})
|
||||||
set(OPTS "")
|
set(_PIP_DOING_OPTIONS FALSE)
|
||||||
set(_IS_OPT false)
|
foreach(_currentArg ${ARGN})
|
||||||
foreach (_A ${ARGN})
|
if("x${_currentArg}" STREQUAL "xOPTIONS")
|
||||||
#message(STATUS ${_A})
|
set(_PIP_DOING_OPTIONS TRUE)
|
||||||
if (_IS_OPT)
|
|
||||||
list (APPEND OPTS ${_A})
|
|
||||||
else()
|
else()
|
||||||
if ("${_A}" STREQUAL "OPTIONS")
|
if(_PIP_DOING_OPTIONS)
|
||||||
set(_IS_OPT true)
|
list(APPEND ${_pip_options} "${_currentArg}")
|
||||||
else()
|
else()
|
||||||
set (RESULT ${_A})
|
list(APPEND ${_pip_files} "${_currentArg}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
#message(STATUS "src = ${CMAKE_CURRENT_SOURCE_DIR}/${SRC}")
|
endmacro()
|
||||||
#message(STATUS "result = ${RESULT}")
|
|
||||||
#message(STATUS "options = ${OPTS}")
|
macro(pip_code_model RESULT)
|
||||||
set(NEED_PARSE FALSE CACHE BOOL "NEED_PARSE" FORCE)
|
PIP_EXTRACT_OPTIONS(CCM_SRC OPTS ${ARGN})
|
||||||
if (DEFINED CACHE_CMG_FILES)
|
#message(STATUS "src = ${CCM_SRC}")
|
||||||
string(REPLACE " " ";" CMG_LIST_C "${CACHE_CMG_FILES}")
|
#message(STATUS "result = ${RESULT}")
|
||||||
foreach (CF ${CMG_LIST_C})
|
#message(STATUS "options = \"${CCM_OPTS}\"")
|
||||||
file (TIMESTAMP ${CF} ATIME)
|
set(CMG_INCLUDES)
|
||||||
if (NOT TIME_${CF} STREQUAL ATIME)
|
foreach(pi ${PIP_INCLUDES})
|
||||||
set(NEED_PARSE TRUE)
|
list(APPEND CMG_INCLUDES "-I${pi}")
|
||||||
#message(STATUS "MOD cache")
|
endforeach()
|
||||||
endif ()
|
set(CCM_OUT ${CMAKE_CURRENT_BINARY_DIR}/ccm_${PROJECT_NAME}.cpp)
|
||||||
set(TIME_${CF} ${ATIME} CACHE INTERNAL TIME_${CF} FORCE)
|
set(${RESULT} ${${RESULT}} ${CCM_OUT})
|
||||||
#message (STATUS ${CF} ": " ${ATIME})
|
#message(STATUS "CCM = ${RESULT}")
|
||||||
endforeach (CF)
|
add_custom_command(OUTPUT ${CCM_OUT}
|
||||||
else ()
|
COMMAND ${PIP_CMG}
|
||||||
set(NEED_PARSE TRUE)
|
ARGS -q ${OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/ccm_${PROJECT_NAME} ${CMG_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/${CCM_SRC}
|
||||||
#message(STATUS "NEW cache")
|
MAIN_DEPENDENCY ${CCM_SRC}
|
||||||
endif ()
|
VERBATIM)
|
||||||
set(${RESULT} ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_ccm.cpp)
|
endmacro()
|
||||||
#message(STATUS "Res = ${${RESULT}}")
|
|
||||||
if (NOT EXISTS ${${RESULT}})
|
|
||||||
set(NEED_PARSE TRUE)
|
|
||||||
endif ()
|
|
||||||
if (NEED_PARSE)
|
|
||||||
message(STATUS "Creating code model based on \"${SRC}\", please wait ... ")
|
|
||||||
#message(STATUS "exec \"-qP ${OPTS} -o ${PROJECT_NAME}_ccm -I${PIP_INCLUDES} ${SRC}\"")
|
|
||||||
#message(STATUS "exec ${PIP_CMG} -P ${OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_ccm -I${PIP_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/${SRC}")
|
|
||||||
execute_process(OUTPUT_VARIABLE CMG_OUT COMMAND ${PIP_CMG} -qP ${OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_ccm -I${PIP_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/${SRC})
|
|
||||||
message(STATUS "Creating code model done, to use it include \"${PROJECT_NAME}_ccm.h\"")
|
|
||||||
string(REPLACE "\n" ";" CMG_LIST "${CMG_OUT}")
|
|
||||||
string(REPLACE "\n" " " CMG_LIST_S "${CMG_OUT}")
|
|
||||||
set(CACHE_CMG_FILES ${CMG_LIST_S} CACHE INTERNAL "CACHE_CMG_FILES" FORCE)
|
|
||||||
foreach (CF ${CMG_LIST})
|
|
||||||
file (TIMESTAMP ${CF} ATIME)
|
|
||||||
set(TIME_${CF} ${ATIME} CACHE INTERNAL TIME_${CF} FORCE)
|
|
||||||
endforeach (CF)
|
|
||||||
else ()
|
|
||||||
message(STATUS "Code model is up to date :-)")
|
|
||||||
endif ()
|
|
||||||
#message(STATUS ${CMG_OUT})
|
|
||||||
#message(STATUS ${CACHE_CMG_FILES})
|
|
||||||
endmacro (pip_code_model)
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
macro (PIP_EXTRACT_OPTIONS _pip_files _pip_options)
|
|
||||||
set(${_pip_files})
|
|
||||||
set(${_pip_options})
|
|
||||||
set(_PIP_DOING_OPTIONS FALSE)
|
|
||||||
foreach(_currentArg ${ARGN})
|
|
||||||
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 ()
|
|
||||||
endforeach()
|
|
||||||
endmacro ()
|
|
||||||
|
|
||||||
macro (pip_code_model RESULT)
|
|
||||||
PIP_EXTRACT_OPTIONS(CCM_SRC OPTS ${ARGN})
|
|
||||||
set(CCM_OPTS)
|
|
||||||
foreach (it ${OPTS})
|
|
||||||
if(CCM_OPTS)
|
|
||||||
set(CCM_OPTS "${CCM_OPTS} ${it}")
|
|
||||||
else()
|
|
||||||
set(CCM_OPTS "${it}")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
#message(STATUS "src = ${CCM_SRC}")
|
|
||||||
#message(STATUS "result = ${RESULT}")
|
|
||||||
#message(STATUS "options = ${CCM_OPTS}")
|
|
||||||
set(CCM_OUT ${CMAKE_CURRENT_BINARY_DIR}/ccm_${PROJECT_NAME}.cpp)
|
|
||||||
set(${RESULT} ${${RESULT}} ${CCM_OUT})
|
|
||||||
#message(STATUS "CCM = ${RESULT}")
|
|
||||||
add_custom_command(OUTPUT ${CCM_OUT}
|
|
||||||
COMMAND ${PIP_CMG}
|
|
||||||
ARGS -P ${CCM_OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/ccm_${PROJECT_NAME} -I${PIP_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/${CCM_SRC}
|
|
||||||
MAIN_DEPENDENCY ${CCM_SRC})
|
|
||||||
#VERBATIM)
|
|
||||||
#message(STATUS "Creating code model based on \"${CCM_SRC}\", please wait ... ")
|
|
||||||
#message(STATUS "exec \"-qP ${CCM_OPTS} -o ccm_${PROJECT_NAME} -I${PIP_INCLUDES} ${CCM_SRC}\"")
|
|
||||||
message(STATUS "Run CCM: ${PIP_CMG} -P ${CCM_OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/ccm_${PROJECT_NAME} -I${PIP_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/${CCM_SRC}")
|
|
||||||
#execute_process(OUTPUT_VARIABLE CMG_OUT COMMAND ${PIP_CMG} -qP ${CCM_OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/$ccm_{PROJECT_NAME} -I${PIP_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/${CCM_SRC})
|
|
||||||
#message(STATUS "Creating code model done, to use it include \"ccm_${PROJECT_NAME}.h\"")
|
|
||||||
#message(STATUS ${CMG_OUT})
|
|
||||||
#message(STATUS ${CACHE_CMG_FILES})
|
|
||||||
endmacro (pip_code_model)
|
|
||||||
|
|
||||||
@@ -291,6 +291,7 @@ const PIVariant & arg1 = PIVariant(), const PIVariant & arg2 = PIVariant(), cons
|
|||||||
|
|
||||||
int main(int argc, char * argv[]) {
|
int main(int argc, char * argv[]) {
|
||||||
PICLI cli(argc, argv);
|
PICLI cli(argc, argv);
|
||||||
|
//piCout << cli.rawArguments();
|
||||||
cli.setOptionalArgumentsCount(-1);
|
cli.setOptionalArgumentsCount(-1);
|
||||||
cli.addArgument("output", true);
|
cli.addArgument("output", true);
|
||||||
cli.addArgument("help");
|
cli.addArgument("help");
|
||||||
|
|||||||
Reference in New Issue
Block a user