X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/795359a4a2c81571bb061f8dfbcc6c15323c9bf3..64916baf9d485ba6a2546bf79c948c591a233465:/tools/cmake/MaintainerMode.cmake diff --git a/tools/cmake/MaintainerMode.cmake b/tools/cmake/MaintainerMode.cmake index 51e01cf2fe..233fcec24d 100644 --- a/tools/cmake/MaintainerMode.cmake +++ b/tools/cmake/MaintainerMode.cmake @@ -10,9 +10,7 @@ set(FLEX_MIN_PATCH 39) # the rest should only be changed if you understand what you're doing if(enable_maintainer_mode AND NOT WIN32) - find_program(PYTHON_EXE NAMES python) - mark_as_advanced(PYTHON_EXE) - if (PYTHON_EXE) + if (PYTHON_EXECUTABLE) add_custom_command( OUTPUT ${CMAKE_HOME_DIRECTORY}/src/simix/popping_generated.cpp @@ -25,7 +23,7 @@ if(enable_maintainer_mode AND NOT WIN32) ${CMAKE_HOME_DIRECTORY}/src/simix/simcalls.in COMMENT "Generating simcalls source files" - COMMAND ${PYTHON_EXE} simcalls.py + COMMAND ${PYTHON_EXECUTABLE} simcalls.py WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/src/simix/ ) @@ -43,6 +41,30 @@ if(enable_maintainer_mode AND NOT WIN32) endif() endif() +# Let's generate header files required by SMPI when the call location tracing +# has been activated. +if(enable_maintainer_mode AND NOT WIN32) + add_custom_command(OUTPUT ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_extended_traces.h + ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_extended_traces_fortran.h + + COMMENT "Generating header files for call-location tracing with SMPI" + # Make sure there is no space after the redirection operator (>). I received + # error messages in that case on my Debian system. + COMMAND "${CMAKE_HOME_DIRECTORY}/tools/smpi/generate_smpi_defines.pl" "${CMAKE_HOME_DIRECTORY}/include/smpi/smpi.h >${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_extended_traces.h" + COMMAND "${CMAKE_HOME_DIRECTORY}/tools/smpi/generate_smpi_defines.pl" "-f" "${CMAKE_HOME_DIRECTORY}/include/smpi/smpi.h >${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_extended_traces_fortran.h" + ) + + add_custom_target(smpi_generated_headers_call_location_tracing + DEPENDS + ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_extended_traces.h + ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_extended_traces_fortran.h + ) + + SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES + "${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_extended_traces.h;${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_extended_traces_fortran.h" + ) +endif() + if(enable_maintainer_mode AND NOT WIN32) find_program(FLEX_EXE NAMES flex) find_program(FLEXML_EXE NAMES flexml) @@ -85,7 +107,7 @@ if(enable_maintainer_mode AND NOT WIN32) message(STATUS "Found flex: ${FLEX_EXE}") IF(FLEX_EXE) set(HAVE_FLEX 1) - exec_program("${FLEX_EXE} --version" OUTPUT_VARIABLE FLEX_VERSION) + execute_process(COMMAND ${FLEX_EXE} --version OUTPUT_VARIABLE FLEX_VERSION) string(REGEX MATCH "[0-9]+[.]+[0-9]+[.]+[0-9]+" FLEX_VERSION "${FLEX_VERSION}") string(REGEX MATCH "^[0-9]+" FLEX_MAJOR_VERSION "${FLEX_VERSION}") string(REGEX MATCH "[0-9]+[.]+[0-9]+$" FLEX_VERSION "${FLEX_VERSION}") @@ -96,7 +118,7 @@ if(enable_maintainer_mode AND NOT WIN32) message(STATUS "Found flexml: ${FLEXML_EXE}") IF(FLEXML_EXE) set(HAVE_FLEXML 1) - exec_program("${FLEXML_EXE} --version" OUTPUT_VARIABLE FLEXML_VERSION) + execute_process(COMMAND ${FLEXML_EXE} --version OUTPUT_VARIABLE FLEXML_VERSION) if (FLEXML_VERSION MATCHES "version Id:") message(FATAL_ERROR "You have an ancient flexml version (${FLEXML_VERSION}). You need at least v${FLEXML_MIN_MAJOR}.${FLEXML_MIN_MINOR}.${FLEXML_MIN_PATCH} to compile in maintainer mode. Upgrade your flexml, or disable the Maintainer mode option in cmake.") endif() @@ -155,6 +177,7 @@ if(enable_maintainer_mode AND NOT WIN32) COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_HOME_DIRECTORY}/src/surf/xml COMMAND ${FLEXML_EXE} --root-tags platform -b 1000000 -P surfxml --sysid=http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd -S src/surf/xml/simgrid_dtd.l -L src/surf/xml/simgrid.dtd COMMAND ${SED_EXE} -i ${string14} src/surf/xml/simgrid_dtd.l + COMMAND ${SED_EXE} -i "'s/FAIL(\"Bad declaration %s.\",yytext)/FAIL(\"Bad declaration %s.\\\\nIf your are using a XML v3 file (check the version attribute in ), please update it with tools\\/simgrid_update_xml.pl\",yytext)/'" src/surf/xml/simgrid_dtd.l COMMAND ${CMAKE_COMMAND} -E echo " Generated src/surf/xml/simgrid_dtd.l" #${CMAKE_HOME_DIRECTORY}/src/simdag/dax_dtd.l: ${CMAKE_HOME_DIRECTORY}/src/simdag/dax.dtd