X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/58dd623939673edda1e9cd60659852ebcca65374..699bda6ce1c7b1c65fedf361ebaf2d68e595f5a6:/buildtools/Cmake/CompleteInFiles.cmake diff --git a/buildtools/Cmake/CompleteInFiles.cmake b/buildtools/Cmake/CompleteInFiles.cmake index 62c1be7ab2..dc98c0cae4 100644 --- a/buildtools/Cmake/CompleteInFiles.cmake +++ b/buildtools/Cmake/CompleteInFiles.cmake @@ -3,9 +3,10 @@ ${CMAKE_MODULE_PATH} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/Modules ) -message("-- Cmake version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}") +message(STATUS "Cmake version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}") include(CheckFunctionExists) +include(CheckTypeSize) include(CheckIncludeFile) include(CheckIncludeFiles) include(CheckLibraryExists) @@ -13,7 +14,12 @@ include(TestBigEndian) TEST_BIG_ENDIAN(BIGENDIAN) include(FindGraphviz) +if(enable_pcre) include(FindPCRE) +endif(enable_pcre) +if(enable_gtnets) + include(FindGTnets) +endif(enable_gtnets) if(enable_ruby) include(FindRubySimgrid) endif(enable_ruby) @@ -25,11 +31,11 @@ if(enable_lua) endif(enable_lua) # Checks for header libraries functions. -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) -CHECK_LIBRARY_EXISTS(pthread pthread_mutex_timedlock NO_DEFAULT_PATHS HAVE_MUTEX_TIMEDLOCK_LIB) -CHECK_LIBRARY_EXISTS(rt clock_gettime NO_DEFAULT_PATHS HAVE_POSIX_GETTIME) +CHECK_LIBRARY_EXISTS(pthread pthread_create "" pthread) +CHECK_LIBRARY_EXISTS(pthread sem_init "" HAVE_SEM_INIT_LIB) +CHECK_LIBRARY_EXISTS(pthread sem_timedwait "" HAVE_SEM_TIMEDWAIT_LIB) +CHECK_LIBRARY_EXISTS(pthread pthread_mutex_timedlock "" HAVE_MUTEX_TIMEDLOCK_LIB) +CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_POSIX_GETTIME) CHECK_INCLUDE_FILES("time.h;sys/time.h" TIME_WITH_SYS_TIME) CHECK_INCLUDE_FILES("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS) @@ -56,6 +62,8 @@ CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H) CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H) CHECK_INCLUDE_FILE("ucontext.h" HAVE_UCONTEXT_H) CHECK_INCLUDE_FILE("stdio.h" HAVE_STDIO_H) +CHECK_INCLUDE_FILE("linux/futex.h" HAVE_FUTEX_H) + CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY) CHECK_FUNCTION_EXISTS(usleep HAVE_USLEEP) @@ -80,8 +88,6 @@ endif(WIN32) set(CONTEXT_UCONTEXT 0) SET(CONTEXT_THREADS 0) -SET(HAVE_RUBY 0) -set(HAVE_LUA 0) SET(HAVE_TRACING 0) if(enable_tracing) @@ -92,7 +98,7 @@ if(enable_latency_bound_tracking) SET(HAVE_LATENCY_BOUND_TRACKING 1) else(enable_latency_bound_tracking) if(enable_gtnets) - message("-- Warning : Turning latency_bound_tracking to ON because GTNeTs is ON") + message(STATUS "Warning : 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) @@ -108,50 +114,11 @@ else(enable_model-checking AND HAVE_MMAP) SET(MMALLOC_WANT_OVERIDE_LEGACY 0) endif(enable_model-checking AND HAVE_MMAP) -if(enable_lua) - if(LUA51_FOUND) - set(HAVE_LUA 1) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${LUA_INCLUDE_DIR} ") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-L${LUA_LIBRARY_DIR} ") - else(LUA51_FOUND) - message("-- Warning : Lua need version 5.1") - endif(LUA51_FOUND) -endif(enable_lua) - #-------------------------------------------------------------------------------------------------- -### Initialize of Smpi - -if(enable_smpi) - if(HAVE_F2C_H) - string(REGEX MATCH "-I${HAVE_F2C_H} " operation "${CMAKE_C_FLAGS}") - if(NOT operation) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${HAVE_F2C_H} ") - endif(NOT operation) - else(HAVE_F2C_H) - message("-- Warning : You should install f2c before use smpi.") - endif(HAVE_F2C_H) -endif(enable_smpi) +### Check for some architecture dependent values +CHECK_TYPE_SIZE(int SIZEOF_INT) +CHECK_TYPE_SIZE(void* SIZEOF_VOIDP) -#-------------------------------------------------------------------------------------------------- -### Initialize of CONTEXT GTNETS -if(NOT enable_gtnets OR enable_supernovae) - SET(HAVE_GTNETS 0) -else(NOT enable_gtnets OR enable_supernovae) - set(GTNETS_LDFLAGS "-L${gtnets_path}/lib") - set(GTNETS_CPPFLAGS "-I${gtnets_path}/include/gtnets") - exec_program("${CMAKE_CXX_COMPILER} ${GTNETS_CPPFLAGS} -lgtnets ${GTNETS_LDFLAGS} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_gtnets.cpp " OUTPUT_VARIABLE COMPILE_GTNETS_VAR) - if(COMPILE_GTNETS_VAR) - SET(HAVE_GTNETS 0) - else(COMPILE_GTNETS_VAR) - SET(HAVE_GTNETS 1) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}${GTNETS_CPPFLAGS} ${GTNETS_LDFLAGS} ") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}${GTNETS_CPPFLAGS} ${GTNETS_LDFLAGS} ") - string(REGEX MATCH "${gtnets_path}/lib" operation "$ENV{LD_LIBRARY_PATH}") - if(NOT operation) - message(FATAL_ERROR "\n\nTo use GTNETS don't forget to set LD_LIBRARY_PATH with \n\texport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${gtnets_path}/lib\n\n") - endif(NOT operation) - endif(COMPILE_GTNETS_VAR) -endif(NOT enable_gtnets OR enable_supernovae) #-------------------------------------------------------------------------------------------------- ### Initialize of CONTEXT THREADS @@ -247,59 +214,28 @@ if(mcsc MATCHES "no" AND pthread) endif(HAVE_WINDOWS_H) endif(mcsc MATCHES "no" AND pthread) -if(with_context MATCHES "ucontext" AND mcsc MATCHES "no") - message(FATAL_ERROR "-Dwith-context=ucontext specified but ucontext unusable.") -endif(with_context MATCHES "ucontext" AND mcsc MATCHES "no") +#Only windows -set(with_context_ok 0) -if(with_context MATCHES "windows") - set(with_context_ok 1) +if(WIN32) if(NOT HAVE_WINDOWS_H) message(FATAL_ERROR "no appropriate backend found windows") endif(NOT HAVE_WINDOWS_H) -endif(with_context MATCHES "windows") - -if(with_context MATCHES "pthreads") - set(with_context_ok 1) - set(with_context "pthread") -endif(with_context MATCHES "pthreads") - -if(with_context MATCHES "auto") - set(with_context_ok 1) - set(with_context "ucontext") - message("-- With_context auto change to ucontext") -endif(with_context MATCHES "auto") - -if(with_context MATCHES "ucontext") - set(with_context_ok 1) - if(mcsc) - set(CONTEXT_UCONTEXT 1) - else(mcsc) - if(windows_context MATCHES "yes") - set(with_context "windows") - message("-- With_context ucontext change to windows") - else(windows_context MATCHES "yes") - set(with_context "pthread") - message("-- With_context ucontext change to pthread") - endif(windows_context MATCHES "yes") - endif(mcsc) -endif(with_context MATCHES "ucontext") - -if(with_context MATCHES "pthread") - set(with_context_ok 1) - if(NOT pthread) - message(FATAL_ERROR "Cannot find pthreads (try -Dwith_context=ucontext if you haven't already tried).") - endif(NOT pthread) - SET(CONTEXT_THREADS 1) -endif(with_context MATCHES "pthread") - -if(with_context MATCHES "ucontext") - SET(CONTEXT_THREADS 0) -endif(with_context MATCHES "ucontext") - -if(NOT with_context_ok) - message(FATAL_ERROR "-Dwith-context must be either ucontext or pthread") -endif(NOT with_context_ok) +endif(WIN32) + +if(windows_context MATCHES "yes") + message(STATUS "Context change to windows") +endif(windows_context MATCHES "yes") + +#If can have both context + +if(mcsc) + set(CONTEXT_UCONTEXT 1) +endif(mcsc) + +if(pthread) + set(CONTEXT_THREADS 1) +endif(pthread) + ############### ## SVN version check @@ -307,7 +243,7 @@ endif(NOT with_context_ok) if(IS_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.svn) find_file(SVN ".svn" ${CMAKE_HOME_DIRECTORY}) exec_program("svnversion ${CMAKE_HOME_DIRECTORY}" OUTPUT_VARIABLE "SVN_VERSION") - message("-- svn version ${SVN_VERSION}") + message(STATUS "svn version ${SVN_VERSION}") endif(IS_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.svn) if(IS_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git) @@ -607,7 +543,6 @@ foreach(fct ${diff_va}) endif(COMPILE_VA_NULL_VAR) endforeach(fct ${diff_va}) -file(REMOVE "${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_va_copy.c") #-------------------------------------------------------------------------------------------------- ### check for getline @@ -701,8 +636,9 @@ set(includedir ${CMAKE_INSTALL_PREFIX}/include) set(top_builddir ${CMAKE_HOME_DIRECTORY}) set(libdir ${exec_prefix}/lib) 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") +set(CMAKE_SMPI_COMMAND "export LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/lib:${GTNETS_LIB_PATH}:$LD_LIBRARY_PATH") +configure_file(${CMAKE_HOME_DIRECTORY}/include/smpi/smpif.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/smpi/smpif.h @ONLY) configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_CURRENT_BINARY_DIR}/bin/smpicc @ONLY) configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif2c.in ${CMAKE_CURRENT_BINARY_DIR}/bin/smpif2c @ONLY) configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpiff.in ${CMAKE_CURRENT_BINARY_DIR}/bin/smpiff @ONLY) @@ -715,3 +651,22 @@ exec_program("chmod a=rwx ${CMAKE_CURRENT_BINARY_DIR}/bin/smpicc" OUTPUT_VARIABL 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) + +set(generate_files_to_clean +${CMAKE_CURRENT_BINARY_DIR}/src/context_sysv_config.h +${CMAKE_CURRENT_BINARY_DIR}/src/gras_config.h +${CMAKE_CURRENT_BINARY_DIR}/include/simgrid_config.h +${CMAKE_CURRENT_BINARY_DIR}/bin/smpicc +${CMAKE_CURRENT_BINARY_DIR}/bin/smpif2c +${CMAKE_CURRENT_BINARY_DIR}/bin/smpiff +${CMAKE_CURRENT_BINARY_DIR}/bin/smpirun +${CMAKE_CURRENT_BINARY_DIR}/bin/colorize +${CMAKE_CURRENT_BINARY_DIR}/bin/simgrid_update_xml +${CMAKE_CURRENT_BINARY_DIR}/examples/smpi/hostfile +${CMAKE_CURRENT_BINARY_DIR}/examples/smpi/smpi_traced.trace +${CMAKE_CURRENT_BINARY_DIR}/examples/msg/small_platform.xml +${CMAKE_CURRENT_BINARY_DIR}/examples/msg/small_platform_with_routers.xml +) + +SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES +"${generate_files_to_clean}")