X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f73218921b124d155d21dd1ca4d0b9b467448780..7ad8b918b33a4dcfbcff84a443ad0cb34d6ebe97:/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e40eecb32..cde287ef96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,9 @@ if(APPLE AND (CMAKE_C_COMPILER_VERSION VERSION_LESS "4.6")) set(HAVE_UCONTEXT_H 0) endif() +### Check threading support +set(CMAKE_THREAD_PREFER_PTHREAD TRUE) +find_package(Threads) ### Setup Options include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Option.cmake) @@ -211,11 +214,11 @@ if(enable_lua) include(FindLuaSimgrid) endif() -set(SIMGRID_SIMGRID_HAVE_NS3 0) +set(SIMGRID_HAVE_NS3 0) if(enable_ns3) include(FindNS3) if (SIMGRID_HAVE_NS3) - set(SIMGRID_SIMGRID_HAVE_NS3 1) + set(SIMGRID_HAVE_NS3 1) else() message(FATAL_ERROR "Cannot find NS3. Please install it (apt-get install ns3 libns3-dev) or disable that cmake option") endif() @@ -246,46 +249,34 @@ if(Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS}) else() if(APPLE) - message(FATAL_ERROR "Boost libraries not found. Try to install them with 'sudo fink install boost1.53.nopython'") + message(FATAL_ERROR "Boost libraries not found. Try to install them with 'sudo fink install boost1.53.nopython' (check the exact name with 'fink list boost') or 'sudo brew install boost'") else() message(FATAL_ERROR "Boost libraries not found. Install libboost-dev (>= 1.48.0).") endif() endif() -#Boost context 1.61 will break compatibility with our implementation. -#Warn users about that -find_package(Boost 1.61 COMPONENTS context) - -if(Boost_FOUND AND Boost_CONTEXT_FOUND) - message(" WARNING : our implementation of Boost context factory is not compatible with Boost >=1.61 yet.") - - set(Boost_FOUND 1) - set(HAVE_BOOST_CONTEXTS 0) -else() -# 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_CONTEXTS 1) - else() - message("Found Boost.Context API v2") - set(HAVE_BOOST_CONTEXTS 2) - endif() +find_package(Boost COMPONENTS context) +set(Boost_FOUND 1) # This component is optional +if(Boost_CONTEXT_FOUND) + if (Boost_VERSION LESS 105600) + message("Found Boost.Context API v1") + set(HAVE_BOOST_CONTEXTS 1) + elseif(Boost_VERSION LESS 106100) + message("Found Boost.Context API v2") + set(HAVE_BOOST_CONTEXTS 2) else() - message (" boost : found.") - message (" boost-context: missing. Install libboost-context-dev for this optional feature.") + message(" WARNING : our implementation of Boost context factory is not compatible with Boost >=1.61 yet.") set(HAVE_BOOST_CONTEXTS 0) endif() +else() + message (" boost : found.") + message (" boost-context: missing. Install libboost-context-dev for this optional feature.") + set(HAVE_BOOST_CONTEXTS 0) endif() # Checks for header libraries functions. CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_POSIX_GETTIME) -CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_PTHREAD) if(NOT APPLE) # OS X El Capitan deprecates this function CHECK_LIBRARY_EXISTS(pthread sem_init "" HAVE_SEM_INIT_LIB) endif() @@ -399,7 +390,7 @@ if(HAVE_LIBUNWIND) endif() else() if(enable_model-checking) - message(FATAL_ERROR "Please either install the libunwind7-dev package (or equivalent) or turn off the model-checking option of SimGrid.") + message(FATAL_ERROR "Please install libunwind-dev libdw-dev libevent-dev if you want to compile the SimGrid model checker.") endif() endif() @@ -471,7 +462,7 @@ endif() ### Initialize of CONTEXT THREADS set(HAVE_THREAD_CONTEXTS 0) -if(HAVE_PTHREAD) +if(CMAKE_USE_PTHREADS_INIT) ### Test that we have a way to create semaphores if(HAVE_SEM_OPEN_LIB) @@ -965,7 +956,7 @@ message(" LDFlags .....................: ${CMAKE_C_LINK_FLAGS}") message(" with LTO ....................: ${enable_lto}") message("") -if (SIMGRID_SIMGRID_HAVE_NS3) +if (SIMGRID_HAVE_NS3) message(" Compile NS-3 ................: yes (path: ${NS3_PATH})") else() message(" Compile NS-3 ................: NO (hint: ${NS3_HINT})")