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)
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.48)
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")
+ 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("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.
CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_DLOPEN_IN_LIBDL)
CHECK_LIBRARY_EXISTS(execinfo backtrace "" HAVE_BACKTRACE_IN_LIBEXECINFO)
-CHECK_LIBRARY_EXISTS(pthread pthread_create "" pthread)
+CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_PTHREAD)
CHECK_LIBRARY_EXISTS(pthread sem_init "" HAVE_SEM_INIT_LIB)
CHECK_LIBRARY_EXISTS(pthread sem_open "" HAVE_SEM_OPEN_LIB)
CHECK_LIBRARY_EXISTS(pthread sem_timedwait "" HAVE_SEM_TIMEDWAIT_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)
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)
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()
#--------------------------------------------------------------------------------------------------
#--------------------------------------------------------------------------------------------------
### Initialize of CONTEXT THREADS
-if(pthread)
+if(HAVE_PTHREAD)
set(pthread 1)
elseif(pthread)
set(pthread 0)
endif()
-if(pthread)
+if(HAVE_PTHREAD)
### Test that we have a way to create semaphores
if(HAVE_SEM_OPEN_LIB)
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(windows_context "yes")
- 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(windows_context "yes")
- 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()
-endif()
-
-if(windows_context MATCHES "yes")
- message(STATUS "Context change to windows")
+ # 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)
+if(HAVE_PTHREAD)
set(CONTEXT_THREADS 1)
+ message("-- Support for thread context factory")
endif()
###############
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()
#--------------------------------------------------------------------------------------------------
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)
#AC_PROG_MAKE_SET
-if(CMAKE_CROSSCOMPILING)
- set(RUN_PRINTF_NULL_VAR "cross")
- set(COMPILE_PRINTF_NULL_VAR "cross")
-else()
- #AC_PRINTF_NULL FIXME: this is too ancient to survive!
- try_run(RUN_PRINTF_NULL_VAR COMPILE_PRINTF_NULL_VAR
- ${CMAKE_BINARY_DIR}
- ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_printf_null.c
- )
-endif()
-
-if(RUN_PRINTF_NULL_VAR MATCHES "FAILED_TO_RUN")
- SET(PRINTF_NULL_WORKING "0")
-else()
- SET(PRINTF_NULL_WORKING "1")
-endif()
-
#AC_CHECK_VA_COPY
set(diff_va "va_copy((d),(s))"
if(GTNETS_LIB_PATH)
set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${GTNETS_LIB_PATH}")
endif()
-if(HAVE_NS3_LIB)
- set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${HAVE_NS3_LIB}")
+if(NS3_LIBRARY_PATH)
+ set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${NS3_LIBRARY_PATH}")
endif()
set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:\${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}\"")
if(GTNETS_LIB_PATH)
set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${GTNETS_LIB_PATH}")
endif()
-if(HAVE_NS3_LIB)
- set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${HAVE_NS3_LIB}")
+if(NS3_LIBRARY_PATH)
+ set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${NS3_LIBRARY_PATH}")
endif()
set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:\${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}\"")
set(libdir "${CMAKE_BINARY_DIR}/lib")