1 cmake_minimum_required(VERSION 2.6)
3 message(STATUS "Cmake version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}")
7 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
8 # Check for the compiler #
9 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
11 ### Need to set rc ccompiler before enable language
13 SET(CMAKE_RC_COMPILER "windres")
17 ## Check the C/C++ standard that we need
18 ## See also tools/cmake/GCCFlags.cmake that sets our paranoid warning flags
20 message("-- You are compiling SimGrid with MicroSoft Visual C. Good luck.")
22 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_SCL_SECURE_NO_WARNINGS")
23 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_SCL_SECURE_NO_WARNINGS")
25 INCLUDE(CheckCCompilerFlag)
26 CHECK_C_COMPILER_FLAG(-fstack-cleaner HAVE_C_STACK_CLEANER)
28 ## Request full debugging flags
29 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3")
30 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
31 set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g")
33 if (CMAKE_COMPILER_IS_GNUCC)
34 if (COMPILER_CXX_VERSION_MAJOR_MINOR STRLESS "4.7")
36 "SimGrid needs at least g++ version 4.7 to compile "
37 "(c++11 support of previous versions is too limited).")
41 ## We need a decent support of the c++11 standard
42 include(CheckCXXCompilerFlag)
43 CHECK_CXX_COMPILER_FLAG("-std=gnu++11" COMPILER_SUPPORTS_CXX11)
44 if(COMPILER_SUPPORTS_CXX11)
45 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
48 "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. "
49 "Please use a decent C++ compiler.")
52 ### And we need C11 standard, too
53 include(CheckCCompilerFlag)
54 CHECK_C_COMPILER_FLAG("-std=gnu11" COMPILER_SUPPORTS_C11)
55 if(COMPILER_SUPPORTS_C11)
56 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
59 "The compiler ${CMAKE_C_COMPILER} has no C11 support. "
60 "Please use a decent C compiler "
61 "(note that c++11 support of ${CMAKE_CXX_COMPILER} seems ok).")
63 if(APPLE AND ("4.6" GREATER COMPILER_C_VERSION_MAJOR_MINOR))
64 ### gcc 4.[1-5] cannot compile ucontext on OSX
65 message(STATUS "Ucontext can't be used with this version of gcc (must be greater than 4.5)")
66 set(HAVE_UCONTEXT_H 0)
71 if ((NOT DEFINED enable_smpi OR enable_smpi) AND NOT APPLE) # smpi is enabled by default
72 # Call enable_language(Fortran) in order to load the build rules for
73 # this language, needed by teshsuite/smpi/mpich-test/. Use
74 # CMAKE_FORCE_Fortran_COMPILER to bypass checks for a working
75 # compiler (smpiff don't exist at configure time).
76 include(CMakeForceCompiler)
77 if(NOT COMMAND CMAKE_FORCE_Fortran_COMPILER)
78 MACRO(CMAKE_FORCE_Fortran_COMPILER compiler id)
79 SET(CMAKE_Fortran_COMPILER "${compiler}")
80 SET(CMAKE_Fortran_COMPILER_ID_RUN TRUE)
81 SET(CMAKE_Fortran_COMPILER_ID ${id})
82 SET(CMAKE_Fortran_COMPILER_WORKS TRUE)
83 SET(CMAKE_Fortran_COMPILER_FORCED TRUE)
85 # Set old compiler id variables.
86 IF("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
87 SET(CMAKE_COMPILER_IS_GNUG77 1)
88 ENDIF("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
89 ENDMACRO(CMAKE_FORCE_Fortran_COMPILER)
91 CMAKE_FORCE_Fortran_COMPILER(smpiff smpiff)
92 enable_language(Fortran OPTIONAL)
95 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
96 # Build the version number #
97 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
99 set(SIMGRID_VERSION_MAJOR "3")
100 set(SIMGRID_VERSION_MINOR "13")
101 set(SIMGRID_VERSION_PATCH "0")
102 set(SIMGRID_VERSION_EXTRA "-devel") # Extra words to add to version string (e.g. -rc1)
104 set(SIMGRID_VERSION_DATE "2015") # Year for copyright information
106 if(${SIMGRID_VERSION_PATCH} EQUAL "0")
107 set(release_version "${SIMGRID_VERSION_MAJOR}.${SIMGRID_VERSION_MINOR}")
109 set(release_version "${SIMGRID_VERSION_MAJOR}.${SIMGRID_VERSION_MINOR}.${SIMGRID_VERSION_PATCH}")
112 set(SIMGRID_VERSION_STRING "SimGrid version ${release_version}${SIMGRID_VERSION_EXTRA}")
113 set(SIMGRID_VERSION_BANNER
114 "SIMGRID_VERSION_STRING\\nCopyright (c) 2004-${SIMGRID_VERSION_DATE}. The Simgrid Team.")
116 set(libsimgrid_version "${release_version}")
117 set(libsimgrid-java_version "${release_version}")
119 ### SET THE LIBRARY EXTENSION
131 if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
132 exec_program("${CMAKE_C_COMPILER} --version" OUTPUT_VARIABLE "COMPILER_C_VERSION")
133 exec_program("${CMAKE_CXX_COMPILER} --version" OUTPUT_VARIABLE "COMPILER_CXX_VERSION")
134 string(REGEX MATCH "[0-9].[0-9].[0-9]" COMPILER_C_VERSION "${COMPILER_C_VERSION}")
135 string(REGEX MATCH "[0-9].[0-9].[0-9]" COMPILER_CXX_VERSION "${COMPILER_CXX_VERSION}")
137 string(REGEX MATCH "^[0-9].[0-9]" COMPILER_C_VERSION_MAJOR_MINOR "${COMPILER_C_VERSION}")
138 string(REPLACE "${COMPILER_C_VERSION_MAJOR_MINOR}." "" COMPILER_C_VERSION_PATCH "${COMPILER_C_VERSION}")
141 exec_program("${CMAKE_LINKER} --version" OUTPUT_VARIABLE "LINKER_VERSION")
142 string(REGEX MATCH "[0-9].[0-9]*" LINKER_VERSION "${LINKER_VERSION}")
144 ### Find programs and paths
145 FIND_PROGRAM(GCOV_PATH gcov)
147 if(NOT PERL_EXECUTABLE)
148 message(FATAL_ERROR "-- SimGrid cannot be compiled without Perl installed -- sorry. Bailling out.")
152 set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
153 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
156 ### Set some variables for Cmake
157 SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
160 ${CMAKE_HOME_DIRECTORY}
161 ${CMAKE_HOME_DIRECTORY}/include
162 ${CMAKE_HOME_DIRECTORY}/src
163 ${CMAKE_HOME_DIRECTORY}/src/include
165 ${CMAKE_BINARY_DIR}/include
166 ${CMAKE_BINARY_DIR}/src
170 set(INCLUDES ${INCLUDES} ${CMAKE_HOME_DIRECTORY}/include/xbt ${CMAKE_HOME_DIRECTORY}/src/xbt) #for win32_ucontext.[ch]
173 if(NOT CMAKE_CROSSCOMPILING AND EXISTS /usr/include/)
174 set(INCLUDES ${INCLUDES} /usr/include/)
177 ### Check 32bits or 64bits
178 INCLUDE (CheckTypeSize)
179 CHECK_TYPE_SIZE("int" SIZEOF_INT)
180 CHECK_TYPE_SIZE("long" SIZEOF_LONG)
181 CHECK_TYPE_SIZE("long long" SIZEOF_LONGLONG)
182 CHECK_TYPE_SIZE("void*" SIZEOF_VOIDSTAR)
183 message (" Data model: (int)=${SIZEOF_INT} (long)=${SIZEOF_LONG} (long long)=${SIZEOF_LONGLONG} (void*)=${SIZEOF_VOIDSTAR}")
184 IF(SIZEOF_VOIDSTAR EQUAL 4)
193 set(CMAKE_INCLUDE_WIN "${CMAKE_C_COMPILER}")
194 set(CMAKE_LIB_WIN "${CMAKE_C_COMPILER}")
195 string(REGEX REPLACE "/bin/gcc.*" "/include" CMAKE_INCLUDE_WIN "${CMAKE_INCLUDE_WIN}")
196 string(REGEX REPLACE "/bin/gcc.*" "/lib" CMAKE_LIB_WIN "${CMAKE_LIB_WIN}")
197 set(INCLUDES ${INCLUDES} ${CMAKE_INCLUDE_WIN})
199 if(CMAKE_COMPILER_IS_GNUCC)
201 exec_program("${CMAKE_C_COMPILER} --version" OUTPUT_VARIABLE "COMPILER_C_VERSION")
202 string(REGEX MATCH "[0-9].[0-9].[0-9]" COMPILER_C_VERSION "${COMPILER_C_VERSION}")
203 string(REGEX MATCH "^[0-9]" COMPILER_C_MAJOR_VERSION "${COMPILER_C_VERSION}")
204 string(REGEX MATCH "^[0-9].[0-9]" COMPILER_C_MINOR_VERSION "${COMPILER_C_VERSION}")
205 string(REGEX REPLACE "^${COMPILER_C_MAJOR_VERSION}." "" COMPILER_C_MINOR_VERSION "${COMPILER_C_MINOR_VERSION}")
206 if(COMPILER_C_MAJOR_VERSION)
207 # set(__GNUC__ ${COMPILER_C_MAJOR_VERSION})
209 if(COMPILER_C_MINOR_VERSION)
210 # set(__GNUC_MINOR__ ${COMPILER_C_MINOR_VERSION})
214 set(NSIS_WIN_VERSION $ENV{PROCESSOR_ARCHITEW6432})
215 if(NSIS_WIN_VERSION MATCHES "")
216 set(NSIS_WIN_VERSION $ENV{PROCESSOR_ARCHITECTURE})
218 if(${NSIS_WIN_VERSION})
219 string(TOLOWER ${NSIS_WIN_VERSION} NSIS_WIN_VERSION)
224 message(STATUS "C_COMPILER ${CMAKE_C_COMPILER} ${COMPILER_C_VERSION_MAJOR_MINOR}")
225 message(STATUS "CXX_COMPILER ${CMAKE_CXX_COMPILER} ${COMPILER_CXX_VERSION_MAJOR_MINOR}")
226 message(STATUS "CMAKE_RC_COMPILER ${CMAKE_RC_COMPILER}")
227 message(STATUS "INCLUDE ${CMAKE_INCLUDE_WIN}")
228 message(STATUS "LIB ${CMAKE_LIB_WIN}")
229 message(STATUS "MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM}")
230 message(STATUS "CMAKE_BUILD_TOOL ${CMAKE_BUILD_TOOL}")
231 message(STATUS "LINKER ${CMAKE_LINKER}")
232 message(STATUS "CMAKE_GENERATOR ${CMAKE_GENERATOR}")
233 message(STATUS "GNUC ${CMAKE_COMPILER_IS_GNUCC}")
237 include_directories(${INCLUDES})
240 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Option.cmake)
242 set(CMAKE_MODULE_PATH
244 ${CMAKE_HOME_DIRECTORY}/tools/cmake/Modules
251 ### Determine the assembly flavor that we need today
252 include(CMakeDetermineSystem)
253 IF(CMAKE_SYSTEM_PROCESSOR MATCHES ".86|AMD64|amd64")
255 message(STATUS "System processor: i686 (${CMAKE_SYSTEM_PROCESSOR}, 32 bits)")
256 set(PROCESSOR_i686 1)
258 message(STATUS "System processor: x86_64 (${CMAKE_SYSTEM_PROCESSOR}, 64 bits)")
259 set(PROCESSOR_x86_64 1)
262 message(STATUS "Disable fast raw contextes on Microsoft Visual.")
267 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha")
268 message(STATUS "System processor: alpha")
270 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
271 # Subdir is "arm" for both big-endian (arm) and little-endian (armel).
272 message(STATUS "System processor: arm")
274 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
275 # mips* machines are bi-endian mostly so processor does not tell
276 # endianess of the underlying system.
277 message(STATUS "System processor: ${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb")
279 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
280 message(STATUS "System processor: ppc64")
282 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
283 message(STATUS "System processor: ppc")
285 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc")
286 # Both flavours can run on the same processor
287 message(STATUS "System processor: ${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9")
289 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(parisc|hppa)")
290 message(STATUS "System processor: parisc" "parisc64")
292 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^s390")
293 # s390 binaries can run on s390x machines
294 message(STATUS "System processor: ${CMAKE_SYSTEM_PROCESSOR}" "s390" "s390x")
296 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^sh")
297 message(STATUS "System processor: sh")
299 ELSE() #PROCESSOR NOT FOUND
300 message(STATUS "PROCESSOR NOT FOUND: ${CMAKE_SYSTEM_PROCESSOR}")
305 set(MPI_ADDRESS_SIZE 4)
307 set(MPI_ADDRESS_SIZE 8)
310 include(CheckFunctionExists)
311 include(CheckTypeSize)
312 include(CheckIncludeFile)
313 include(CheckIncludeFiles)
314 include(CheckLibraryExists)
315 include(CheckSymbolExists)
316 include(TestBigEndian)
317 TEST_BIG_ENDIAN(BIGENDIAN)
319 include(FindGraphviz)
320 include(FindLibSigc++)
323 find_package(Java REQUIRED COMPONENTS Runtime Development)
324 find_package(JNI REQUIRED)
325 message("-- [Java] JNI found: ${JNI_FOUND}")
326 message("-- [Java] JNI include dirs: ${JNI_INCLUDE_DIRS}")
327 if(enable_maintainer_mode)
328 find_package(SWIG REQUIRED)
330 message("-- [Java] Swig found: ${SWIG_FOUND} (version ${SWIG_VERSION})")
335 find_package(Scala REQUIRED)
336 message("-- [Scala] scalac found: ${SCALA_COMPILE}")
340 include(FindLuaSimgrid)
347 message(FATAL_ERROR "Cannot find NS3. Please install it (apt-get install ns3 libns3-dev) or disable that cmake option")
351 find_package(Boost 1.48)
353 include_directories(${Boost_INCLUDE_DIRS})
356 message(FATAL_ERROR "Failed to find Boost libraries (Try to install them with 'sudo fink install boost1.53.nopython')")
358 message(FATAL_ERROR "Failed to find Boost libraries."
359 "Did you install libboost-dev and libboost-context-dev?"
360 "(libboost-context-dev is optional)")
364 # Try again to see if we have libboost-context
365 find_package(Boost 1.42 COMPONENTS context)
366 set(Boost_FOUND 1) # We don't care of whether this component is missing
368 if(Boost_FOUND AND Boost_CONTEXT_FOUND)
369 # We should use feature detection for this instead:
370 if (Boost_VERSION LESS 105600)
371 message("Found Boost.Context API v1")
372 set(HAVE_BOOST_CONTEXT 1)
374 message("Found Boost.Context API v2")
375 set(HAVE_BOOST_CONTEXT 2)
378 message (" boost : found.")
379 message (" boost-context: missing. Install libboost-context-dev for this optional feature.")
380 set(HAVE_BOOST_CONTEXT 0)
383 # Checks for header libraries functions.
384 CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_DLOPEN_IN_LIBDL)
385 CHECK_LIBRARY_EXISTS(execinfo backtrace "" HAVE_BACKTRACE_IN_LIBEXECINFO)
386 CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_PTHREAD)
387 CHECK_LIBRARY_EXISTS(pthread sem_init "" HAVE_SEM_INIT_LIB)
388 CHECK_LIBRARY_EXISTS(pthread sem_open "" HAVE_SEM_OPEN_LIB)
389 CHECK_LIBRARY_EXISTS(pthread sem_timedwait "" HAVE_SEM_TIMEDWAIT_LIB)
390 CHECK_LIBRARY_EXISTS(pthread pthread_mutex_timedlock "" HAVE_MUTEX_TIMEDLOCK_LIB)
391 CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_POSIX_GETTIME)
393 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
394 set(CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700 -D_DARWIN_C_SOURCE")
396 add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
397 set(CMAKE_REQUIRED_DEFINITIONS "-D__USE_MINGW_ANSI_STDIO=1")
399 set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
402 CHECK_INCLUDE_FILES("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)
403 CHECK_INCLUDE_FILE("valgrind/valgrind.h" HAVE_VALGRIND_VALGRIND_H)
404 CHECK_INCLUDE_FILE("socket.h" HAVE_SOCKET_H)
405 CHECK_INCLUDE_FILE("stat.h" HAVE_STAT_H)
406 CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
407 CHECK_INCLUDE_FILE("windows.h" HAVE_WINDOWS_H)
408 CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H)
409 CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
410 CHECK_INCLUDE_FILE("execinfo.h" HAVE_EXECINFO_H)
411 CHECK_INCLUDE_FILE("signal.h" HAVE_SIGNAL_H)
412 CHECK_INCLUDE_FILE("sys/time.h" HAVE_SYS_TIME_H)
413 CHECK_INCLUDE_FILE("sys/param.h" HAVE_SYS_PARAM_H)
414 CHECK_INCLUDE_FILE("sys/sysctl.h" HAVE_SYS_SYSCTL_H)
415 CHECK_INCLUDE_FILE("time.h" HAVE_TIME_H)
416 CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H)
417 CHECK_INCLUDE_FILE("ucontext.h" HAVE_UCONTEXT_H)
418 CHECK_INCLUDE_FILE("stdio.h" HAVE_STDIO_H)
419 CHECK_INCLUDE_FILE("linux/futex.h" HAVE_FUTEX_H)
421 CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
422 CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)
423 CHECK_FUNCTION_EXISTS(getdtablesize HAVE_GETDTABLESIZE)
424 CHECK_FUNCTION_EXISTS(sysconf HAVE_SYSCONF)
425 CHECK_FUNCTION_EXISTS(readv HAVE_READV)
426 CHECK_FUNCTION_EXISTS(popen HAVE_POPEN)
427 CHECK_FUNCTION_EXISTS(signal HAVE_SIGNAL)
429 CHECK_SYMBOL_EXISTS(snprintf stdio.h HAVE_SNPRINTF)
430 CHECK_SYMBOL_EXISTS(vsnprintf stdio.h HAVE_VSNPRINTF)
431 CHECK_SYMBOL_EXISTS(asprintf stdio.h HAVE_ASPRINTF)
432 CHECK_SYMBOL_EXISTS(vasprintf stdio.h HAVE_VASPRINTF)
435 # The detection of asprintf fails on MinGW, assumingly because it's
436 # defined as an inline function in stdio.h instead of a regular
437 # function. So force the result to be 1 despite of the test.
439 set(HAVE_VASPRINTF 1)
442 CHECK_FUNCTION_EXISTS(makecontext HAVE_MAKECONTEXT)
443 CHECK_FUNCTION_EXISTS(process_vm_readv HAVE_PROCESS_VM_READV)
445 CHECK_FUNCTION_EXISTS(mmap HAVE_MMAP)
447 #Check if __thread is defined
449 COMMAND "${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_thread_storage.c"
450 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
451 RESULT_VARIABLE HAVE_thread_storage_run
454 if(HAVE_thread_storage_run)
455 set(HAVE_THREAD_LOCAL_STORAGE 1)
457 set(HAVE_THREAD_LOCAL_STORAGE 0)
460 # Our usage of mmap is Linux-specific (flag MAP_ANONYMOUS), but kFreeBSD uses a GNU libc
462 NOT "${CMAKE_SYSTEM}" MATCHES "Linux" AND
463 NOT "${CMAKE_SYSTEM}" MATCHES "kFreeBSD" AND
464 NOT "${CMAKE_SYSTEM}" MATCHES "GNU" AND
465 NOT "${CMAKE_SYSTEM}" MATCHES "Darwin")
467 message(STATUS "Warning: MMAP is thought as non functional on this architecture (${CMAKE_SYSTEM})")
470 if(HAVE_MMAP AND HAVE_THREAD_LOCAL_STORAGE)
477 if(WIN32) # Those files are not detected despite being present
478 set(HAVE_UCONTEXT_H 1)
479 set(HAVE_MAKECONTEXT 1)
481 set(HAVE_VSNPRINTF 1)
484 set(CONTEXT_UCONTEXT 0)
485 SET(CONTEXT_THREADS 0)
491 if(enable_latency_bound_tracking)
492 SET(HAVE_LATENCY_BOUND_TRACKING 1)
494 SET(HAVE_LATENCY_BOUND_TRACKING 0)
497 if(enable_mallocators)
498 SET(MALLOCATOR_IS_WANTED 1)
500 SET(MALLOCATOR_IS_WANTED 0)
503 if(enable_model-checking AND HAVE_MMALLOC)
505 SET(MMALLOC_WANT_OVERRIDE_LEGACY 1)
506 include(FindLibunwind)
509 if(enable_model-checking)
510 message(STATUS "Warning: support for model-checking has been disabled because HAVE_MMALLOC is false")
514 SET(MMALLOC_WANT_OVERRIDE_LEGACY 0)
518 include(FindGFortran)
519 #really checks for objdump for privatization
520 find_package(BinUtils QUIET)
523 if( NOT "${CMAKE_OBJDUMP}" MATCHES "CMAKE_OBJDUMP-NOTFOUND" AND HAVE_MMAP)
524 SET(HAVE_PRIVATIZATION 1)
526 SET(HAVE_PRIVATIZATION 0)
530 #--------------------------------------------------------------------------------------------------
531 ### Check for GNU dynamic linker
532 CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
534 if(HAVE_DLOPEN_IN_LIBDL)
535 set(DL_LIBRARY "-ldl")
536 endif(HAVE_DLOPEN_IN_LIBDL)
537 execute_process(COMMAND ${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_gnu_dynlinker.c ${DL_LIBRARY} -o test_gnu_ld
538 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
539 OUTPUT_VARIABLE HAVE_GNU_LD_compil
541 if(HAVE_GNU_LD_compil)
543 message(STATUS "Warning: test program toward GNU ld failed to compile:")
544 message(STATUS "${HAVE_GNU_LD_comp_output}")
547 execute_process(COMMAND ./test_gnu_ld
548 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
549 RESULT_VARIABLE HAVE_GNU_LD_run
550 OUTPUT_VARIABLE var_exec
553 if(NOT HAVE_GNU_LD_run)
555 message(STATUS "We are using GNU dynamic linker")
558 message(STATUS "Warning: error while checking for GNU ld:")
559 message(STATUS "Test output: '${var_exec}'")
560 message(STATUS "Exit status: ${HAVE_GNU_LD_run}")
562 file(REMOVE test_gnu_ld)
567 #--------------------------------------------------------------------------------------------------
568 ### Initialize of CONTEXT THREADS
571 ### Test that we have a way to create semaphores
573 if(HAVE_SEM_OPEN_LIB)
574 execute_process(COMMAND ${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_sem_open.c -lpthread -o sem_open
575 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
576 OUTPUT_VARIABLE HAVE_SEM_OPEN_compil
579 # Test sem_open by compiling:
580 if(HAVE_SEM_OPEN_compil)
582 message(STATUS "Warning: sem_open not compilable")
583 message(STATUS "HAVE_SEM_OPEN_comp_output: ${HAVE_SEM_OPEN_comp_output}")
586 message(STATUS "sem_open is compilable")
589 # If we're not crosscompiling, we check by executing the program:
590 if (HAVE_SEM_OPEN AND NOT CMAKE_CROSSCOMPILING)
591 execute_process(COMMAND ./sem_open
592 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
593 RESULT_VARIABLE HAVE_SEM_OPEN_run
594 OUTPUT_VARIABLE var_compil
596 if (NOT HAVE_SEM_OPEN_run)
598 message(STATUS "sem_open is executable")
601 if(EXISTS "${CMAKE_BINARY_DIR}/sem_open")
602 message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_open exists!")
604 message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_open not exists!")
606 message(STATUS "Warning: sem_open not executable")
607 message(STATUS "Compilation output: '${var_compil}'")
608 message(STATUS "Exit result of sem_open: ${HAVE_SEM_OPEN_run}")
611 file(REMOVE sem_open)
617 if(HAVE_SEM_INIT_LIB)
618 execute_process(COMMAND ${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_sem_init.c -lpthread -o sem_init
619 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
620 RESULT_VARIABLE HAVE_SEM_INIT_run OUTPUT_VARIABLE HAVE_SEM_INIT_compil)
622 # Test sem_init by compiling:
623 if(HAVE_SEM_INIT_compil)
625 message(STATUS "Warning: sem_init not compilable")
626 message(STATUS "HAVE_SEM_INIT_comp_output: ${HAVE_SEM_OPEN_comp_output}")
629 message(STATUS "sem_init is compilable")
632 # If we're not crosscompiling, we check by executing the program:
633 if (HAVE_SEM_INIT AND NOT CMAKE_CROSSCOMPILING)
634 execute_process(COMMAND ./sem_init
635 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
636 RESULT_VARIABLE HAVE_SEM_INIT_run
637 OUTPUT_VARIABLE var_compil
639 if (NOT HAVE_SEM_INIT_run)
641 message(STATUS "sem_init is executable")
644 if(EXISTS "${CMAKE_BINARY_DIR}/sem_init")
645 message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_init exists!")
647 message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_init not exists!")
649 message(STATUS "Warning: sem_init not executable")
650 message(STATUS "Compilation output: '${var_compil}'")
651 message(STATUS "Exit result of sem_init: ${HAVE_SEM_INIT_run}")
654 file(REMOVE sem_init)
657 if(NOT HAVE_SEM_OPEN AND NOT HAVE_SEM_INIT)
658 message(FATAL_ERROR "Semaphores are not usable (neither sem_open nor sem_init is both compilable and executable), but they are mandatory to threads (you may need to mount /dev).")
661 ### Test that we have a way to timewait for semaphores
663 if(HAVE_SEM_TIMEDWAIT_LIB)
666 COMMAND "${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_sem_timedwait.c -lpthread"
667 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
668 OUTPUT_VARIABLE HAVE_SEM_TIMEDWAIT_run
671 if(HAVE_SEM_TIMEDWAIT_run)
672 set(HAVE_SEM_TIMEDWAIT 0)
673 message(STATUS "timedwait not compilable")
675 set(HAVE_SEM_TIMEDWAIT 1)
676 message(STATUS "timedwait is compilable")
680 ### HAVE_MUTEX_TIMEDLOCK
682 if(HAVE_MUTEX_TIMEDLOCK_LIB)
685 COMMAND "${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_mutex_timedlock.c -lpthread"
686 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
687 OUTPUT_VARIABLE HAVE_MUTEX_TIMEDLOCK_run
690 if(HAVE_MUTEX_TIMEDLOCK_run)
691 set(HAVE_MUTEX_TIMEDLOCK 0)
692 message(STATUS "timedlock not compilable")
694 message(STATUS "timedlock is compilable")
695 set(HAVE_MUTEX_TIMEDLOCK 1)
700 # This is needed for ucontext on MacOS X:
701 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
702 add_definitions(-D_XOPEN_SOURCE=700 -D_DARWIN_C_SOURCE)
706 # We always provide our own implementation of ucontext on Windows.
707 try_compile(HAVE_UCONTEXT
709 ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_AC_CHECK_MCSC.c
710 COMPILE_DEFINITIONS _XBT_WIN32
712 ${CMAKE_HOME_DIRECTORY}/src/include
713 ${CMAKE_HOME_DIRECTORY}/src/xbt
716 # We always provide our own implementation of ucontext on Windows.
717 try_compile(HAVE_UCONTEXT
719 ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_AC_CHECK_MCSC.c)
722 #If can have both context
725 set(CONTEXT_UCONTEXT 1)
726 message("-- Support for ucontext factory")
730 set(CONTEXT_THREADS 1)
731 message("-- Support for thread context factory")
737 if(EXISTS ${CMAKE_HOME_DIRECTORY}/.git/)
738 execute_process(COMMAND git remote
740 WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
741 OUTPUT_VARIABLE remote
744 string(REPLACE "\n" "" remote "${remote}")
745 #message(STATUS "Git remote: ${remote}")
746 execute_process(COMMAND git config --get remote.${remote}.url
747 WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
751 string(REPLACE "\n" "" url "${url}")
752 #message(STATUS "Git url: ${url}")
754 execute_process(COMMAND git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log --pretty=oneline --abbrev-commit -1
755 WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
756 OUTPUT_VARIABLE GIT_VERSION
759 string(REPLACE "\n" "" GIT_VERSION "${GIT_VERSION}")
760 message(STATUS "Git version: ${GIT_VERSION}")
761 execute_process(COMMAND git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log -n 1 --pretty=format:%ai .
762 WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
763 OUTPUT_VARIABLE GIT_DATE
766 string(REPLACE "\n" "" GIT_DATE "${GIT_DATE}")
767 message(STATUS "Git date: ${GIT_DATE}")
768 string(REGEX REPLACE " .*" "" GIT_VERSION "${GIT_VERSION}")
770 execute_process(COMMAND git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log --pretty=format:%H -1
771 WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
772 OUTPUT_VARIABLE SIMGRID_GITHASH
775 string(REPLACE "\n" "" SIMGRID_GITHASH "${SIMGRID_GITHASH}")
778 elseif(EXISTS ${CMAKE_HOME_DIRECTORY}/.gitversion)
779 FILE(STRINGS ${CMAKE_HOME_DIRECTORY}/.gitversion GIT_VERSION)
783 set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER}\\nRelease build")
785 set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER}\\nDevelopment build")
788 set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER} at commit ${GIT_VERSION}")
791 set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER} (${GIT_DATE})")
793 #--------------------------------------------------------------------------------------------------
795 set(makecontext_CPPFLAGS_2 "")
796 if(HAVE_MAKECONTEXT OR WIN32)
797 set(makecontext_CPPFLAGS "-DTEST_makecontext")
798 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
799 set(makecontext_CPPFLAGS_2 "-D_XOPEN_SOURCE=700")
804 set(makecontext_CPPFLAGS "-DTEST_makecontext -D_I_X86_")
806 set(makecontext_CPPFLAGS "-DTEST_makecontext -D_AMD64_")
808 set(makecontext_CPPFLAGS_2 "-D_XBT_WIN32 -I${CMAKE_HOME_DIRECTORY}/src/include -I${CMAKE_HOME_DIRECTORY}/src/xbt")
811 file(REMOVE ${CMAKE_BINARY_DIR}/conftestval)
813 if(CMAKE_CROSSCOMPILING)
814 set(RUN_makecontext_VAR "cross")
815 set(COMPILE_makecontext_VAR "cross")
817 try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR
819 ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_stacksetup.c
820 COMPILE_DEFINITIONS "${makecontext_CPPFLAGS} ${makecontext_CPPFLAGS_2}"
824 if(EXISTS ${CMAKE_BINARY_DIR}/conftestval)
825 file(READ ${CMAKE_BINARY_DIR}/conftestval MAKECONTEXT_ADDR_SIZE)
826 string(REPLACE "\n" "" MAKECONTEXT_ADDR_SIZE "${MAKECONTEXT_ADDR_SIZE}")
827 string(REGEX MATCH ;^.*,;MAKECONTEXT_ADDR "${MAKECONTEXT_ADDR_SIZE}")
828 string(REGEX MATCH ;,.*$; MAKECONTEXT_SIZE "${MAKECONTEXT_ADDR_SIZE}")
829 string(REPLACE "," "" makecontext_addr "${MAKECONTEXT_ADDR}")
830 string(REPLACE "," "" makecontext_size "${MAKECONTEXT_SIZE}")
831 set(pth_skaddr_makecontext "#define pth_skaddr_makecontext(skaddr,sksize) (${makecontext_addr})")
832 set(pth_sksize_makecontext "#define pth_sksize_makecontext(skaddr,sksize) (${makecontext_size})")
833 message(STATUS "${pth_skaddr_makecontext}")
834 message(STATUS "${pth_sksize_makecontext}")
836 # message(FATAL_ERROR "makecontext is not compilable")
840 #--------------------------------------------------------------------------------------------------
842 ### check for stackgrowth
843 if (NOT CMAKE_CROSSCOMPILING)
844 try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR
846 ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_stackgrowth.c
847 RUN_OUTPUT_VARIABLE stack
850 if("${stack}" STREQUAL "down")
851 set(PTH_STACKGROWTH "-1")
852 elseif("${stack}" STREQUAL "up")
853 set(PTH_STACKGROWTH "1")
855 if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
856 set(PTH_STACKGROWTH "-1")
857 elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686")
858 set(PTH_STACKGROWTH "-1")
860 message(ERROR "Could not figure the stack direction.")
868 #SG_CONFIGURE_PART([System checks...])
869 #AC_PROG_CC(xlC gcc cc) -auto
870 #AM_SANITY_CHECK -auto
876 set(diff_va "va_copy((d),(s))"
879 "__builtin_va_copy((d),(s))"
880 "do { (d) = (s)\; } while (0)"
881 "do { *(d) = *(s)\; } while (0)"
882 "memcpy((void *)&(d), (void *)&(s), sizeof(s))"
883 "memcpy((void *)(d), (void *)(s), sizeof(*(s)))"
886 foreach(fct ${diff_va})
887 write_file("${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_va_copy.c" "#include <stdlib.h>
890 #define DO_VA_COPY(d,s) ${fct}
891 void test(char *str, ...)
897 for (i = 1; i <= 9; i++) {
898 int k = (int)va_arg(ap, int);
903 for (i = 1; i <= 9; i++) {
904 int k = (int)va_arg(ap, int);
912 test(\"test\", 1, 2, 3, 4, 5, 6, 7, 8, 9);
918 COMMAND ${CMAKE_C_COMPILER} "${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_va_copy.c"
919 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
920 RESULT_VARIABLE COMPILE_VA_NULL_VAR
925 if(NOT COMPILE_VA_NULL_VAR)
926 string(REGEX REPLACE "\;" "" fctbis ${fct})
927 if(${fctbis} STREQUAL "va_copy((d),(s))")
929 set(ac_cv_va_copy "C99")
930 set(__VA_COPY_USE_C99 "va_copy((d),(s))")
933 if(${fctbis} STREQUAL "VA_COPY((d),(s))")
934 set(ac_cv_va_copy "GCM")
935 set(__VA_COPY_USE_GCM "VA_COPY((d),(s))")
938 if(${fctbis} STREQUAL "__va_copy((d),(s))")
939 set(ac_cv_va_copy "GCH")
940 set(__VA_COPY_USE_GCH "__va_copy((d),(s))")
943 if(${fctbis} STREQUAL "__builtin_va_copy((d),(s))")
944 set(ac_cv_va_copy "GCB")
945 set(__VA_COPY_USE_GCB "__builtin_va_copy((d),(s))")
948 if(${fctbis} STREQUAL "do { (d) = (s) } while (0)")
949 set(ac_cv_va_copy "ASS")
950 set(__VA_COPY_USE_ASS "do { (d) = (s); } while (0)")
953 if(${fctbis} STREQUAL "do { *(d) = *(s) } while (0)")
954 set(ac_cv_va_copy "ASP")
955 set(__VA_COPY_USE_ASP "do { *(d) = *(s); } while (0)")
958 if(${fctbis} STREQUAL "memcpy((void *)&(d), (void *)&(s), sizeof(s))")
959 set(ac_cv_va_copy "CPS")
960 set(__VA_COPY_USE_CPS "memcpy((void *)&(d), (void *)&(s), sizeof(s))")
963 if(${fctbis} STREQUAL "memcpy((void *)(d), (void *)(s), sizeof(*(s)))")
964 set(ac_cv_va_copy "CPP")
965 set(__VA_COPY_USE_CPP "memcpy((void *)(d), (void *)(s), sizeof(*(s)))")
969 set(__VA_COPY_USE "__VA_COPY_USE_${ac_cv_va_copy}(d, s)")
975 endforeach(fct ${diff_va})
977 #--------------------------------------------------------------------------------------------------
978 ### check for a working snprintf
979 if(HAVE_SNPRINTF AND HAVE_VSNPRINTF OR WIN32)
981 #set(HAVE_SNPRINTF 1)
982 #set(HAVE_VSNPRINTF 1)
985 if(CMAKE_CROSSCOMPILING)
986 set(RUN_SNPRINTF_FUNC "cross")
987 #set(PREFER_PORTABLE_SNPRINTF 1)
989 try_run(RUN_SNPRINTF_FUNC_VAR COMPILE_SNPRINTF_FUNC_VAR
991 ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_snprintf.c
995 if(CMAKE_CROSSCOMPILING)
996 set(RUN_VSNPRINTF_FUNC "cross")
997 set(PREFER_PORTABLE_VSNPRINTF 1)
999 try_run(RUN_VSNPRINTF_FUNC_VAR COMPILE_VSNPRINTF_FUNC_VAR
1001 ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_vsnprintf.c
1005 set(PREFER_PORTABLE_SNPRINTF 0)
1006 if(RUN_VSNPRINTF_FUNC_VAR MATCHES "FAILED_TO_RUN")
1007 set(PREFER_PORTABLE_SNPRINTF 1)
1009 if(RUN_SNPRINTF_FUNC_VAR MATCHES "FAILED_TO_RUN")
1010 set(PREFER_PORTABLE_SNPRINTF 1)
1014 ### check for asprintf function familly
1016 SET(simgrid_need_asprintf "")
1017 SET(NEED_ASPRINTF 0)
1019 SET(simgrid_need_asprintf "#define SIMGRID_NEED_ASPRINTF 1")
1020 SET(NEED_ASPRINTF 1)
1024 SET(simgrid_need_vasprintf "")
1025 SET(NEED_VASPRINTF 0)
1027 SET(simgrid_need_vasprintf "#define SIMGRID_NEED_VASPRINTF 1")
1028 SET(NEED_VASPRINTF 1)
1031 ### check for addr2line
1033 find_path(ADDR2LINE NAMES addr2line PATHS NO_DEFAULT_PATHS )
1035 set(ADDR2LINE "${ADDR2LINE}/addr2line")
1040 configure_file("${CMAKE_HOME_DIRECTORY}/src/context_sysv_config.h.in"
1041 "${CMAKE_BINARY_DIR}/src/context_sysv_config.h" @ONLY IMMEDIATE)
1043 SET( CMAKEDEFINE "#cmakedefine" )
1044 configure_file("${CMAKE_HOME_DIRECTORY}/tools/cmake/src/internal_config.h.in" "${CMAKE_BINARY_DIR}/src/internal_config.h" @ONLY IMMEDIATE)
1045 configure_file("${CMAKE_BINARY_DIR}/src/internal_config.h" "${CMAKE_BINARY_DIR}/src/internal_config.h" @ONLY IMMEDIATE)
1046 configure_file("${CMAKE_HOME_DIRECTORY}/include/simgrid_config.h.in" "${CMAKE_BINARY_DIR}/include/simgrid_config.h" @ONLY IMMEDIATE)
1048 set(top_srcdir "${CMAKE_HOME_DIRECTORY}")
1049 set(srcdir "${CMAKE_HOME_DIRECTORY}/src")
1050 set(bindir "${CMAKE_BINARY_DIR}")
1052 ### Script used when simgrid is installed
1053 set(exec_prefix ${CMAKE_INSTALL_PREFIX})
1054 set(includeflag "-I${CMAKE_INSTALL_PREFIX}/include -I${CMAKE_INSTALL_PREFIX}/include/smpi")
1055 set(includedir "${CMAKE_INSTALL_PREFIX}/include")
1056 set(libdir ${exec_prefix}/lib)
1057 set(CMAKE_SMPI_COMMAND "export LD_LIBRARY_PATH=\"${CMAKE_INSTALL_PREFIX}/lib")
1058 if(NS3_LIBRARY_PATH)
1059 set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${NS3_LIBRARY_PATH}")
1061 set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:\${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}\"")
1063 file(READ ${CMAKE_HOME_DIRECTORY}/src/smpi/smpitools.sh SMPITOOLS_SH)
1064 configure_file(${CMAKE_HOME_DIRECTORY}/include/smpi/mpif.h.in ${CMAKE_BINARY_DIR}/include/smpi/mpif.h @ONLY)
1065 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_BINARY_DIR}/bin/smpicc @ONLY)
1066 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicxx.in ${CMAKE_BINARY_DIR}/bin/smpicxx @ONLY)
1067 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpiff.in ${CMAKE_BINARY_DIR}/bin/smpiff @ONLY)
1068 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif90.in ${CMAKE_BINARY_DIR}/bin/smpif90 @ONLY)
1069 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpirun.in ${CMAKE_BINARY_DIR}/bin/smpirun @ONLY)
1071 ### Script used when simgrid is compiling
1072 set(includeflag "-I${CMAKE_HOME_DIRECTORY}/include -I${CMAKE_HOME_DIRECTORY}/include/smpi")
1073 set(includeflag "${includeflag} -I${CMAKE_BINARY_DIR}/include -I${CMAKE_BINARY_DIR}/include/smpi")
1074 set(includedir "${CMAKE_HOME_DIRECTORY}/include")
1075 set(exec_prefix "${CMAKE_BINARY_DIR}/smpi_script/")
1076 set(CMAKE_SMPI_COMMAND "export LD_LIBRARY_PATH=\"${CMAKE_BINARY_DIR}/lib")
1077 if(NS3_LIBRARY_PATH)
1078 set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${NS3_LIBRARY_PATH}")
1080 set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:\${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}\"")
1081 set(libdir "${CMAKE_BINARY_DIR}/lib")
1083 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc @ONLY)
1084 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicxx.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicxx @ONLY)
1085 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpiff.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff @ONLY)
1086 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif90.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpif90 @ONLY)
1087 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpirun.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun @ONLY)
1089 set(top_builddir ${CMAKE_HOME_DIRECTORY})
1092 execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpicc)
1093 execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpicxx)
1094 execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpiff)
1095 execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpif90)
1096 execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpirun)
1097 execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc)
1098 execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicxx)
1099 execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff)
1100 execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpif90)
1101 execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun)
1104 set(generated_headers_to_install
1105 ${CMAKE_CURRENT_BINARY_DIR}/include/smpi/mpif.h
1106 ${CMAKE_CURRENT_BINARY_DIR}/include/simgrid_config.h
1109 set(generated_headers
1110 ${CMAKE_CURRENT_BINARY_DIR}/src/context_sysv_config.h
1111 ${CMAKE_CURRENT_BINARY_DIR}/src/internal_config.h
1114 set(generated_files_to_clean
1115 ${generated_headers}
1116 ${generated_headers_to_install}
1117 ${CMAKE_BINARY_DIR}/bin/smpicc
1118 ${CMAKE_BINARY_DIR}/bin/smpicxx
1119 ${CMAKE_BINARY_DIR}/bin/smpiff
1120 ${CMAKE_BINARY_DIR}/bin/smpif90
1121 ${CMAKE_BINARY_DIR}/bin/smpirun
1122 ${CMAKE_BINARY_DIR}/bin/colorize
1123 ${CMAKE_BINARY_DIR}/bin/simgrid_update_xml
1124 ${CMAKE_BINARY_DIR}/examples/smpi/tracing/smpi_traced.trace
1127 if(NOT "${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_HOME_DIRECTORY}")
1128 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions0.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions0.txt COPYONLY)
1129 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions1.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions1.txt COPYONLY)
1130 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_allReduce.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allReduce.txt COPYONLY)
1131 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_barrier.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_barrier.txt COPYONLY)
1132 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_bcast.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_bcast.txt COPYONLY)
1133 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_with_isend.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_with_isend.txt COPYONLY)
1134 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_alltoall.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoall.txt COPYONLY)
1135 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_alltoallv.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoallv.txt COPYONLY)
1136 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_waitall.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_waitall.txt COPYONLY)
1137 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_reducescatter.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_reducescatter.txt COPYONLY)
1138 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_gather.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_gather.txt COPYONLY)
1139 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_allgatherv.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allgatherv.txt COPYONLY)
1140 configure_file(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/hostfile ${CMAKE_BINARY_DIR}/teshsuite/smpi/hostfile COPYONLY)
1142 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/description_file ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/description_file COPYONLY)
1143 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/README ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/README COPYONLY)
1144 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/smpi_replay.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/smpi_replay.txt COPYONLY)
1145 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace0.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace0.txt COPYONLY)
1146 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace1.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace1.txt COPYONLY)
1147 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace2.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace2.txt COPYONLY)
1148 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace3.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace3.txt COPYONLY)
1149 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace4.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace4.txt COPYONLY)
1150 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace5.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace5.txt COPYONLY)
1151 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace6.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace6.txt COPYONLY)
1152 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace7.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace7.txt COPYONLY)
1153 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace8.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace8.txt COPYONLY)
1154 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace9.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace9.txt COPYONLY)
1155 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace10.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace10.txt COPYONLY)
1156 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace11.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace11.txt COPYONLY)
1157 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace12.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace12.txt COPYONLY)
1158 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace13.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace13.txt COPYONLY)
1159 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace14.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace14.txt COPYONLY)
1160 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace15.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace15.txt COPYONLY)
1161 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace16.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace16.txt COPYONLY)
1162 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace17.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace17.txt COPYONLY)
1163 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace18.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace18.txt COPYONLY)
1164 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace19.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace19.txt COPYONLY)
1165 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace20.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace20.txt COPYONLY)
1166 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace21.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace21.txt COPYONLY)
1167 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace22.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace22.txt COPYONLY)
1168 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace23.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace23.txt COPYONLY)
1169 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace24.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace24.txt COPYONLY)
1170 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace25.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace25.txt COPYONLY)
1171 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace26.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace26.txt COPYONLY)
1172 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace27.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace27.txt COPYONLY)
1173 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace28.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace28.txt COPYONLY)
1174 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace29.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace29.txt COPYONLY)
1175 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace30.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace30.txt COPYONLY)
1176 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace31.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace31.txt COPYONLY)
1178 set(generated_files_to_clean
1179 ${generated_files_to_clean}
1180 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions0.txt
1181 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions1.txt
1182 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allReduce.txt
1183 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_barrier.txt
1184 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_bcast.txt
1185 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_with_isend.txt
1186 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoall.txt
1187 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoallv.txt
1188 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_waitall.txt
1189 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_gather.txt
1190 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allgatherv.txt
1191 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_reducescatter.txt
1192 ${CMAKE_BINARY_DIR}/teshsuite/smpi/hostfile
1193 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/description_file
1194 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/README
1195 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/smpi_replay.txt
1196 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace0.txt
1197 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace1.txt
1198 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace2.txt
1199 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace3.txt
1200 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace4.txt
1201 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace5.txt
1202 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace6.txt
1203 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace7.txt
1204 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace8.txt
1205 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace9.txt
1206 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace10.txt
1207 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace11.txt
1208 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace12.txt
1209 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace13.txt
1210 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace14.txt
1211 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace15.txt
1212 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace16.txt
1213 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace17.txt
1214 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace18.txt
1215 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace19.txt
1216 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace20.txt
1217 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace21.txt
1218 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace22.txt
1219 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace23.txt
1220 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace24.txt
1221 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace25.txt
1222 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace26.txt
1223 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace27.txt
1224 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace28.txt
1225 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace29.txt
1226 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace30.txt
1227 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace31.txt
1231 SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
1232 "${generated_files_to_clean}")
1239 configure_file("${CMAKE_HOME_DIRECTORY}/tools/cmake/src/simgrid.nsi.in" "${CMAKE_BINARY_DIR}/simgrid.nsi" @ONLY IMMEDIATE)
1241 ### Define source packages for Libs
1242 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/DefinePackages.cmake)
1244 ### Build some Maintainer files
1245 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/MaintainerMode.cmake)
1246 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/UnitTesting.cmake)
1248 ### Setup gcc & clang flags
1250 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/GCCFlags.cmake)
1255 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/MakeLib.cmake)
1257 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/MakeLibWin.cmake)
1261 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Java.cmake)
1265 if(enable_memcheck_xml)
1266 set(enable_memcheck true)
1271 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Tests.cmake)
1272 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/CTestConfig.cmake)
1274 ### Define subdirectories
1275 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/MakeExe.cmake)
1277 ### Setup the distrib
1278 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Distrib.cmake)
1280 ### Build the doc (Windows downloads the doc instead of regenerating)
1283 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Documentation.cmake)
1285 find_program(WGET_PROGRAM NAMES wget)
1286 message(STATUS "wget: ${WGET_PROGRAM}")
1288 ADD_CUSTOM_TARGET(simgrid_documentation
1289 COMMENT "Downloading the SimGrid documentation..."
1290 COMMAND ${WGET_PROGRAM} -r -np -nH -nd http://simgrid.gforge.inria.fr/simgrid/${release_version}/doc/
1291 WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/doc/html
1297 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/PrintArgs.cmake)