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 IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
187 set(CMAKE_INCLUDE_WIN "${CMAKE_C_COMPILER}")
188 set(CMAKE_LIB_WIN "${CMAKE_C_COMPILER}")
189 string(REGEX REPLACE "/bin/gcc.*" "/include" CMAKE_INCLUDE_WIN "${CMAKE_INCLUDE_WIN}")
190 string(REGEX REPLACE "/bin/gcc.*" "/lib" CMAKE_LIB_WIN "${CMAKE_LIB_WIN}")
191 set(INCLUDES ${INCLUDES} ${CMAKE_INCLUDE_WIN})
193 if(CMAKE_COMPILER_IS_GNUCC)
195 exec_program("${CMAKE_C_COMPILER} --version" OUTPUT_VARIABLE "COMPILER_C_VERSION")
196 string(REGEX MATCH "[0-9].[0-9].[0-9]" COMPILER_C_VERSION "${COMPILER_C_VERSION}")
197 string(REGEX MATCH "^[0-9]" COMPILER_C_MAJOR_VERSION "${COMPILER_C_VERSION}")
198 string(REGEX MATCH "^[0-9].[0-9]" COMPILER_C_MINOR_VERSION "${COMPILER_C_VERSION}")
199 string(REGEX REPLACE "^${COMPILER_C_MAJOR_VERSION}." "" COMPILER_C_MINOR_VERSION "${COMPILER_C_MINOR_VERSION}")
200 if(COMPILER_C_MAJOR_VERSION)
201 # set(__GNUC__ ${COMPILER_C_MAJOR_VERSION})
203 if(COMPILER_C_MINOR_VERSION)
204 # set(__GNUC_MINOR__ ${COMPILER_C_MINOR_VERSION})
208 set(NSIS_WIN_VERSION $ENV{PROCESSOR_ARCHITEW6432})
209 if(NSIS_WIN_VERSION MATCHES "")
210 set(NSIS_WIN_VERSION $ENV{PROCESSOR_ARCHITECTURE})
212 if(${NSIS_WIN_VERSION})
213 string(TOLOWER ${NSIS_WIN_VERSION} NSIS_WIN_VERSION)
218 message(STATUS "C_COMPILER ${CMAKE_C_COMPILER} ${COMPILER_C_VERSION_MAJOR_MINOR}")
219 message(STATUS "CXX_COMPILER ${CMAKE_CXX_COMPILER} ${COMPILER_CXX_VERSION_MAJOR_MINOR}")
220 message(STATUS "CMAKE_RC_COMPILER ${CMAKE_RC_COMPILER}")
221 message(STATUS "INCLUDE ${CMAKE_INCLUDE_WIN}")
222 message(STATUS "LIB ${CMAKE_LIB_WIN}")
223 message(STATUS "MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM}")
224 message(STATUS "CMAKE_BUILD_TOOL ${CMAKE_BUILD_TOOL}")
225 message(STATUS "LINKER ${CMAKE_LINKER}")
226 message(STATUS "CMAKE_GENERATOR ${CMAKE_GENERATOR}")
227 message(STATUS "GNUC ${CMAKE_COMPILER_IS_GNUCC}")
231 include_directories(${INCLUDES})
234 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Option.cmake)
236 set(CMAKE_MODULE_PATH
238 ${CMAKE_HOME_DIRECTORY}/tools/cmake/Modules
245 ### Determine the assembly flavor that we need today
246 include(CMakeDetermineSystem)
247 IF(CMAKE_SYSTEM_PROCESSOR MATCHES ".86|AMD64|amd64")
249 message(STATUS "System processor: i686 (${CMAKE_SYSTEM_PROCESSOR}, 32 bits)")
250 set(PROCESSOR_i686 1)
252 message(STATUS "System processor: x86_64 (${CMAKE_SYSTEM_PROCESSOR}, 64 bits)")
253 set(PROCESSOR_x86_64 1)
256 message(STATUS "Disable fast raw contextes on Microsoft Visual.")
261 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha")
262 message(STATUS "System processor: alpha")
264 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
265 # Subdir is "arm" for both big-endian (arm) and little-endian (armel).
266 message(STATUS "System processor: arm")
268 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
269 # mips* machines are bi-endian mostly so processor does not tell
270 # endianess of the underlying system.
271 message(STATUS "System processor: ${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb")
273 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
274 message(STATUS "System processor: ppc64")
276 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
277 message(STATUS "System processor: ppc")
279 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc")
280 # Both flavours can run on the same processor
281 message(STATUS "System processor: ${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9")
283 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(parisc|hppa)")
284 message(STATUS "System processor: parisc" "parisc64")
286 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^s390")
287 # s390 binaries can run on s390x machines
288 message(STATUS "System processor: ${CMAKE_SYSTEM_PROCESSOR}" "s390" "s390x")
290 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^sh")
291 message(STATUS "System processor: sh")
293 ELSE() #PROCESSOR NOT FOUND
294 message(STATUS "PROCESSOR NOT FOUND: ${CMAKE_SYSTEM_PROCESSOR}")
299 set(MPI_ADDRESS_SIZE 4)
301 set(MPI_ADDRESS_SIZE 8)
304 include(CheckFunctionExists)
305 include(CheckTypeSize)
306 include(CheckIncludeFile)
307 include(CheckIncludeFiles)
308 include(CheckLibraryExists)
309 include(CheckSymbolExists)
310 include(TestBigEndian)
311 TEST_BIG_ENDIAN(BIGENDIAN)
313 include(FindGraphviz)
314 include(FindLibSigc++)
317 find_package(Java REQUIRED COMPONENTS Runtime Development)
318 find_package(JNI REQUIRED)
319 message("-- [Java] JNI found: ${JNI_FOUND}")
320 message("-- [Java] JNI include dirs: ${JNI_INCLUDE_DIRS}")
321 if(enable_maintainer_mode)
322 find_package(SWIG REQUIRED)
324 message("-- [Java] Swig found: ${SWIG_FOUND} (version ${SWIG_VERSION})")
329 find_package(Scala REQUIRED)
330 message("-- [Scala] scalac found: ${SCALA_COMPILE}")
334 include(FindLuaSimgrid)
341 message(FATAL_ERROR "Cannot find NS3. Please install it (apt-get install ns3 libns3-dev) or disable that cmake option")
345 find_package(Boost 1.48)
347 include_directories(${Boost_INCLUDE_DIRS})
350 message(FATAL_ERROR "Failed to find Boost libraries (Try to install them with 'sudo fink install boost1.53.nopython')")
352 message(FATAL_ERROR "Failed to find Boost libraries."
353 "Did you install libboost-dev and libboost-context-dev?"
354 "(libboost-context-dev is optional)")
358 # Try again to see if we have libboost-context
359 find_package(Boost 1.42 COMPONENTS context)
360 set(Boost_FOUND 1) # We don't care of whether this component is missing
362 if(Boost_FOUND AND Boost_CONTEXT_FOUND)
363 # We should use feature detection for this instead:
364 if (Boost_VERSION LESS 105600)
365 message("Found Boost.Context API v1")
366 set(HAVE_BOOST_CONTEXT 1)
368 message("Found Boost.Context API v2")
369 set(HAVE_BOOST_CONTEXT 2)
372 message (" boost : found.")
373 message (" boost-context: missing. Install libboost-context-dev for this optional feature.")
374 set(HAVE_BOOST_CONTEXT 0)
377 # Checks for header libraries functions.
378 CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_DLOPEN_IN_LIBDL)
379 CHECK_LIBRARY_EXISTS(execinfo backtrace "" HAVE_BACKTRACE_IN_LIBEXECINFO)
380 CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_PTHREAD)
381 CHECK_LIBRARY_EXISTS(pthread sem_init "" HAVE_SEM_INIT_LIB)
382 CHECK_LIBRARY_EXISTS(pthread sem_open "" HAVE_SEM_OPEN_LIB)
383 CHECK_LIBRARY_EXISTS(pthread sem_timedwait "" HAVE_SEM_TIMEDWAIT_LIB)
384 CHECK_LIBRARY_EXISTS(pthread pthread_mutex_timedlock "" HAVE_MUTEX_TIMEDLOCK_LIB)
385 CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_POSIX_GETTIME)
387 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
388 set(CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700 -D_DARWIN_C_SOURCE")
390 add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
391 set(CMAKE_REQUIRED_DEFINITIONS "-D__USE_MINGW_ANSI_STDIO=1")
393 set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
396 CHECK_INCLUDE_FILES("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)
397 CHECK_INCLUDE_FILE("valgrind/valgrind.h" HAVE_VALGRIND_VALGRIND_H)
398 CHECK_INCLUDE_FILE("socket.h" HAVE_SOCKET_H)
399 CHECK_INCLUDE_FILE("stat.h" HAVE_STAT_H)
400 CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
401 CHECK_INCLUDE_FILE("windows.h" HAVE_WINDOWS_H)
402 CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H)
403 CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
404 CHECK_INCLUDE_FILE("execinfo.h" HAVE_EXECINFO_H)
405 CHECK_INCLUDE_FILE("signal.h" HAVE_SIGNAL_H)
406 CHECK_INCLUDE_FILE("sys/time.h" HAVE_SYS_TIME_H)
407 CHECK_INCLUDE_FILE("sys/param.h" HAVE_SYS_PARAM_H)
408 CHECK_INCLUDE_FILE("sys/sysctl.h" HAVE_SYS_SYSCTL_H)
409 CHECK_INCLUDE_FILE("time.h" HAVE_TIME_H)
410 CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H)
411 CHECK_INCLUDE_FILE("ucontext.h" HAVE_UCONTEXT_H)
412 CHECK_INCLUDE_FILE("stdio.h" HAVE_STDIO_H)
413 CHECK_INCLUDE_FILE("linux/futex.h" HAVE_FUTEX_H)
415 CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
416 CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)
417 CHECK_FUNCTION_EXISTS(getdtablesize HAVE_GETDTABLESIZE)
418 CHECK_FUNCTION_EXISTS(sysconf HAVE_SYSCONF)
419 CHECK_FUNCTION_EXISTS(readv HAVE_READV)
420 CHECK_FUNCTION_EXISTS(popen HAVE_POPEN)
421 CHECK_FUNCTION_EXISTS(signal HAVE_SIGNAL)
423 CHECK_SYMBOL_EXISTS(snprintf stdio.h HAVE_SNPRINTF)
424 CHECK_SYMBOL_EXISTS(vsnprintf stdio.h HAVE_VSNPRINTF)
425 CHECK_SYMBOL_EXISTS(asprintf stdio.h HAVE_ASPRINTF)
426 CHECK_SYMBOL_EXISTS(vasprintf stdio.h HAVE_VASPRINTF)
429 # The detection of asprintf fails on MinGW, assumingly because it's
430 # defined as an inline function in stdio.h instead of a regular
431 # function. So force the result to be 1 despite of the test.
433 set(HAVE_VASPRINTF 1)
436 CHECK_FUNCTION_EXISTS(makecontext HAVE_MAKECONTEXT)
437 CHECK_FUNCTION_EXISTS(process_vm_readv HAVE_PROCESS_VM_READV)
439 CHECK_FUNCTION_EXISTS(mmap HAVE_MMAP)
441 #Check if __thread is defined
443 COMMAND "${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_thread_storage.c"
444 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
445 RESULT_VARIABLE HAVE_thread_storage_run
448 if(HAVE_thread_storage_run)
449 set(HAVE_THREAD_LOCAL_STORAGE 1)
451 set(HAVE_THREAD_LOCAL_STORAGE 0)
454 # Our usage of mmap is Linux-specific (flag MAP_ANONYMOUS), but kFreeBSD uses a GNU libc
456 NOT "${CMAKE_SYSTEM}" MATCHES "Linux" AND
457 NOT "${CMAKE_SYSTEM}" MATCHES "kFreeBSD" AND
458 NOT "${CMAKE_SYSTEM}" MATCHES "GNU" AND
459 NOT "${CMAKE_SYSTEM}" MATCHES "Darwin")
461 message(STATUS "Warning: MMAP is thought as non functional on this architecture (${CMAKE_SYSTEM})")
464 if(HAVE_MMAP AND HAVE_THREAD_LOCAL_STORAGE)
471 if(WIN32) # Those files are not detected despite being present
472 set(HAVE_UCONTEXT_H 1)
473 set(HAVE_MAKECONTEXT 1)
475 set(HAVE_VSNPRINTF 1)
478 set(CONTEXT_UCONTEXT 0)
479 SET(CONTEXT_THREADS 0)
485 if(enable_latency_bound_tracking)
486 SET(HAVE_LATENCY_BOUND_TRACKING 1)
488 SET(HAVE_LATENCY_BOUND_TRACKING 0)
491 if(enable_mallocators)
492 SET(MALLOCATOR_IS_WANTED 1)
494 SET(MALLOCATOR_IS_WANTED 0)
497 if(enable_model-checking AND HAVE_MMALLOC)
499 SET(MMALLOC_WANT_OVERRIDE_LEGACY 1)
500 include(FindLibunwind)
503 if(enable_model-checking)
504 message(STATUS "Warning: support for model-checking has been disabled because HAVE_MMALLOC is false")
508 SET(MMALLOC_WANT_OVERRIDE_LEGACY 0)
512 include(FindGFortran)
513 #really checks for objdump for privatization
514 find_package(BinUtils QUIET)
517 if( NOT "${CMAKE_OBJDUMP}" MATCHES "CMAKE_OBJDUMP-NOTFOUND" AND HAVE_MMAP)
518 SET(HAVE_PRIVATIZATION 1)
520 SET(HAVE_PRIVATIZATION 0)
524 #--------------------------------------------------------------------------------------------------
525 ### Check for GNU dynamic linker
526 CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
528 if(HAVE_DLOPEN_IN_LIBDL)
529 set(DL_LIBRARY "-ldl")
530 endif(HAVE_DLOPEN_IN_LIBDL)
531 execute_process(COMMAND ${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_gnu_dynlinker.c ${DL_LIBRARY} -o test_gnu_ld
532 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
533 OUTPUT_VARIABLE HAVE_GNU_LD_compil
535 if(HAVE_GNU_LD_compil)
537 message(STATUS "Warning: test program toward GNU ld failed to compile:")
538 message(STATUS "${HAVE_GNU_LD_comp_output}")
541 execute_process(COMMAND ./test_gnu_ld
542 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
543 RESULT_VARIABLE HAVE_GNU_LD_run
544 OUTPUT_VARIABLE var_exec
547 if(NOT HAVE_GNU_LD_run)
549 message(STATUS "We are using GNU dynamic linker")
552 message(STATUS "Warning: error while checking for GNU ld:")
553 message(STATUS "Test output: '${var_exec}'")
554 message(STATUS "Exit status: ${HAVE_GNU_LD_run}")
556 file(REMOVE test_gnu_ld)
561 #--------------------------------------------------------------------------------------------------
562 ### Initialize of CONTEXT THREADS
565 ### Test that we have a way to create semaphores
567 if(HAVE_SEM_OPEN_LIB)
568 execute_process(COMMAND ${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_sem_open.c -lpthread -o sem_open
569 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
570 OUTPUT_VARIABLE HAVE_SEM_OPEN_compil
573 # Test sem_open by compiling:
574 if(HAVE_SEM_OPEN_compil)
576 message(STATUS "Warning: sem_open not compilable")
577 message(STATUS "HAVE_SEM_OPEN_comp_output: ${HAVE_SEM_OPEN_comp_output}")
580 message(STATUS "sem_open is compilable")
583 # If we're not crosscompiling, we check by executing the program:
584 if (HAVE_SEM_OPEN AND NOT CMAKE_CROSSCOMPILING)
585 execute_process(COMMAND ./sem_open
586 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
587 RESULT_VARIABLE HAVE_SEM_OPEN_run
588 OUTPUT_VARIABLE var_compil
590 if (NOT HAVE_SEM_OPEN_run)
592 message(STATUS "sem_open is executable")
595 if(EXISTS "${CMAKE_BINARY_DIR}/sem_open")
596 message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_open exists!")
598 message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_open not exists!")
600 message(STATUS "Warning: sem_open not executable")
601 message(STATUS "Compilation output: '${var_compil}'")
602 message(STATUS "Exit result of sem_open: ${HAVE_SEM_OPEN_run}")
605 file(REMOVE sem_open)
611 if(HAVE_SEM_INIT_LIB)
612 execute_process(COMMAND ${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_sem_init.c -lpthread -o sem_init
613 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
614 RESULT_VARIABLE HAVE_SEM_INIT_run OUTPUT_VARIABLE HAVE_SEM_INIT_compil)
616 # Test sem_init by compiling:
617 if(HAVE_SEM_INIT_compil)
619 message(STATUS "Warning: sem_init not compilable")
620 message(STATUS "HAVE_SEM_INIT_comp_output: ${HAVE_SEM_OPEN_comp_output}")
623 message(STATUS "sem_init is compilable")
626 # If we're not crosscompiling, we check by executing the program:
627 if (HAVE_SEM_INIT AND NOT CMAKE_CROSSCOMPILING)
628 execute_process(COMMAND ./sem_init
629 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
630 RESULT_VARIABLE HAVE_SEM_INIT_run
631 OUTPUT_VARIABLE var_compil
633 if (NOT HAVE_SEM_INIT_run)
635 message(STATUS "sem_init is executable")
638 if(EXISTS "${CMAKE_BINARY_DIR}/sem_init")
639 message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_init exists!")
641 message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_init not exists!")
643 message(STATUS "Warning: sem_init not executable")
644 message(STATUS "Compilation output: '${var_compil}'")
645 message(STATUS "Exit result of sem_init: ${HAVE_SEM_INIT_run}")
648 file(REMOVE sem_init)
651 if(NOT HAVE_SEM_OPEN AND NOT HAVE_SEM_INIT)
652 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).")
655 ### Test that we have a way to timewait for semaphores
657 if(HAVE_SEM_TIMEDWAIT_LIB)
660 COMMAND "${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_sem_timedwait.c -lpthread"
661 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
662 OUTPUT_VARIABLE HAVE_SEM_TIMEDWAIT_run
665 if(HAVE_SEM_TIMEDWAIT_run)
666 set(HAVE_SEM_TIMEDWAIT 0)
667 message(STATUS "timedwait not compilable")
669 set(HAVE_SEM_TIMEDWAIT 1)
670 message(STATUS "timedwait is compilable")
674 ### HAVE_MUTEX_TIMEDLOCK
676 if(HAVE_MUTEX_TIMEDLOCK_LIB)
679 COMMAND "${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_mutex_timedlock.c -lpthread"
680 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
681 OUTPUT_VARIABLE HAVE_MUTEX_TIMEDLOCK_run
684 if(HAVE_MUTEX_TIMEDLOCK_run)
685 set(HAVE_MUTEX_TIMEDLOCK 0)
686 message(STATUS "timedlock not compilable")
688 message(STATUS "timedlock is compilable")
689 set(HAVE_MUTEX_TIMEDLOCK 1)
694 # This is needed for ucontext on MacOS X:
695 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
696 add_definitions(-D_XOPEN_SOURCE=700 -D_DARWIN_C_SOURCE)
700 # We always provide our own implementation of ucontext on Windows.
701 try_compile(HAVE_UCONTEXT
703 ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_AC_CHECK_MCSC.c
704 COMPILE_DEFINITIONS _XBT_WIN32
706 ${CMAKE_HOME_DIRECTORY}/src/include
707 ${CMAKE_HOME_DIRECTORY}/src/xbt
710 # We always provide our own implementation of ucontext on Windows.
711 try_compile(HAVE_UCONTEXT
713 ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_AC_CHECK_MCSC.c)
716 #If can have both context
719 set(CONTEXT_UCONTEXT 1)
720 message("-- Support for ucontext factory")
724 set(CONTEXT_THREADS 1)
725 message("-- Support for thread context factory")
731 if(EXISTS ${CMAKE_HOME_DIRECTORY}/.git/)
732 execute_process(COMMAND git remote
734 WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
735 OUTPUT_VARIABLE remote
738 string(REPLACE "\n" "" remote "${remote}")
739 #message(STATUS "Git remote: ${remote}")
740 execute_process(COMMAND git config --get remote.${remote}.url
741 WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
745 string(REPLACE "\n" "" url "${url}")
746 #message(STATUS "Git url: ${url}")
748 execute_process(COMMAND git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log --pretty=oneline --abbrev-commit -1
749 WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
750 OUTPUT_VARIABLE GIT_VERSION
753 string(REPLACE "\n" "" GIT_VERSION "${GIT_VERSION}")
754 message(STATUS "Git version: ${GIT_VERSION}")
755 execute_process(COMMAND git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log -n 1 --pretty=format:%ai .
756 WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
757 OUTPUT_VARIABLE GIT_DATE
760 string(REPLACE "\n" "" GIT_DATE "${GIT_DATE}")
761 message(STATUS "Git date: ${GIT_DATE}")
762 string(REGEX REPLACE " .*" "" GIT_VERSION "${GIT_VERSION}")
764 execute_process(COMMAND git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log --pretty=format:%H -1
765 WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
766 OUTPUT_VARIABLE SIMGRID_GITHASH
769 string(REPLACE "\n" "" SIMGRID_GITHASH "${SIMGRID_GITHASH}")
772 elseif(EXISTS ${CMAKE_HOME_DIRECTORY}/.gitversion)
773 FILE(STRINGS ${CMAKE_HOME_DIRECTORY}/.gitversion GIT_VERSION)
777 set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER}\\nRelease build")
779 set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER}\\nDevelopment build")
782 set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER} at commit ${GIT_VERSION}")
785 set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER} (${GIT_DATE})")
787 #--------------------------------------------------------------------------------------------------
789 set(makecontext_CPPFLAGS_2 "")
790 if(HAVE_MAKECONTEXT OR WIN32)
791 set(makecontext_CPPFLAGS "-DTEST_makecontext")
792 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
793 set(makecontext_CPPFLAGS_2 "-D_XOPEN_SOURCE=700")
798 set(makecontext_CPPFLAGS "-DTEST_makecontext -D_I_X86_")
800 set(makecontext_CPPFLAGS "-DTEST_makecontext -D_AMD64_")
802 set(makecontext_CPPFLAGS_2 "-D_XBT_WIN32 -I${CMAKE_HOME_DIRECTORY}/src/include -I${CMAKE_HOME_DIRECTORY}/src/xbt")
805 file(REMOVE ${CMAKE_BINARY_DIR}/conftestval)
807 if(CMAKE_CROSSCOMPILING)
808 set(RUN_makecontext_VAR "cross")
809 set(COMPILE_makecontext_VAR "cross")
811 try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR
813 ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_stacksetup.c
814 COMPILE_DEFINITIONS "${makecontext_CPPFLAGS} ${makecontext_CPPFLAGS_2}"
818 if(EXISTS ${CMAKE_BINARY_DIR}/conftestval)
819 file(READ ${CMAKE_BINARY_DIR}/conftestval MAKECONTEXT_ADDR_SIZE)
820 string(REPLACE "\n" "" MAKECONTEXT_ADDR_SIZE "${MAKECONTEXT_ADDR_SIZE}")
821 string(REGEX MATCH ;^.*,;MAKECONTEXT_ADDR "${MAKECONTEXT_ADDR_SIZE}")
822 string(REGEX MATCH ;,.*$; MAKECONTEXT_SIZE "${MAKECONTEXT_ADDR_SIZE}")
823 string(REPLACE "," "" makecontext_addr "${MAKECONTEXT_ADDR}")
824 string(REPLACE "," "" makecontext_size "${MAKECONTEXT_SIZE}")
825 set(pth_skaddr_makecontext "#define pth_skaddr_makecontext(skaddr,sksize) (${makecontext_addr})")
826 set(pth_sksize_makecontext "#define pth_sksize_makecontext(skaddr,sksize) (${makecontext_size})")
827 message(STATUS "${pth_skaddr_makecontext}")
828 message(STATUS "${pth_sksize_makecontext}")
830 # message(FATAL_ERROR "makecontext is not compilable")
834 #--------------------------------------------------------------------------------------------------
836 ### check for stackgrowth
837 if (NOT CMAKE_CROSSCOMPILING)
838 try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR
840 ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_stackgrowth.c
841 RUN_OUTPUT_VARIABLE stack
844 if("${stack}" STREQUAL "down")
845 set(PTH_STACKGROWTH "-1")
846 elseif("${stack}" STREQUAL "up")
847 set(PTH_STACKGROWTH "1")
849 if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
850 set(PTH_STACKGROWTH "-1")
851 elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686")
852 set(PTH_STACKGROWTH "-1")
854 message(ERROR "Could not figure the stack direction.")
862 #SG_CONFIGURE_PART([System checks...])
863 #AC_PROG_CC(xlC gcc cc) -auto
864 #AM_SANITY_CHECK -auto
870 set(diff_va "va_copy((d),(s))"
873 "__builtin_va_copy((d),(s))"
874 "do { (d) = (s)\; } while (0)"
875 "do { *(d) = *(s)\; } while (0)"
876 "memcpy((void *)&(d), (void *)&(s), sizeof(s))"
877 "memcpy((void *)(d), (void *)(s), sizeof(*(s)))"
880 foreach(fct ${diff_va})
881 write_file("${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_va_copy.c" "#include <stdlib.h>
884 #define DO_VA_COPY(d,s) ${fct}
885 void test(char *str, ...)
891 for (i = 1; i <= 9; i++) {
892 int k = (int)va_arg(ap, int);
897 for (i = 1; i <= 9; i++) {
898 int k = (int)va_arg(ap, int);
906 test(\"test\", 1, 2, 3, 4, 5, 6, 7, 8, 9);
912 COMMAND ${CMAKE_C_COMPILER} "${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_va_copy.c"
913 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
914 RESULT_VARIABLE COMPILE_VA_NULL_VAR
919 if(NOT COMPILE_VA_NULL_VAR)
920 string(REGEX REPLACE "\;" "" fctbis ${fct})
921 if(${fctbis} STREQUAL "va_copy((d),(s))")
923 set(ac_cv_va_copy "C99")
924 set(__VA_COPY_USE_C99 "va_copy((d),(s))")
927 if(${fctbis} STREQUAL "VA_COPY((d),(s))")
928 set(ac_cv_va_copy "GCM")
929 set(__VA_COPY_USE_GCM "VA_COPY((d),(s))")
932 if(${fctbis} STREQUAL "__va_copy((d),(s))")
933 set(ac_cv_va_copy "GCH")
934 set(__VA_COPY_USE_GCH "__va_copy((d),(s))")
937 if(${fctbis} STREQUAL "__builtin_va_copy((d),(s))")
938 set(ac_cv_va_copy "GCB")
939 set(__VA_COPY_USE_GCB "__builtin_va_copy((d),(s))")
942 if(${fctbis} STREQUAL "do { (d) = (s) } while (0)")
943 set(ac_cv_va_copy "ASS")
944 set(__VA_COPY_USE_ASS "do { (d) = (s); } while (0)")
947 if(${fctbis} STREQUAL "do { *(d) = *(s) } while (0)")
948 set(ac_cv_va_copy "ASP")
949 set(__VA_COPY_USE_ASP "do { *(d) = *(s); } while (0)")
952 if(${fctbis} STREQUAL "memcpy((void *)&(d), (void *)&(s), sizeof(s))")
953 set(ac_cv_va_copy "CPS")
954 set(__VA_COPY_USE_CPS "memcpy((void *)&(d), (void *)&(s), sizeof(s))")
957 if(${fctbis} STREQUAL "memcpy((void *)(d), (void *)(s), sizeof(*(s)))")
958 set(ac_cv_va_copy "CPP")
959 set(__VA_COPY_USE_CPP "memcpy((void *)(d), (void *)(s), sizeof(*(s)))")
963 set(__VA_COPY_USE "__VA_COPY_USE_${ac_cv_va_copy}(d, s)")
969 endforeach(fct ${diff_va})
971 #--------------------------------------------------------------------------------------------------
972 ### check for a working snprintf
973 if(HAVE_SNPRINTF AND HAVE_VSNPRINTF OR WIN32)
975 #set(HAVE_SNPRINTF 1)
976 #set(HAVE_VSNPRINTF 1)
979 if(CMAKE_CROSSCOMPILING)
980 set(RUN_SNPRINTF_FUNC "cross")
981 #set(PREFER_PORTABLE_SNPRINTF 1)
983 try_run(RUN_SNPRINTF_FUNC_VAR COMPILE_SNPRINTF_FUNC_VAR
985 ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_snprintf.c
989 if(CMAKE_CROSSCOMPILING)
990 set(RUN_VSNPRINTF_FUNC "cross")
991 set(PREFER_PORTABLE_VSNPRINTF 1)
993 try_run(RUN_VSNPRINTF_FUNC_VAR COMPILE_VSNPRINTF_FUNC_VAR
995 ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_vsnprintf.c
999 set(PREFER_PORTABLE_SNPRINTF 0)
1000 if(RUN_VSNPRINTF_FUNC_VAR MATCHES "FAILED_TO_RUN")
1001 set(PREFER_PORTABLE_SNPRINTF 1)
1003 if(RUN_SNPRINTF_FUNC_VAR MATCHES "FAILED_TO_RUN")
1004 set(PREFER_PORTABLE_SNPRINTF 1)
1008 ### check for asprintf function familly
1010 SET(simgrid_need_asprintf "")
1011 SET(NEED_ASPRINTF 0)
1013 SET(simgrid_need_asprintf "#define SIMGRID_NEED_ASPRINTF 1")
1014 SET(NEED_ASPRINTF 1)
1018 SET(simgrid_need_vasprintf "")
1019 SET(NEED_VASPRINTF 0)
1021 SET(simgrid_need_vasprintf "#define SIMGRID_NEED_VASPRINTF 1")
1022 SET(NEED_VASPRINTF 1)
1025 ### check for addr2line
1027 find_path(ADDR2LINE NAMES addr2line PATHS NO_DEFAULT_PATHS )
1029 set(ADDR2LINE "${ADDR2LINE}/addr2line")
1034 configure_file("${CMAKE_HOME_DIRECTORY}/src/context_sysv_config.h.in"
1035 "${CMAKE_BINARY_DIR}/src/context_sysv_config.h" @ONLY IMMEDIATE)
1037 SET( CMAKEDEFINE "#cmakedefine" )
1038 configure_file("${CMAKE_HOME_DIRECTORY}/tools/cmake/src/internal_config.h.in" "${CMAKE_BINARY_DIR}/src/internal_config.h" @ONLY IMMEDIATE)
1039 configure_file("${CMAKE_BINARY_DIR}/src/internal_config.h" "${CMAKE_BINARY_DIR}/src/internal_config.h" @ONLY IMMEDIATE)
1040 configure_file("${CMAKE_HOME_DIRECTORY}/include/simgrid_config.h.in" "${CMAKE_BINARY_DIR}/include/simgrid_config.h" @ONLY IMMEDIATE)
1042 set(top_srcdir "${CMAKE_HOME_DIRECTORY}")
1043 set(srcdir "${CMAKE_HOME_DIRECTORY}/src")
1044 set(bindir "${CMAKE_BINARY_DIR}")
1046 ### Script used when simgrid is installed
1047 set(exec_prefix ${CMAKE_INSTALL_PREFIX})
1048 set(includeflag "-I${CMAKE_INSTALL_PREFIX}/include -I${CMAKE_INSTALL_PREFIX}/include/smpi")
1049 set(includedir "${CMAKE_INSTALL_PREFIX}/include")
1050 set(libdir ${exec_prefix}/lib)
1051 set(CMAKE_SMPI_COMMAND "export LD_LIBRARY_PATH=\"${CMAKE_INSTALL_PREFIX}/lib")
1052 if(NS3_LIBRARY_PATH)
1053 set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${NS3_LIBRARY_PATH}")
1055 set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:\${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}\"")
1057 file(READ ${CMAKE_HOME_DIRECTORY}/src/smpi/smpitools.sh SMPITOOLS_SH)
1058 configure_file(${CMAKE_HOME_DIRECTORY}/include/smpi/mpif.h.in ${CMAKE_BINARY_DIR}/include/smpi/mpif.h @ONLY)
1059 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_BINARY_DIR}/bin/smpicc @ONLY)
1060 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicxx.in ${CMAKE_BINARY_DIR}/bin/smpicxx @ONLY)
1061 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpiff.in ${CMAKE_BINARY_DIR}/bin/smpiff @ONLY)
1062 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif90.in ${CMAKE_BINARY_DIR}/bin/smpif90 @ONLY)
1063 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpirun.in ${CMAKE_BINARY_DIR}/bin/smpirun @ONLY)
1065 ### Script used when simgrid is compiling
1066 set(includeflag "-I${CMAKE_HOME_DIRECTORY}/include -I${CMAKE_HOME_DIRECTORY}/include/smpi")
1067 set(includeflag "${includeflag} -I${CMAKE_BINARY_DIR}/include -I${CMAKE_BINARY_DIR}/include/smpi")
1068 set(includedir "${CMAKE_HOME_DIRECTORY}/include")
1069 set(exec_prefix "${CMAKE_BINARY_DIR}/smpi_script/")
1070 set(CMAKE_SMPI_COMMAND "export LD_LIBRARY_PATH=\"${CMAKE_BINARY_DIR}/lib")
1071 if(NS3_LIBRARY_PATH)
1072 set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${NS3_LIBRARY_PATH}")
1074 set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:\${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}\"")
1075 set(libdir "${CMAKE_BINARY_DIR}/lib")
1077 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc @ONLY)
1078 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicxx.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicxx @ONLY)
1079 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpiff.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff @ONLY)
1080 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif90.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpif90 @ONLY)
1081 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpirun.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun @ONLY)
1083 set(top_builddir ${CMAKE_HOME_DIRECTORY})
1086 execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpicc)
1087 execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpicxx)
1088 execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpiff)
1089 execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpif90)
1090 execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpirun)
1091 execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc)
1092 execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicxx)
1093 execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff)
1094 execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpif90)
1095 execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun)
1098 set(generated_headers_to_install
1099 ${CMAKE_CURRENT_BINARY_DIR}/include/smpi/mpif.h
1100 ${CMAKE_CURRENT_BINARY_DIR}/include/simgrid_config.h
1103 set(generated_headers
1104 ${CMAKE_CURRENT_BINARY_DIR}/src/context_sysv_config.h
1105 ${CMAKE_CURRENT_BINARY_DIR}/src/internal_config.h
1108 set(generated_files_to_clean
1109 ${generated_headers}
1110 ${generated_headers_to_install}
1111 ${CMAKE_BINARY_DIR}/bin/smpicc
1112 ${CMAKE_BINARY_DIR}/bin/smpicxx
1113 ${CMAKE_BINARY_DIR}/bin/smpiff
1114 ${CMAKE_BINARY_DIR}/bin/smpif90
1115 ${CMAKE_BINARY_DIR}/bin/smpirun
1116 ${CMAKE_BINARY_DIR}/bin/colorize
1117 ${CMAKE_BINARY_DIR}/bin/simgrid_update_xml
1118 ${CMAKE_BINARY_DIR}/examples/smpi/tracing/smpi_traced.trace
1121 if(NOT "${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_HOME_DIRECTORY}")
1122 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions0.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions0.txt COPYONLY)
1123 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions1.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions1.txt COPYONLY)
1124 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_allReduce.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allReduce.txt COPYONLY)
1125 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_barrier.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_barrier.txt COPYONLY)
1126 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_bcast.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_bcast.txt COPYONLY)
1127 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_with_isend.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_with_isend.txt COPYONLY)
1128 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_alltoall.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoall.txt COPYONLY)
1129 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_alltoallv.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoallv.txt COPYONLY)
1130 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_waitall.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_waitall.txt COPYONLY)
1131 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_reducescatter.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_reducescatter.txt COPYONLY)
1132 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_gather.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_gather.txt COPYONLY)
1133 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_allgatherv.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allgatherv.txt COPYONLY)
1134 configure_file(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/hostfile ${CMAKE_BINARY_DIR}/teshsuite/smpi/hostfile COPYONLY)
1136 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/description_file ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/description_file COPYONLY)
1137 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/README ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/README COPYONLY)
1138 configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/smpi_replay.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/smpi_replay.txt COPYONLY)
1139 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)
1140 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)
1141 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)
1142 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)
1143 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)
1144 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)
1145 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)
1146 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)
1147 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)
1148 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)
1149 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)
1150 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)
1151 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)
1152 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)
1153 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)
1154 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)
1155 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)
1156 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)
1157 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)
1158 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)
1159 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)
1160 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)
1161 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)
1162 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)
1163 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)
1164 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)
1165 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)
1166 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)
1167 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)
1168 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)
1169 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)
1170 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)
1172 set(generated_files_to_clean
1173 ${generated_files_to_clean}
1174 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions0.txt
1175 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions1.txt
1176 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allReduce.txt
1177 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_barrier.txt
1178 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_bcast.txt
1179 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_with_isend.txt
1180 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoall.txt
1181 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoallv.txt
1182 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_waitall.txt
1183 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_gather.txt
1184 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allgatherv.txt
1185 ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_reducescatter.txt
1186 ${CMAKE_BINARY_DIR}/teshsuite/smpi/hostfile
1187 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/description_file
1188 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/README
1189 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/smpi_replay.txt
1190 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace0.txt
1191 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace1.txt
1192 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace2.txt
1193 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace3.txt
1194 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace4.txt
1195 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace5.txt
1196 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace6.txt
1197 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace7.txt
1198 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace8.txt
1199 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace9.txt
1200 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace10.txt
1201 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace11.txt
1202 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace12.txt
1203 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace13.txt
1204 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace14.txt
1205 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace15.txt
1206 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace16.txt
1207 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace17.txt
1208 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace18.txt
1209 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace19.txt
1210 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace20.txt
1211 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace21.txt
1212 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace22.txt
1213 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace23.txt
1214 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace24.txt
1215 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace25.txt
1216 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace26.txt
1217 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace27.txt
1218 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace28.txt
1219 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace29.txt
1220 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace30.txt
1221 ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace31.txt
1225 SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
1226 "${generated_files_to_clean}")
1233 configure_file("${CMAKE_HOME_DIRECTORY}/tools/cmake/src/simgrid.nsi.in" "${CMAKE_BINARY_DIR}/simgrid.nsi" @ONLY IMMEDIATE)
1235 ### Define source packages for Libs
1236 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/DefinePackages.cmake)
1238 ### Build some Maintainer files
1239 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/MaintainerMode.cmake)
1240 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/UnitTesting.cmake)
1242 ### Setup gcc & clang flags
1244 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/GCCFlags.cmake)
1249 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/MakeLib.cmake)
1251 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/MakeLibWin.cmake)
1255 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Java.cmake)
1259 if(enable_memcheck_xml)
1260 set(enable_memcheck true)
1265 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Tests.cmake)
1266 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/CTestConfig.cmake)
1268 ### Define subdirectories
1269 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/MakeExe.cmake)
1271 ### Setup the distrib
1272 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Distrib.cmake)
1274 ### Build the doc (Windows downloads the doc instead of regenerating)
1277 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Documentation.cmake)
1279 find_program(WGET_PROGRAM NAMES wget)
1280 message(STATUS "wget: ${WGET_PROGRAM}")
1282 ADD_CUSTOM_TARGET(simgrid_documentation
1283 COMMENT "Downloading the SimGrid documentation..."
1284 COMMAND ${WGET_PROGRAM} -r -np -nH -nd http://simgrid.gforge.inria.fr/simgrid/${release_version}/doc/
1285 WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/doc/html
1291 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/PrintArgs.cmake)