From 05d04a45036182582b67512857de73e190b05233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B5=D0=BB=D0=B8=D0=BF=D0=B5=D0=BD=D0=BA=D0=BE=20?= =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD?= Date: Thu, 1 Dec 2016 11:25:18 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/pip@291 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- FindPIP.cmake | 4 +- PIPMacros.cmake | 93 +++++++++++------------------ PIPMacros2.cmake | 47 --------------- utils/code_model_generator/main.cpp | 1 + 4 files changed, 36 insertions(+), 109 deletions(-) delete mode 100644 PIPMacros2.cmake diff --git a/FindPIP.cmake b/FindPIP.cmake index 9f572264..8ac8be1f 100644 --- a/FindPIP.cmake +++ b/FindPIP.cmake @@ -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) diff --git a/PIPMacros.cmake b/PIPMacros.cmake index 4cb17079..f5f50982 100644 --- a/PIPMacros.cmake +++ b/PIPMacros.cmake @@ -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() diff --git a/PIPMacros2.cmake b/PIPMacros2.cmake deleted file mode 100644 index 100e3772..00000000 --- a/PIPMacros2.cmake +++ /dev/null @@ -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) - diff --git a/utils/code_model_generator/main.cpp b/utils/code_model_generator/main.cpp index ff3eb544..8412a4e8 100755 --- a/utils/code_model_generator/main.cpp +++ b/utils/code_model_generator/main.cpp @@ -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");