X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a3fe5836942b059099ab2553543e131ef529c77c..4ee799f96f81829cb69a294de77e480b1200a2a4:/buildtools/Cmake/CompleteInFiles.cmake diff --git a/buildtools/Cmake/CompleteInFiles.cmake b/buildtools/Cmake/CompleteInFiles.cmake index e5a0851d74..1a748154fb 100644 --- a/buildtools/Cmake/CompleteInFiles.cmake +++ b/buildtools/Cmake/CompleteInFiles.cmake @@ -75,10 +75,6 @@ TEST_BIG_ENDIAN(BIGENDIAN) include(FindGraphviz) include(FindLibSigc++) -set(HAVE_GTNETS 0) -if(enable_gtnets) - include(FindGTnets) -endif() if(enable_java) find_package(Java REQUIRED COMPONENTS Runtime Development) find_package(JNI REQUIRED) @@ -99,25 +95,52 @@ endif() if(enable_lua) include(FindLua51Simgrid) endif() + +set(HAVE_GTNETS 0) +if(enable_gtnets) + include(FindGTnets) + if (NOT HAVE_GTNETS) + message(FATAL_ERROR "Cannot find GTNetS. Please install it, or disable that cmake option") + endif() +endif() set(HAVE_NS3 0) if(enable_ns3) include(FindNS3) + if (NOT HAVE_NS3) + message(FATAL_ERROR "Cannot find NS3. Please install it (apt-get install ns3 libns3-dev) or disable that cmake option") + endif() endif() -# algorithm 1.50.0 -# function 1.23.0 -# intrusive 1.35.0 -# lambda 1.28.0 -# signals2 1.39.0 -find_package(Boost 1.42 REQUIRED) +find_package(Boost 1.42) if(Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS}) else() - if(APPLE) #MAC - message(FATAL_ERROR, "Failed to find Boost libraries (Try to install them with 'sudo fink install boost1.53.nopython')") + if(APPLE) + message(FATAL_ERROR "Failed to find Boost libraries (Try to install them with 'sudo fink install boost1.53.nopython')") + else() + message(FATAL_ERROR "Failed to find Boost libraries." + "Did you install libboost-dev and libboost-context-dev?" + "(libboost-context-dev is optional)") + endif() +endif() + +# Try again to see if we have libboost-context +find_package(Boost 1.42 COMPONENTS context) +set(Boost_FOUND 1) # We don't care of whether this component is missing + +if(Boost_FOUND AND Boost_CONTEXT_FOUND) + # We should use feature detection for this instead: + if (Boost_VERSION LESS 105600) + message("Found Boost.Context API v1") + set(HAVE_BOOST_CONTEXT 1) else() - message(FATAL_ERROR, "Failed to find Boost libraries") + message("Found Boost.Context API v2") + set(HAVE_BOOST_CONTEXT 2) endif() +else() + message (" boost : found.") + message (" boost-context: missing. Install libboost-context-dev for this optional feature.") + set(HAVE_BOOST_CONTEXT 0) endif() # Checks for header libraries functions. @@ -131,7 +154,7 @@ CHECK_LIBRARY_EXISTS(pthread pthread_mutex_timedlock "" HAVE_MUTEX_TIMEDLOCK_LIB CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_POSIX_GETTIME) if(CMAKE_SYSTEM_NAME MATCHES "Darwin") - set(CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE") + set(CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700 -D_DARWIN_C_SOURCE") endif() CHECK_INCLUDE_FILES("time.h;sys/time.h" TIME_WITH_SYS_TIME) @@ -205,6 +228,7 @@ else() SET(HAVE_MMALLOC 0) endif() + if(WIN32) #THOSE FILES ARE FUNCTIONS ARE NOT DETECTED BUT THEY SHOULD... set(HAVE_UCONTEXT_H 1) set(HAVE_MAKECONTEXT 1) @@ -253,7 +277,15 @@ endif() if(enable_smpi) include(FindGFortran) + #really checks for objdump for privatization + find_package(BinUtils QUIET) SET(HAVE_SMPI 1) + + if( NOT "${CMAKE_OBJDUMP}" MATCHES "CMAKE_OBJDUMP-NOTFOUND" AND HAVE_MMAP) + SET(HAVE_PRIVATIZATION 1) + else() + SET(HAVE_PRIVATIZATION 0) + endif() endif() #-------------------------------------------------------------------------------------------------- @@ -437,82 +469,38 @@ if(pthread) endif() endif() -# AC_CHECK_MCSC(mcsc=yes, mcsc=no) -set(mcsc_flags "") +# This is needed for ucontext on MacOS X: if(CMAKE_SYSTEM_NAME MATCHES "Darwin") - set(mcsc_flags -D_XOPEN_SOURCE) + add_definitions(-D_XOPEN_SOURCE=700 -D_DARWIN_C_SOURCE) endif() if(WIN32) - if(ARCH_32_BITS) - set(mcsc_flags -D_XBT_WIN32 -D_I_X86_ -I${CMAKE_HOME_DIRECTORY}/src/include -I${CMAKE_HOME_DIRECTORY}/src/xbt) - else() - set(mcsc_flags -D_XBT_WIN32 -D_AMD64_ -I${CMAKE_HOME_DIRECTORY}/src/include -I${CMAKE_HOME_DIRECTORY}/src/xbt) - endif() -endif() - -IF(CMAKE_CROSSCOMPILING) - IF(WIN32) - set(IS_WINDOWS 1) - ENDIF() -ELSE() - file(REMOVE "${CMAKE_BINARY_DIR}/testprog*") - file(REMOVE ${CMAKE_BINARY_DIR}/conftestval) - set(MCSC_buildcmd ${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c ${mcsc_flags} -o testprog) - execute_process(COMMAND ${MCSC_buildcmd} - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/ - OUTPUT_VARIABLE COMPILE_mcsc_VAR ERROR_VARIABLE COMPILE_mcsc_VAR) - - if(NOT COMPILE_mcsc_VAR) - message(STATUS "prog_AC_CHECK_MCSC.c is compilable") - execute_process(COMMAND ./testprog - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/ - OUTPUT_VARIABLE var_compil) - else() - message(STATUS "prog_AC_CHECK_MCSC.c is not compilable. \nBuild command: ${MCSC_buildcmd}\nOutput\n${COMPILE_mcsc_VAR}") - endif() - file(REMOVE "${CMAKE_BINARY_DIR}/testprog*") - - if(EXISTS "${CMAKE_BINARY_DIR}/conftestval") - file(READ "${CMAKE_BINARY_DIR}/conftestval" mcsc) - STRING(REPLACE "\n" "" mcsc "${mcsc}") - if(mcsc) - set(mcsc "yes") - set(HAVE_UCONTEXT_H 1) - else() - set(mcsc "no") - endif() - else() - set(mcsc "no") - endif() - - message(STATUS "mcsc: ${mcsc}") -ENDIF() - -if(mcsc MATCHES "no" AND pthread) - if(HAVE_WINDOWS_H) - set(IS_WINDOWS 1) - elseif(HAVE_WINDOWS_H) - message(FATAL_ERROR "no appropriate backend found") - endif() -endif() - -#Only windows - -if(WIN32) - if(NOT HAVE_WINDOWS_H) - message(FATAL_ERROR "no appropriate backend found windows") - endif() + # We always provide our own implementation of ucontext on Windows. + try_compile(HAVE_UCONTEXT + ${CMAKE_BINARY_DIR} + ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c + COMPILE_DEFINITIONS _XBT_WIN32 + INCLUDE_DIRECTORIES + ${CMAKE_HOME_DIRECTORY}/src/include + ${CMAKE_HOME_DIRECTORY}/src/xbt + ) +else() + # We always provide our own implementation of ucontext on Windows. + try_compile(HAVE_UCONTEXT + ${CMAKE_BINARY_DIR} + ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c) endif() #If can have both context -if(mcsc) +if(HAVE_UCONTEXT) set(CONTEXT_UCONTEXT 1) + message("-- Support for ucontext factory") endif() if(pthread) set(CONTEXT_THREADS 1) + message("-- Support for thread context factory") endif() ############### @@ -564,15 +552,15 @@ elseif(EXISTS ${CMAKE_HOME_DIRECTORY}/.gitversion) endif() if(release) - set(SIMGRID_VERSION_STRING "${SIMGRID_VERSION_STRING}\\nRelease build") + set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER}\\nRelease build") else() - set(SIMGRID_VERSION_STRING "${SIMGRID_VERSION_STRING}\\nDevelopment build") + set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER}\\nDevelopment build") endif() if(GIT_VERSION) - set(SIMGRID_VERSION_STRING "${SIMGRID_VERSION_STRING} at commit ${GIT_VERSION}") + set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER} at commit ${GIT_VERSION}") endif() if(GIT_DATE) - set(SIMGRID_VERSION_STRING "${SIMGRID_VERSION_STRING} (${GIT_DATE})") + set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER} (${GIT_DATE})") endif() #-------------------------------------------------------------------------------------------------- @@ -580,7 +568,7 @@ set(makecontext_CPPFLAGS_2 "") if(HAVE_MAKECONTEXT OR WIN32) set(makecontext_CPPFLAGS "-DTEST_makecontext") if(CMAKE_SYSTEM_NAME MATCHES "Darwin") - set(makecontext_CPPFLAGS_2 "-D_XOPEN_SOURCE") + set(makecontext_CPPFLAGS_2 "-D_XOPEN_SOURCE=700") endif() if(WIN32)