X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/61e51ed458b9c4bc40343c50fc28ab0f3da72eaa..e6e67305ecc66829721213aea23743f933b23b5d:/buildtools/Cmake/CompleteInFiles.cmake diff --git a/buildtools/Cmake/CompleteInFiles.cmake b/buildtools/Cmake/CompleteInFiles.cmake index f721971773..ba549716ee 100644 --- a/buildtools/Cmake/CompleteInFiles.cmake +++ b/buildtools/Cmake/CompleteInFiles.cmake @@ -1,16 +1,18 @@ +set(CMAKE_MODULE_PATH +${CMAKE_MODULE_PATH} +${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/Modules +) include(CheckFunctionExists) include(CheckIncludeFile) include(CheckIncludeFiles) include(CheckLibraryExists) include(TestBigEndian) - +if(enable_graphviz) +include(FindGraphviz) +endif(enable_graphviz) TEST_BIG_ENDIAN(BIGENDIAN) # Checks for header libraries functions. - -find_library(HAVE_CGRAPH_LIB cgraph) -find_file(HAVE_CGRAPH_H graphviz/cgraph.h) - CHECK_LIBRARY_EXISTS(pthread pthread_create NO_DEFAULT_PATHS pthread) CHECK_LIBRARY_EXISTS(pthread sem_init NO_DEFAULT_PATHS HAVE_SEM_INIT_LIB) CHECK_LIBRARY_EXISTS(pthread sem_timedwait NO_DEFAULT_PATHS HAVE_SEM_TIMEDWAIT_LIB) @@ -79,6 +81,7 @@ if(enable_latency_bound_tracking) SET(HAVE_LATENCY_BOUND_TRACKING 1) else(enable_latency_bound_tracking) if(enable_gtnets) + message("turning latency_bound_tracking to ON because GTNeTs is ON") SET(enable_latency_bound_tracking ON) SET(HAVE_LATENCY_BOUND_TRACKING 1) else(enable_gtnets) @@ -95,19 +98,11 @@ else(enable_model-checking AND HAVE_MMAP) endif(enable_model-checking AND HAVE_MMAP) if(enable_lua) - include(FindLua51) + include(FindLua51Simgrid) if(LUA51_FOUND) set(HAVE_LUA 1) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${LUA_INCLUDE_DIR} ") - foreach(path_lua ${LUA_LIBRARIES}) - string(REGEX REPLACE "liblua.*" "" path_lua_to_use ${path_lua}) - string(REGEX MATCH ".*lua.*" operation "${path_lua}") - if(operation) - string(REGEX REPLACE "${path_lua_to_use}" "" liblua ${path_lua}) - string(REPLACE "lib" "" liblua "${liblua}") - string(REGEX REPLACE "[.][^.]*$" "" liblua "${liblua}") - endif(operation) - endforeach(path_lua ${LUA_LIBRARIES}) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-L${LUA_LIBRARY_DIR} ") else(LUA51_FOUND) message("Lua binding need version 5.1 and cmake version 2.8") message("Cmake version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}") @@ -188,23 +183,61 @@ endif(NOT enable_gtnets OR enable_supernovae) #-------------------------------------------------------------------------------------------------- ### Initialize of cgraph -mark_as_advanced(HAVE_CGRAPH_LIB) -mark_as_advanced(HAVE_CGRAPH_H) - -if(HAVE_CGRAPH_LIB AND HAVE_CGRAPH_H) - string(REGEX REPLACE "/libcgraph.*" "" lib_cgraph ${HAVE_CGRAPH_LIB}) - string(REPLACE "/cgraph.h" "" file_cgraph_h ${HAVE_CGRAPH_H}) - string(REGEX MATCH "-I${file_cgraph_h} " operation "${CMAKE_C_FLAGS}") - if(NOT operation) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${file_cgraph_h} ") - endif(NOT operation) - string(REGEX MATCH "-L${lib_cgraph} " operation "${CMAKE_C_FLAGS}") - if(NOT operation) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-L${lib_cgraph} ") - endif(NOT operation) - -endif(HAVE_CGRAPH_LIB AND HAVE_CGRAPH_H) +if(enable_graphviz AND HAVE_CDT_LIB) +if(HAVE_CGRAPH_LIB OR HAVE_AGRAPH_LIB) + + if(HAVE_AGRAPH_LIB) + string(REGEX REPLACE "/libagraph.*" "" lib_graphviz ${HAVE_AGRAPH_LIB}) + else(HAVE_AGRAPH_LIB) + if(HAVE_CGRAPH_LIB) + string(REGEX REPLACE "/libcgraph.*" "" lib_graphviz ${HAVE_CGRAPH_LIB}) + endif(HAVE_CGRAPH_LIB) + endif(HAVE_AGRAPH_LIB) + + if(HAVE_GRAPH_H OR HAVE_AGRAPH_H OR HAVE_CGRAPH_H) + + if(HAVE_GRAPH_H) + string(REPLACE "/graphviz/graph.h" "" file_graphviz_h ${HAVE_GRAPH_H}) + string(REPLACE "/graphviz" "" file_graphviz_h ${file_graphviz_h}) + set(GRAPH_H 1) + endif(HAVE_GRAPH_H) + + if(HAVE_AGRAPH_H) + string(REPLACE "/graphviz/agraph.h" "" file_graphviz_h ${HAVE_AGRAPH_H}) + string(REPLACE "/graphviz" "" file_graphviz_h ${file_graphviz_h}) + set(AGRAPH_H 1) + endif(HAVE_AGRAPH_H) + + if(HAVE_CGRAPH_H) + string(REPLACE "/graphviz/cgraph.h" "" file_graphviz_h ${HAVE_CGRAPH_H}) + string(REPLACE "/graphviz" "" file_graphviz_h ${file_graphviz_h}) + set(CGRAPH_H 1) + endif(HAVE_CGRAPH_H) + + string(REGEX MATCH "-I${file_graphviz_h} " operation "${CMAKE_C_FLAGS}") + if(NOT operation) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${file_graphviz_h} ") + endif(NOT operation) + + string(REGEX MATCH "-I${file_graphviz_h}/graphviz " operation "${CMAKE_C_FLAGS}") + if(NOT operation) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${file_graphviz_h}/graphviz ") + endif(NOT operation) + + string(REGEX MATCH "-L${lib_graphviz} " operation "${CMAKE_C_FLAGS}") + if(NOT operation) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-L${lib_graphviz} ") + endif(NOT operation) + + else(HAVE_GRAPH_H OR HAVE_AGRAPH_H OR HAVE_CGRAPH_H) + set(enable_graphviz "0") + endif(HAVE_GRAPH_H OR HAVE_AGRAPH_H OR HAVE_CGRAPH_H) + +else(HAVE_CGRAPH_LIB OR HAVE_AGRAPH_LIB) + set(enable_graphviz "0") +endif(HAVE_CGRAPH_LIB OR HAVE_AGRAPH_LIB) +endif(enable_graphviz AND HAVE_CDT_LIB) #-------------------------------------------------------------------------------------------------- ### Initialize of pcre find_library(PATH_PCRE_LIB pcre) @@ -768,10 +801,14 @@ set(CMAKE_LINKARGS "${CMAKE_CURRENT_BINARY_DIR}/lib") set(CMAKE_SMPI_COMMAND "export LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/lib:${gtnets_path}/lib:$LD_LIBRARY_PATH") configure_file(${PROJECT_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_CURRENT_BINARY_DIR}/bin/smpicc @ONLY) +configure_file(${PROJECT_DIRECTORY}/src/smpi/smpif2c.in ${CMAKE_CURRENT_BINARY_DIR}/bin/smpif2c @ONLY) +configure_file(${PROJECT_DIRECTORY}/src/smpi/smpiff.in ${CMAKE_CURRENT_BINARY_DIR}/bin/smpiff @ONLY) configure_file(${PROJECT_DIRECTORY}/src/smpi/smpirun.in ${CMAKE_CURRENT_BINARY_DIR}/bin/smpirun @ONLY) configure_file(${PROJECT_DIRECTORY}/examples/smpi/hostfile ${CMAKE_CURRENT_BINARY_DIR}/examples/smpi/hostfile COPYONLY) configure_file(${PROJECT_DIRECTORY}/examples/msg/small_platform.xml ${CMAKE_CURRENT_BINARY_DIR}/examples/msg/small_platform.xml COPYONLY) configure_file(${PROJECT_DIRECTORY}/examples/msg/small_platform_with_routers.xml ${CMAKE_CURRENT_BINARY_DIR}/examples/msg/small_platform_with_routers.xml COPYONLY) exec_program("chmod a=rwx ${CMAKE_CURRENT_BINARY_DIR}/bin/smpicc" OUTPUT_VARIABLE OKITOKI) +exec_program("chmod a=rwx ${CMAKE_CURRENT_BINARY_DIR}/bin/smpif2c" OUTPUT_VARIABLE OKITOKI) +exec_program("chmod a=rwx ${CMAKE_CURRENT_BINARY_DIR}/bin/smpiff" OUTPUT_VARIABLE OKITOKI) exec_program("chmod a=rwx ${CMAKE_CURRENT_BINARY_DIR}/bin/smpirun" OUTPUT_VARIABLE OKITOKI)