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)
|
||||
endif ()
|
||||
|
||||
#set(PIP_CMG /usr/bin/pip_cmg)
|
||||
|
||||
if (NOT PIP_VERSION)
|
||||
file(STRINGS "${PIP_INCLUDES}/pip_version_str.h" _VERSION REGEX "\".*\"")
|
||||
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!")
|
||||
endif ()
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/PIPMacros2.cmake)
|
||||
include(PIPMacros)
|
||||
|
||||
|
||||
@@ -1,61 +1,36 @@
|
||||
|
||||
macro (pip_code_model SRC RESULT)
|
||||
set(RESULT "")
|
||||
set(OPTS "")
|
||||
set(_IS_OPT false)
|
||||
foreach (_A ${ARGN})
|
||||
#message(STATUS ${_A})
|
||||
if (_IS_OPT)
|
||||
list (APPEND OPTS ${_A})
|
||||
else ()
|
||||
if ("${_A}" STREQUAL "OPTIONS")
|
||||
set(_IS_OPT true)
|
||||
else ()
|
||||
set (RESULT ${_A})
|
||||
endif ()
|
||||
endif ()
|
||||
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()
|
||||
#message(STATUS "src = ${CMAKE_CURRENT_SOURCE_DIR}/${SRC}")
|
||||
#message(STATUS "result = ${RESULT}")
|
||||
#message(STATUS "options = ${OPTS}")
|
||||
set(NEED_PARSE FALSE CACHE BOOL "NEED_PARSE" FORCE)
|
||||
if (DEFINED CACHE_CMG_FILES)
|
||||
string(REPLACE " " ";" CMG_LIST_C "${CACHE_CMG_FILES}")
|
||||
foreach (CF ${CMG_LIST_C})
|
||||
file (TIMESTAMP ${CF} ATIME)
|
||||
if (NOT TIME_${CF} STREQUAL ATIME)
|
||||
set(NEED_PARSE TRUE)
|
||||
#message(STATUS "MOD cache")
|
||||
endif ()
|
||||
set(TIME_${CF} ${ATIME} CACHE INTERNAL TIME_${CF} FORCE)
|
||||
#message (STATUS ${CF} ": " ${ATIME})
|
||||
endforeach (CF)
|
||||
else ()
|
||||
set(NEED_PARSE TRUE)
|
||||
#message(STATUS "NEW cache")
|
||||
endif ()
|
||||
set(${RESULT} ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_ccm.cpp)
|
||||
#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)
|
||||
endmacro()
|
||||
|
||||
macro(pip_code_model RESULT)
|
||||
PIP_EXTRACT_OPTIONS(CCM_SRC OPTS ${ARGN})
|
||||
#message(STATUS "src = ${CCM_SRC}")
|
||||
#message(STATUS "result = ${RESULT}")
|
||||
#message(STATUS "options = \"${CCM_OPTS}\"")
|
||||
set(CMG_INCLUDES)
|
||||
foreach(pi ${PIP_INCLUDES})
|
||||
list(APPEND CMG_INCLUDES "-I${pi}")
|
||||
endforeach()
|
||||
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 -q ${OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/ccm_${PROJECT_NAME} ${CMG_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/${CCM_SRC}
|
||||
MAIN_DEPENDENCY ${CCM_SRC}
|
||||
VERBATIM)
|
||||
endmacro()
|
||||
|
||||
|
||||
@@ -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[]) {
|
||||
PICLI cli(argc, argv);
|
||||
//piCout << cli.rawArguments();
|
||||
cli.setOptionalArgumentsCount(-1);
|
||||
cli.addArgument("output", true);
|
||||
cli.addArgument("help");
|
||||
|
||||
Reference in New Issue
Block a user