Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add missing files -- sorry
[simgrid.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.6)
2 # Java requires 2.8.6
3 message(STATUS "Cmake version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}$")
4
5 project(SimGrid C CXX)
6
7 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
8 #     Check for the compiler        #
9 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
10
11 ### Need to set rc ccompiler before enable language
12 if(WIN32)
13   SET(CMAKE_RC_COMPILER "windres")
14 endif()
15
16 ## 
17 ## Check the C/C++ standard that we need
18 ##   See also tools/cmake/GCCFlags.cmake that sets our paranoid warning flags
19 if (MSVC)
20   message("-- You are compiling SimGrid with MicroSoft Visual C. Good luck.")
21
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")
24 else() # gcc or clang
25   INCLUDE(CheckCCompilerFlag)
26   CHECK_C_COMPILER_FLAG(-fstack-cleaner HAVE_C_STACK_CLEANER)
27
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")
32
33   if (CMAKE_COMPILER_IS_GNUCC)
34     if (COMPILER_CXX_VERSION_MAJOR_MINOR STRLESS "4.7")
35       message(FATAL_ERROR
36               "SimGrid needs at least g++ version 4.7 to compile "
37               "(c++11 support of previous versions is too limited).")
38     endif()
39   endif()
40
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")
46   else() 
47     message(FATAL_ERROR 
48             "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. "
49             "Please use a decent C++ compiler.")
50   endif()
51
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")
57   else()
58     message(FATAL_ERROR 
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).")
62   endif()
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)
67   endif()
68 endif() # NOT MSVC
69
70 ### SMPI vs. Fortran
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)
84
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)
90   endif()
91   CMAKE_FORCE_Fortran_COMPILER(smpiff smpiff)
92   enable_language(Fortran OPTIONAL)
93 endif()
94
95 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
96 #     Build the version number      #
97 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
98
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)
103
104 set(SIMGRID_VERSION_DATE  "2015") # Year for copyright information
105
106 if(${SIMGRID_VERSION_PATCH} EQUAL "0")
107   set(release_version "${SIMGRID_VERSION_MAJOR}.${SIMGRID_VERSION_MINOR}")
108 else()
109   set(release_version "${SIMGRID_VERSION_MAJOR}.${SIMGRID_VERSION_MINOR}.${SIMGRID_VERSION_PATCH}")
110 endif()
111
112 set(SIMGRID_VERSION_STRING "SimGrid version ${release_version}${SIMGRID_VERSION_EXTRA}")
113 set(SIMGRID_VERSION_BANNER "SIMGRID_VERSION_STRING\\nCopyright (c) 2004-${SIMGRID_VERSION_DATE}. The Simgrid Team.")
114 if(release)
115   set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER}\\nRelease build")
116 else()
117   set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER}\\nDevelopment build")
118 endif()
119
120 set(libsimgrid_version "${release_version}")
121 set(libsimgrid-java_version "${release_version}")
122
123 ### SET THE LIBRARY EXTENSION 
124 if(APPLE) #MAC
125   set(LIB_EXE "dylib")
126 else()
127   if(WIN32) #WINDOWS
128     set(LIB_EXE "a")
129     set(BIN_EXE ".exe")
130   else() #UNIX
131     set(LIB_EXE "so")
132   endif()
133 endif()
134
135 if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
136   exec_program("${CMAKE_C_COMPILER} --version" OUTPUT_VARIABLE "COMPILER_C_VERSION")
137   exec_program("${CMAKE_CXX_COMPILER} --version" OUTPUT_VARIABLE "COMPILER_CXX_VERSION")
138   string(REGEX MATCH "[0-9].[0-9].[0-9]" COMPILER_C_VERSION "${COMPILER_C_VERSION}")
139   string(REGEX MATCH "[0-9].[0-9].[0-9]" COMPILER_CXX_VERSION "${COMPILER_CXX_VERSION}")
140
141   string(REGEX MATCH "^[0-9].[0-9]" COMPILER_C_VERSION_MAJOR_MINOR "${COMPILER_C_VERSION}")
142   string(REPLACE "${COMPILER_C_VERSION_MAJOR_MINOR}." "" COMPILER_C_VERSION_PATCH "${COMPILER_C_VERSION}")  
143 endif()
144
145 exec_program("${CMAKE_LINKER} --version" OUTPUT_VARIABLE "LINKER_VERSION")
146 string(REGEX MATCH "[0-9].[0-9]*" LINKER_VERSION "${LINKER_VERSION}")
147
148 ### Find programs and paths
149 FIND_PROGRAM(GCOV_PATH gcov)
150 include(FindPerl)
151 if(NOT PERL_EXECUTABLE)
152   message(FATAL_ERROR "-- SimGrid cannot be compiled without Perl installed -- sorry. Bailling out.")
153 endif()
154
155 if (APPLE)
156   set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
157   set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
158 endif()
159
160 ### Set some variables for Cmake
161 SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
162
163 ### Compute the include paths
164 set(INCLUDES
165   ${CMAKE_HOME_DIRECTORY}
166   ${CMAKE_HOME_DIRECTORY}/include
167   ${CMAKE_HOME_DIRECTORY}/src
168   ${CMAKE_HOME_DIRECTORY}/src/include
169   ${CMAKE_BINARY_DIR}
170   ${CMAKE_BINARY_DIR}/include
171   ${CMAKE_BINARY_DIR}/src
172   )
173
174 if(WIN32)
175   set(INCLUDES ${INCLUDES} ${CMAKE_HOME_DIRECTORY}/include/xbt ${CMAKE_HOME_DIRECTORY}/src/xbt) #for win32_ucontext.[ch]
176 endif()
177
178 if(NOT CMAKE_CROSSCOMPILING AND EXISTS /usr/include/)
179   set(INCLUDES ${INCLUDES} /usr/include/)
180 endif()
181
182 ### Check 32bits or 64bits
183 IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
184   SET(ARCH_32_BITS 1)
185 ELSE()
186   SET(ARCH_32_BITS 0)
187 ENDIF()
188
189 if(WIN32)
190
191   #Need env INCLUDE
192   set(CMAKE_INCLUDE_WIN "${CMAKE_C_COMPILER}")
193   set(CMAKE_LIB_WIN "${CMAKE_C_COMPILER}")
194   string(REGEX REPLACE "/bin/gcc.*" "/include"  CMAKE_INCLUDE_WIN "${CMAKE_INCLUDE_WIN}")
195   string(REGEX REPLACE "/bin/gcc.*" "/lib"  CMAKE_LIB_WIN "${CMAKE_LIB_WIN}")
196   set(INCLUDES ${INCLUDES} ${CMAKE_INCLUDE_WIN})
197
198   if(CMAKE_COMPILER_IS_GNUCC)
199     set(__GNUC__ 1)
200     exec_program("${CMAKE_C_COMPILER} --version" OUTPUT_VARIABLE "COMPILER_C_VERSION")
201     string(REGEX MATCH "[0-9].[0-9].[0-9]" COMPILER_C_VERSION "${COMPILER_C_VERSION}")
202     string(REGEX MATCH "^[0-9]" COMPILER_C_MAJOR_VERSION "${COMPILER_C_VERSION}")
203     string(REGEX MATCH "^[0-9].[0-9]" COMPILER_C_MINOR_VERSION "${COMPILER_C_VERSION}")
204     string(REGEX REPLACE "^${COMPILER_C_MAJOR_VERSION}." "" COMPILER_C_MINOR_VERSION "${COMPILER_C_MINOR_VERSION}")
205   endif()
206
207   set(NSIS_WIN_VERSION $ENV{PROCESSOR_ARCHITEW6432})
208   if(NSIS_WIN_VERSION MATCHES "")
209     set(NSIS_WIN_VERSION $ENV{PROCESSOR_ARCHITECTURE})
210   endif()
211   if(${NSIS_WIN_VERSION})
212     string(TOLOWER ${NSIS_WIN_VERSION} NSIS_WIN_VERSION)
213   endif()
214
215   set(_XBT_WIN32 1)
216
217   message(STATUS "C_COMPILER                    ${CMAKE_C_COMPILER} ${COMPILER_C_VERSION_MAJOR_MINOR}")
218   message(STATUS "CXX_COMPILER                  ${CMAKE_CXX_COMPILER} ${COMPILER_CXX_VERSION_MAJOR_MINOR}")
219   message(STATUS "CMAKE_RC_COMPILER             ${CMAKE_RC_COMPILER}")
220   message(STATUS "INCLUDE                       ${CMAKE_INCLUDE_WIN}")
221   message(STATUS "LIB                           ${CMAKE_LIB_WIN}")
222   message(STATUS "MAKE_PROGRAM                  ${CMAKE_MAKE_PROGRAM}")
223   message(STATUS "CMAKE_BUILD_TOOL              ${CMAKE_BUILD_TOOL}")
224   message(STATUS "LINKER                        ${CMAKE_LINKER}")
225   message(STATUS "CMAKE_GENERATOR               ${CMAKE_GENERATOR}")
226   message(STATUS "GNUC                          ${CMAKE_COMPILER_IS_GNUCC}")
227
228 endif()
229
230 include_directories(${INCLUDES})
231
232 ### Setup Options
233 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Option.cmake)
234
235 set(CMAKE_MODULE_PATH
236   ${CMAKE_MODULE_PATH}
237   ${CMAKE_HOME_DIRECTORY}/tools/cmake/Modules
238   )
239
240 ### Determine the assembly flavor that we need today
241 include(CMakeDetermineSystem)
242 IF(CMAKE_SYSTEM_PROCESSOR MATCHES ".86|AMD64|amd64")
243   IF(${ARCH_32_BITS})
244     message(STATUS "System processor: i686 (${CMAKE_SYSTEM_PROCESSOR}, 32 bits)")
245     set(PROCESSOR_i686 1)
246   ELSE()
247     message(STATUS "System processor: x86_64 (${CMAKE_SYSTEM_PROCESSOR}, 64 bits)")
248     set(PROCESSOR_x86_64 1)
249   ENDIF()
250   if (MSVC)
251     message(STATUS "Disable fast raw contextes on Microsoft Visual.")
252   else()
253     set(HAVE_RAWCTX 1)
254   endif()
255
256 ENDIF()
257
258 if(ARCH_32_BITS)
259   set(MPI_ADDRESS_SIZE 4)
260 else()
261   set(MPI_ADDRESS_SIZE 8)
262 endif()
263
264 include(CheckFunctionExists)
265 include(CheckTypeSize)
266 include(CheckIncludeFile)
267 include(CheckIncludeFiles)
268 include(CheckLibraryExists)
269 include(CheckSymbolExists)
270
271 include(FindGraphviz)
272 include(FindLibSigc++)
273
274 if(enable_java)
275   find_package(Java REQUIRED COMPONENTS Runtime Development)
276   find_package(JNI REQUIRED)
277   message("-- [Java] JNI found: ${JNI_FOUND}")
278   message("-- [Java] JNI include dirs: ${JNI_INCLUDE_DIRS}")
279   if(enable_maintainer_mode)
280     find_package(SWIG REQUIRED)
281     include(UseSWIG)
282     message("-- [Java] Swig found: ${SWIG_FOUND} (version ${SWIG_VERSION})")
283   endif()
284   set(HAVE_Java 1)
285 endif()
286 if(enable_scala)
287   find_package(Scala REQUIRED)
288   message("-- [Scala] scalac found: ${SCALA_COMPILE}")
289   set(HAVE_Scala 1)
290 endif()
291 if(enable_lua)
292   include(FindLuaSimgrid)
293 endif()
294
295 set(HAVE_NS3 0)
296 if(enable_ns3)
297   include(FindNS3)
298   if (NOT HAVE_NS3)
299     message(FATAL_ERROR "Cannot find NS3. Please install it (apt-get install ns3 libns3-dev) or disable that cmake option")
300   endif()
301 endif()
302
303 find_package(Boost 1.48)
304 if(Boost_FOUND)
305   include_directories(${Boost_INCLUDE_DIRS})
306 else()
307   if(APPLE)
308     message(FATAL_ERROR "Failed to find Boost libraries (Try to install them with 'sudo fink install boost1.53.nopython')")
309   else()
310     message(FATAL_ERROR "Failed to find Boost libraries."
311                         "Did you install libboost-dev and libboost-context-dev?"
312                         "(libboost-context-dev is optional)")
313   endif()
314 endif()
315
316 # Try again to see if we have libboost-context
317 find_package(Boost 1.42 COMPONENTS context)
318 set(Boost_FOUND 1) # We don't care of whether this component is missing
319
320 if(Boost_FOUND AND Boost_CONTEXT_FOUND)
321   # We should use feature detection for this instead:
322   if (Boost_VERSION LESS 105600)
323     message("Found Boost.Context API v1")
324     set(HAVE_BOOST_CONTEXT 1)
325   else()
326     message("Found Boost.Context API v2")
327     set(HAVE_BOOST_CONTEXT 2)
328   endif()
329 else()
330   message ("   boost        : found.")
331   message ("   boost-context: missing. Install libboost-context-dev for this optional feature.")
332   set(HAVE_BOOST_CONTEXT 0)
333 endif()
334
335 # Checks for header libraries functions.
336 CHECK_LIBRARY_EXISTS(dl      dlopen                  "" HAVE_DLOPEN_IN_LIBDL)
337 CHECK_LIBRARY_EXISTS(execinfo backtrace              "" HAVE_BACKTRACE_IN_LIBEXECINFO)
338 CHECK_LIBRARY_EXISTS(pthread pthread_create          "" HAVE_PTHREAD)
339 CHECK_LIBRARY_EXISTS(pthread sem_init                "" HAVE_SEM_INIT_LIB)
340 CHECK_LIBRARY_EXISTS(pthread sem_open                "" HAVE_SEM_OPEN_LIB)
341 CHECK_LIBRARY_EXISTS(pthread sem_timedwait           "" HAVE_SEM_TIMEDWAIT_LIB)
342 CHECK_LIBRARY_EXISTS(pthread pthread_mutex_timedlock "" HAVE_MUTEX_TIMEDLOCK_LIB)
343 CHECK_LIBRARY_EXISTS(rt      clock_gettime           "" HAVE_POSIX_GETTIME)
344
345 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
346   set(CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700 -D_DARWIN_C_SOURCE")
347 elseif(MINGW)
348   add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
349   set(CMAKE_REQUIRED_DEFINITIONS "-D__USE_MINGW_ANSI_STDIO=1")
350 else()
351   set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
352 endif()
353
354 CHECK_INCLUDE_FILES("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)
355 CHECK_INCLUDE_FILE("valgrind/valgrind.h" HAVE_VALGRIND_VALGRIND_H)
356 CHECK_INCLUDE_FILE("socket.h" HAVE_SOCKET_H)
357 CHECK_INCLUDE_FILE("stat.h" HAVE_STAT_H)
358 CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
359 CHECK_INCLUDE_FILE("windows.h" HAVE_WINDOWS_H)
360 CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H)
361 CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
362 CHECK_INCLUDE_FILE("execinfo.h" HAVE_EXECINFO_H)
363 CHECK_INCLUDE_FILE("signal.h" HAVE_SIGNAL_H)
364 CHECK_INCLUDE_FILE("sys/time.h" HAVE_SYS_TIME_H)
365 CHECK_INCLUDE_FILE("sys/param.h" HAVE_SYS_PARAM_H)
366 CHECK_INCLUDE_FILE("sys/sysctl.h" HAVE_SYS_SYSCTL_H)
367 CHECK_INCLUDE_FILE("time.h" HAVE_TIME_H)
368 CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H)
369 CHECK_INCLUDE_FILE("ucontext.h" HAVE_UCONTEXT_H)
370 CHECK_INCLUDE_FILE("stdio.h" HAVE_STDIO_H)
371 CHECK_INCLUDE_FILE("linux/futex.h" HAVE_FUTEX_H)
372
373 CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
374 CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)
375 CHECK_FUNCTION_EXISTS(getdtablesize HAVE_GETDTABLESIZE)
376 CHECK_FUNCTION_EXISTS(sysconf HAVE_SYSCONF)
377 CHECK_FUNCTION_EXISTS(readv HAVE_READV)
378 CHECK_FUNCTION_EXISTS(popen HAVE_POPEN)
379 CHECK_FUNCTION_EXISTS(signal HAVE_SIGNAL)
380
381 CHECK_SYMBOL_EXISTS(snprintf stdio.h HAVE_SNPRINTF)
382 CHECK_SYMBOL_EXISTS(vsnprintf stdio.h HAVE_VSNPRINTF)
383 CHECK_SYMBOL_EXISTS(asprintf stdio.h HAVE_ASPRINTF)
384 CHECK_SYMBOL_EXISTS(vasprintf stdio.h HAVE_VASPRINTF)
385
386 if(MINGW) 
387   # The detection of asprintf fails on MinGW, assumingly because it's
388   # defined as an inline function in stdio.h instead of a regular
389   # function. So force the result to be 1 despite of the test.
390   set(HAVE_SNPRINTF 1)
391   set(HAVE_VSNPRINTF 1)
392   set(HAVE_ASPRINTF 1)
393   set(HAVE_VASPRINTF 1)
394 endif()
395
396 CHECK_FUNCTION_EXISTS(makecontext HAVE_MAKECONTEXT)
397 CHECK_FUNCTION_EXISTS(process_vm_readv HAVE_PROCESS_VM_READV)
398
399 CHECK_FUNCTION_EXISTS(mmap HAVE_MMAP)
400
401 #Check if __thread is defined
402 execute_process(
403   COMMAND "${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_thread_storage.c"
404   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
405   RESULT_VARIABLE HAVE_thread_storage_run
406   )
407
408 if(HAVE_thread_storage_run)
409   set(HAVE_THREAD_LOCAL_STORAGE 1)
410 else()
411   set(HAVE_THREAD_LOCAL_STORAGE 0)
412 endif()
413
414 # Our usage of mmap is Linux-specific (flag MAP_ANONYMOUS), but kFreeBSD uses a GNU libc
415 IF(HAVE_MMAP AND
416    NOT "${CMAKE_SYSTEM}" MATCHES "Linux" AND 
417    NOT "${CMAKE_SYSTEM}" MATCHES "kFreeBSD" AND 
418    NOT "${CMAKE_SYSTEM}" MATCHES "GNU" AND 
419    NOT  "${CMAKE_SYSTEM}" MATCHES "Darwin")
420   SET(HAVE_MMAP 0)
421   message(STATUS "Warning: MMAP is thought as non functional on this architecture (${CMAKE_SYSTEM})")
422 ENDIF()
423
424 if(HAVE_MMAP AND HAVE_THREAD_LOCAL_STORAGE)
425   SET(HAVE_MMALLOC 1)
426 else()
427   SET(HAVE_MMALLOC 0)
428 endif()
429
430
431 if(WIN32) # Those files are not detected despite being present
432   set(HAVE_UCONTEXT_H 1)
433   set(HAVE_MAKECONTEXT 1)
434 endif()
435
436 set(CONTEXT_UCONTEXT 0)
437 set(CONTEXT_THREADS 0)
438
439 if(enable_jedule)
440   set(HAVE_JEDULE 1)
441 endif()
442
443 if(enable_latency_bound_tracking)
444   SET(HAVE_LATENCY_BOUND_TRACKING 1)
445 else()
446   SET(HAVE_LATENCY_BOUND_TRACKING 0)
447 endif()
448
449 if(enable_mallocators)
450   SET(MALLOCATOR_IS_WANTED 1)
451 else()
452   SET(MALLOCATOR_IS_WANTED 0)
453 endif()
454
455 if(enable_model-checking AND HAVE_MMALLOC)
456   SET(HAVE_MC 1)
457   SET(MMALLOC_WANT_OVERRIDE_LEGACY 1)
458   include(FindLibunwind)
459   include(FindLibdw)
460 else()
461   if(enable_model-checking)
462     message(STATUS "Warning: support for model-checking has been disabled because HAVE_MMALLOC is false")
463   endif()
464   SET(HAVE_MC 0)
465   SET(HAVE_MMALLOC 0)
466   SET(MMALLOC_WANT_OVERRIDE_LEGACY 0)
467 endif()
468
469 if(enable_smpi)
470   include(FindGFortran)
471   #really checks for objdump for privatization
472   find_package(BinUtils QUIET)
473   SET(HAVE_SMPI 1)
474
475   if( NOT "${CMAKE_OBJDUMP}" MATCHES "CMAKE_OBJDUMP-NOTFOUND" AND HAVE_MMAP)
476     SET(HAVE_PRIVATIZATION 1)
477   else()
478     SET(HAVE_PRIVATIZATION 0)
479   endif()
480 endif()
481
482 #--------------------------------------------------------------------------------------------------
483 ### Check for GNU dynamic linker
484 CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
485 if (HAVE_DLFCN_H)
486     if(HAVE_DLOPEN_IN_LIBDL)
487       set(DL_LIBRARY "-ldl")
488     endif(HAVE_DLOPEN_IN_LIBDL)
489     execute_process(COMMAND ${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_gnu_dynlinker.c ${DL_LIBRARY} -o test_gnu_ld
490       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
491       OUTPUT_VARIABLE HAVE_GNU_LD_compil
492     )
493     if(HAVE_GNU_LD_compil)
494       set(HAVE_GNU_LD 0)
495       message(STATUS "Warning: test program toward GNU ld failed to compile:")
496       message(STATUS "${HAVE_GNU_LD_comp_output}")
497     else()
498
499       execute_process(COMMAND ./test_gnu_ld
500           WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
501           RESULT_VARIABLE HAVE_GNU_LD_run
502           OUTPUT_VARIABLE var_exec
503       )
504
505       if(NOT HAVE_GNU_LD_run)
506         set(HAVE_GNU_LD 1)
507         message(STATUS "We are using GNU dynamic linker")
508       else()
509         set(HAVE_GNU_LD 0)
510         message(STATUS "Warning: error while checking for GNU ld:")
511         message(STATUS "Test output: '${var_exec}'")
512         message(STATUS "Exit status: ${HAVE_GNU_LD_run}")
513       endif()
514       file(REMOVE test_gnu_ld)
515     endif()
516 endif()
517
518
519 #--------------------------------------------------------------------------------------------------
520 ### Initialize of CONTEXT THREADS
521
522 if(HAVE_PTHREAD)
523   ### Test that we have a way to create semaphores
524
525   if(HAVE_SEM_OPEN_LIB)
526     execute_process(COMMAND ${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_sem_open.c -lpthread -o sem_open
527     WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
528     OUTPUT_VARIABLE HAVE_SEM_OPEN_compil
529     )
530
531     # Test sem_open by compiling:
532     if(HAVE_SEM_OPEN_compil)
533       set(HAVE_SEM_OPEN 0)
534       message(STATUS "Warning: sem_open not compilable")
535       message(STATUS "HAVE_SEM_OPEN_comp_output: ${HAVE_SEM_OPEN_comp_output}")
536     else()
537       set(HAVE_SEM_OPEN 1)
538       message(STATUS "sem_open is compilable")
539     endif()
540
541     # If we're not crosscompiling, we check by executing the program:
542     if (HAVE_SEM_OPEN AND NOT CMAKE_CROSSCOMPILING)
543       execute_process(COMMAND ./sem_open
544       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
545       RESULT_VARIABLE HAVE_SEM_OPEN_run
546       OUTPUT_VARIABLE var_compil
547       )
548       if (NOT HAVE_SEM_OPEN_run)
549         set(HAVE_SEM_OPEN 1)
550         message(STATUS "sem_open is executable")
551       else()
552         set(HAVE_SEM_OPEN 0)
553         if(EXISTS "${CMAKE_BINARY_DIR}/sem_open")
554           message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_open exists!")
555         else()
556           message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_open not exists!")
557         endif()
558         message(STATUS "Warning: sem_open not executable")
559         message(STATUS "Compilation output: '${var_compil}'")
560         message(STATUS "Exit result of sem_open: ${HAVE_SEM_OPEN_run}")
561       endif()
562     endif()
563     file(REMOVE sem_open)
564
565   else()
566     set(HAVE_SEM_OPEN 0)
567   endif()
568
569   if(HAVE_SEM_INIT_LIB)
570     execute_process(COMMAND ${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_sem_init.c -lpthread -o sem_init
571     WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
572     RESULT_VARIABLE HAVE_SEM_INIT_run OUTPUT_VARIABLE HAVE_SEM_INIT_compil)
573
574     # Test sem_init by compiling:
575     if(HAVE_SEM_INIT_compil)
576       set(HAVE_SEM_INIT 0)
577       message(STATUS "Warning: sem_init not compilable")
578       message(STATUS "HAVE_SEM_INIT_comp_output: ${HAVE_SEM_OPEN_comp_output}")
579     else()
580       set(HAVE_SEM_INIT 1)
581       message(STATUS "sem_init is compilable")
582     endif()
583
584     # If we're not crosscompiling, we check by executing the program:
585     if (HAVE_SEM_INIT AND NOT CMAKE_CROSSCOMPILING)
586       execute_process(COMMAND ./sem_init
587       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
588       RESULT_VARIABLE HAVE_SEM_INIT_run
589       OUTPUT_VARIABLE var_compil
590       )
591       if (NOT HAVE_SEM_INIT_run)
592         set(HAVE_SEM_INIT 1)
593         message(STATUS "sem_init is executable")
594       else()
595         set(HAVE_SEM_INIT 0)
596         if(EXISTS "${CMAKE_BINARY_DIR}/sem_init")
597           message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_init exists!")
598         else()
599           message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_init not exists!")
600         endif()
601         message(STATUS "Warning: sem_init not executable")
602         message(STATUS "Compilation output: '${var_compil}'")
603         message(STATUS "Exit result of sem_init: ${HAVE_SEM_INIT_run}")
604       endif()
605     endif()
606     file(REMOVE sem_init)
607   endif()
608
609   if(NOT HAVE_SEM_OPEN AND NOT HAVE_SEM_INIT)
610     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).")
611   endif()
612
613   ### Test that we have a way to timewait for semaphores
614
615   if(HAVE_SEM_TIMEDWAIT_LIB)
616
617     execute_process(
618       COMMAND "${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_sem_timedwait.c -lpthread"
619       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
620       OUTPUT_VARIABLE HAVE_SEM_TIMEDWAIT_run
621       )
622
623     if(HAVE_SEM_TIMEDWAIT_run)
624       set(HAVE_SEM_TIMEDWAIT 0)
625       message(STATUS "timedwait not compilable")
626     else()
627       set(HAVE_SEM_TIMEDWAIT 1)
628       message(STATUS "timedwait is compilable")
629     endif()
630   endif()
631
632   ### HAVE_MUTEX_TIMEDLOCK
633
634   if(HAVE_MUTEX_TIMEDLOCK_LIB)
635
636     execute_process(
637       COMMAND "${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_mutex_timedlock.c -lpthread"
638       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
639       OUTPUT_VARIABLE HAVE_MUTEX_TIMEDLOCK_run
640       )
641
642     if(HAVE_MUTEX_TIMEDLOCK_run)
643       set(HAVE_MUTEX_TIMEDLOCK 0)
644       message(STATUS "timedlock not compilable")
645     else()
646       message(STATUS "timedlock is compilable")
647       set(HAVE_MUTEX_TIMEDLOCK 1)
648     endif()
649   endif()
650 endif()
651
652 # This is needed for ucontext on MacOS X:
653 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
654   add_definitions(-D_XOPEN_SOURCE=700 -D_DARWIN_C_SOURCE)
655 endif()
656
657 if(WIN32)
658   # We always provide our own implementation of ucontext on Windows.
659   try_compile(HAVE_UCONTEXT
660     ${CMAKE_BINARY_DIR}
661     ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_AC_CHECK_MCSC.c
662     COMPILE_DEFINITIONS _XBT_WIN32
663     INCLUDE_DIRECTORIES
664       ${CMAKE_HOME_DIRECTORY}/src/include
665       ${CMAKE_HOME_DIRECTORY}/src/xbt
666   )
667 else()
668   # We always provide our own implementation of ucontext on Windows.
669   try_compile(HAVE_UCONTEXT
670     ${CMAKE_BINARY_DIR}
671     ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_AC_CHECK_MCSC.c)
672 endif()
673
674 #If can have both context
675
676 if(HAVE_UCONTEXT)
677   set(CONTEXT_UCONTEXT 1)
678   message("-- Support for ucontext factory")
679 endif()
680
681 if(HAVE_PTHREAD)
682   set(CONTEXT_THREADS 1)
683   message("-- Support for thread context factory")
684 endif()
685
686 ###############
687 ## GIT version check
688 ##
689 if(EXISTS ${CMAKE_HOME_DIRECTORY}/.git/)
690   execute_process(COMMAND git remote
691   COMMAND head -n 1
692   WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
693   OUTPUT_VARIABLE remote
694   RESULT_VARIABLE ret
695   )
696   string(REPLACE "\n" "" remote "${remote}")
697   #message(STATUS "Git remote: ${remote}")
698   execute_process(COMMAND git config --get remote.${remote}.url
699   WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
700   OUTPUT_VARIABLE url
701   RESULT_VARIABLE ret
702   )
703   string(REPLACE "\n" "" url "${url}")
704   #message(STATUS "Git url: ${url}")
705   if(url)
706     execute_process(COMMAND git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log --pretty=oneline --abbrev-commit -1
707     WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
708     OUTPUT_VARIABLE GIT_VERSION
709     RESULT_VARIABLE ret
710     )
711     string(REPLACE "\n" "" GIT_VERSION "${GIT_VERSION}")
712     message(STATUS "Git version: ${GIT_VERSION}")
713     execute_process(COMMAND git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log -n 1 --pretty=format:%ai .
714     WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
715     OUTPUT_VARIABLE GIT_DATE
716     RESULT_VARIABLE ret
717     )
718     string(REPLACE "\n" "" GIT_DATE "${GIT_DATE}")
719     message(STATUS "Git date: ${GIT_DATE}")
720     string(REGEX REPLACE " .*" "" GIT_VERSION "${GIT_VERSION}")
721     
722     execute_process(COMMAND git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log --pretty=format:%H -1
723                     WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
724                     OUTPUT_VARIABLE SIMGRID_GITHASH
725                     RESULT_VARIABLE ret
726                     )
727     string(REPLACE "\n" "" SIMGRID_GITHASH "${SIMGRID_GITHASH}")
728                     
729   endif()
730 elseif(EXISTS ${CMAKE_HOME_DIRECTORY}/.gitversion)
731   FILE(STRINGS ${CMAKE_HOME_DIRECTORY}/.gitversion GIT_VERSION)
732 endif()
733
734 if(GIT_VERSION)
735   set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER} at commit ${GIT_VERSION}")
736 endif()
737 if(GIT_DATE)
738   set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER} (${GIT_DATE})")
739 endif()
740 #--------------------------------------------------------------------------------------------------
741
742 set(makecontext_CPPFLAGS_2 "")
743 if(HAVE_MAKECONTEXT OR WIN32)
744   set(makecontext_CPPFLAGS "-DTEST_makecontext")
745   if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
746     set(makecontext_CPPFLAGS_2 "-D_XOPEN_SOURCE=700")
747   endif()
748
749   if(WIN32)
750     if(ARCH_32_BITS)
751       set(makecontext_CPPFLAGS "-DTEST_makecontext -D_I_X86_")
752     else()
753       set(makecontext_CPPFLAGS "-DTEST_makecontext -D_AMD64_")
754     endif()
755     set(makecontext_CPPFLAGS_2 "-D_XBT_WIN32 -I${CMAKE_HOME_DIRECTORY}/src/include -I${CMAKE_HOME_DIRECTORY}/src/xbt")
756   endif()
757
758   file(REMOVE ${CMAKE_BINARY_DIR}/conftestval)
759
760   if(CMAKE_CROSSCOMPILING)
761     set(RUN_makecontext_VAR "cross")
762     set(COMPILE_makecontext_VAR "cross")
763   else()
764     try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR
765       ${CMAKE_BINARY_DIR}
766       ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_stacksetup.c
767       COMPILE_DEFINITIONS "${makecontext_CPPFLAGS} ${makecontext_CPPFLAGS_2}"
768       )
769   endif()
770
771   if(EXISTS ${CMAKE_BINARY_DIR}/conftestval)
772     file(READ ${CMAKE_BINARY_DIR}/conftestval MAKECONTEXT_ADDR_SIZE)
773     string(REPLACE "\n" "" MAKECONTEXT_ADDR_SIZE "${MAKECONTEXT_ADDR_SIZE}")
774     string(REGEX MATCH ;^.*,;MAKECONTEXT_ADDR "${MAKECONTEXT_ADDR_SIZE}")
775     string(REGEX MATCH ;,.*$; MAKECONTEXT_SIZE "${MAKECONTEXT_ADDR_SIZE}")
776     string(REPLACE "," "" makecontext_addr "${MAKECONTEXT_ADDR}")
777     string(REPLACE "," "" makecontext_size "${MAKECONTEXT_SIZE}")
778     set(pth_skaddr_makecontext "#define pth_skaddr_makecontext(skaddr,sksize) (${makecontext_addr})")
779     set(pth_sksize_makecontext "#define pth_sksize_makecontext(skaddr,sksize) (${makecontext_size})")
780   else()
781     # message(FATAL_ERROR "makecontext is not compilable")
782   endif()
783 endif()
784
785 #--------------------------------------------------------------------------------------------------
786
787 ### check for stackgrowth
788 if (NOT CMAKE_CROSSCOMPILING)
789   try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR
790     ${CMAKE_BINARY_DIR}
791     ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_stackgrowth.c
792     RUN_OUTPUT_VARIABLE stack
793     )
794 endif()
795 if("${stack}" STREQUAL "down")
796   set(PTH_STACKGROWTH "-1")
797 elseif("${stack}" STREQUAL "up")
798   set(PTH_STACKGROWTH "1")
799 else()
800   if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
801     set(PTH_STACKGROWTH "-1")
802   elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686")
803     set(PTH_STACKGROWTH "-1")
804   else()
805     message(ERROR "Could not figure the stack direction.")
806   endif()
807 endif()
808
809 ###############
810 ## System checks
811 ##
812
813 #SG_CONFIGURE_PART([System checks...])
814 #AC_PROG_CC(xlC gcc cc) -auto
815 #AM_SANITY_CHECK -auto
816
817 #AC_PROG_MAKE_SET
818
819 #AC_CHECK_VA_COPY
820
821 set(diff_va "va_copy((d),(s))"
822   "VA_COPY((d),(s))"
823   "__va_copy((d),(s))"
824   "__builtin_va_copy((d),(s))"
825   "do { (d) = (s)\; } while (0)"
826   "do { *(d) = *(s)\; } while (0)"
827   "memcpy((void *)&(d), (void *)&(s), sizeof(s))"
828   "memcpy((void *)(d), (void *)(s), sizeof(*(s)))"
829   )
830
831 foreach(fct ${diff_va})
832   write_file("${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_va_copy.c" "#include <stdlib.h>
833 #include <stdarg.h>
834 #include <string.h>
835 #define DO_VA_COPY(d,s) ${fct}
836 void test(char *str, ...)
837 {
838   va_list ap, ap2;
839   int i;
840   va_start(ap, str);
841   DO_VA_COPY(ap2, ap);
842   for (i = 1; i <= 9; i++) {
843     int k = (int)va_arg(ap, int);
844     if (k != i)
845       abort();
846   }
847   DO_VA_COPY(ap, ap2);
848   for (i = 1; i <= 9; i++) {
849     int k = (int)va_arg(ap, int);
850     if (k != i)
851       abort();
852   }
853   va_end(ap);
854 }
855 int main(void)
856 {
857   test(\"test\", 1, 2, 3, 4, 5, 6, 7, 8, 9);
858   exit(0);
859 }"
860     )
861
862   execute_process(
863   COMMAND ${CMAKE_C_COMPILER} "${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_va_copy.c"
864   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
865   RESULT_VARIABLE COMPILE_VA_NULL_VAR
866   OUTPUT_QUIET
867   ERROR_QUIET
868   )
869
870   if(NOT COMPILE_VA_NULL_VAR)
871     string(REGEX REPLACE "\;" "" fctbis ${fct})
872     if(${fctbis} STREQUAL "va_copy((d),(s))")
873       set(HAVE_VA_COPY 1)
874       set(ac_cv_va_copy "C99")
875       set(__VA_COPY_USE_C99 "va_copy((d),(s))")
876     endif()
877
878     if(${fctbis} STREQUAL "VA_COPY((d),(s))")
879       set(ac_cv_va_copy "GCM")
880       set(__VA_COPY_USE_GCM "VA_COPY((d),(s))")
881     endif()
882
883     if(${fctbis} STREQUAL "__va_copy((d),(s))")
884       set(ac_cv_va_copy "GCH")
885       set(__VA_COPY_USE_GCH "__va_copy((d),(s))")
886     endif()
887
888     if(${fctbis} STREQUAL "__builtin_va_copy((d),(s))")
889       set(ac_cv_va_copy "GCB")
890       set(__VA_COPY_USE_GCB "__builtin_va_copy((d),(s))")
891     endif()
892
893     if(${fctbis} STREQUAL "do { (d) = (s) } while (0)")
894       set(ac_cv_va_copy "ASS")
895       set(__VA_COPY_USE_ASS "do { (d) = (s); } while (0)")
896     endif()
897
898     if(${fctbis} STREQUAL "do { *(d) = *(s) } while (0)")
899       set(ac_cv_va_copy "ASP")
900       set(__VA_COPY_USE_ASP "do { *(d) = *(s); } while (0)")
901     endif()
902
903     if(${fctbis} STREQUAL "memcpy((void *)&(d), (void *)&(s), sizeof(s))")
904       set(ac_cv_va_copy "CPS")
905       set(__VA_COPY_USE_CPS "memcpy((void *)&(d), (void *)&(s), sizeof(s))")
906     endif()
907
908     if(${fctbis} STREQUAL "memcpy((void *)(d), (void *)(s), sizeof(*(s)))")
909       set(ac_cv_va_copy "CPP")
910       set(__VA_COPY_USE_CPP "memcpy((void *)(d), (void *)(s), sizeof(*(s)))")
911     endif()
912
913     if(NOT STATUS_OK)
914       set(__VA_COPY_USE "__VA_COPY_USE_${ac_cv_va_copy}(d, s)")
915     endif()
916     set(STATUS_OK "1")
917
918   endif()
919
920 endforeach(fct ${diff_va})
921
922 #--------------------------------------------------------------------------------------------------
923 ### check for a working snprintf
924 if(HAVE_SNPRINTF AND HAVE_VSNPRINTF OR WIN32)
925   if(WIN32)
926     #set(HAVE_SNPRINTF 1)
927     #set(HAVE_VSNPRINTF 1)
928   endif()
929
930   if(CMAKE_CROSSCOMPILING)
931     set(RUN_SNPRINTF_FUNC "cross")
932     #set(PREFER_PORTABLE_SNPRINTF 1)
933   else()
934     try_run(RUN_SNPRINTF_FUNC_VAR COMPILE_SNPRINTF_FUNC_VAR
935       ${CMAKE_BINARY_DIR}
936       ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_snprintf.c
937       )
938   endif()
939
940   if(CMAKE_CROSSCOMPILING)
941     set(RUN_VSNPRINTF_FUNC "cross")
942     set(PREFER_PORTABLE_VSNPRINTF 1)
943   else()
944     try_run(RUN_VSNPRINTF_FUNC_VAR COMPILE_VSNPRINTF_FUNC_VAR
945       ${CMAKE_BINARY_DIR}
946       ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_vsnprintf.c
947       )
948   endif()
949
950   set(PREFER_PORTABLE_SNPRINTF 0)
951   if(RUN_VSNPRINTF_FUNC_VAR MATCHES "FAILED_TO_RUN")
952     set(PREFER_PORTABLE_SNPRINTF 1)
953   endif()
954   if(RUN_SNPRINTF_FUNC_VAR MATCHES "FAILED_TO_RUN")
955     set(PREFER_PORTABLE_SNPRINTF 1)
956   endif()
957 endif()
958
959 ### check for asprintf function familly
960 if(HAVE_ASPRINTF)
961   SET(simgrid_need_asprintf "")
962   SET(NEED_ASPRINTF 0)
963 else()
964   SET(simgrid_need_asprintf "#define SIMGRID_NEED_ASPRINTF 1")
965   SET(NEED_ASPRINTF 1)
966 endif()
967
968 if(HAVE_VASPRINTF)
969   SET(simgrid_need_vasprintf "")
970   SET(NEED_VASPRINTF 0)
971 else()
972   SET(simgrid_need_vasprintf "#define SIMGRID_NEED_VASPRINTF 1")
973   SET(NEED_VASPRINTF 1)
974 endif()
975
976 ### check for addr2line
977
978 find_path(ADDR2LINE NAMES addr2line     PATHS NO_DEFAULT_PATHS  )
979 if(ADDR2LINE)
980   set(ADDR2LINE "${ADDR2LINE}/addr2line")
981 endif()
982
983 ### File to create
984
985 configure_file("${CMAKE_HOME_DIRECTORY}/src/context_sysv_config.h.in"
986   "${CMAKE_BINARY_DIR}/src/context_sysv_config.h" @ONLY IMMEDIATE)
987
988 SET( CMAKEDEFINE "#cmakedefine" )
989 configure_file("${CMAKE_HOME_DIRECTORY}/tools/cmake/src/internal_config.h.in" "${CMAKE_BINARY_DIR}/src/internal_config.h" @ONLY IMMEDIATE)
990 configure_file("${CMAKE_BINARY_DIR}/src/internal_config.h" "${CMAKE_BINARY_DIR}/src/internal_config.h" @ONLY IMMEDIATE)
991 configure_file("${CMAKE_HOME_DIRECTORY}/include/simgrid_config.h.in" "${CMAKE_BINARY_DIR}/include/simgrid_config.h" @ONLY IMMEDIATE)
992
993 set(top_srcdir "${CMAKE_HOME_DIRECTORY}")
994 set(srcdir "${CMAKE_HOME_DIRECTORY}/src")
995 set(bindir "${CMAKE_BINARY_DIR}")
996
997 ### Script used when simgrid is installed
998 set(exec_prefix ${CMAKE_INSTALL_PREFIX})
999 set(includeflag "-I${CMAKE_INSTALL_PREFIX}/include -I${CMAKE_INSTALL_PREFIX}/include/smpi")
1000 set(includedir "${CMAKE_INSTALL_PREFIX}/include")
1001 set(libdir ${exec_prefix}/lib)
1002 set(CMAKE_SMPI_COMMAND "export LD_LIBRARY_PATH=\"${CMAKE_INSTALL_PREFIX}/lib")
1003 if(NS3_LIBRARY_PATH)
1004   set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${NS3_LIBRARY_PATH}")
1005 endif()
1006 set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:\${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}\"")
1007
1008 file(READ ${CMAKE_HOME_DIRECTORY}/src/smpi/smpitools.sh SMPITOOLS_SH)
1009 configure_file(${CMAKE_HOME_DIRECTORY}/include/smpi/mpif.h.in ${CMAKE_BINARY_DIR}/include/smpi/mpif.h @ONLY)
1010 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_BINARY_DIR}/bin/smpicc @ONLY)
1011 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicxx.in ${CMAKE_BINARY_DIR}/bin/smpicxx @ONLY)
1012 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpiff.in ${CMAKE_BINARY_DIR}/bin/smpiff @ONLY)
1013 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif90.in ${CMAKE_BINARY_DIR}/bin/smpif90 @ONLY)
1014 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpirun.in ${CMAKE_BINARY_DIR}/bin/smpirun @ONLY)
1015
1016 ### Script used when simgrid is compiling
1017 set(includeflag "-I${CMAKE_HOME_DIRECTORY}/include -I${CMAKE_HOME_DIRECTORY}/include/smpi")
1018 set(includeflag "${includeflag} -I${CMAKE_BINARY_DIR}/include -I${CMAKE_BINARY_DIR}/include/smpi")
1019 set(includedir "${CMAKE_HOME_DIRECTORY}/include")
1020 set(exec_prefix "${CMAKE_BINARY_DIR}/smpi_script/")
1021 set(CMAKE_SMPI_COMMAND "export LD_LIBRARY_PATH=\"${CMAKE_BINARY_DIR}/lib")
1022 if(NS3_LIBRARY_PATH)
1023   set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${NS3_LIBRARY_PATH}")
1024 endif()
1025 set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:\${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}\"")
1026 set(libdir "${CMAKE_BINARY_DIR}/lib")
1027
1028 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc @ONLY)
1029 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicxx.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicxx @ONLY)
1030 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpiff.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff @ONLY)
1031 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif90.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpif90 @ONLY)
1032 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpirun.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun @ONLY)
1033
1034 set(top_builddir ${CMAKE_HOME_DIRECTORY})
1035
1036 if(NOT WIN32)
1037   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpicc)
1038   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpicxx)
1039   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpiff)
1040   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpif90)
1041   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpirun)
1042   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc)
1043   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicxx)
1044   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff)
1045   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpif90)
1046   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun)
1047 endif()
1048
1049 set(generated_headers_to_install
1050   ${CMAKE_CURRENT_BINARY_DIR}/include/smpi/mpif.h
1051   ${CMAKE_CURRENT_BINARY_DIR}/include/simgrid_config.h
1052   )
1053
1054 set(generated_headers
1055   ${CMAKE_CURRENT_BINARY_DIR}/src/context_sysv_config.h
1056   ${CMAKE_CURRENT_BINARY_DIR}/src/internal_config.h
1057   )
1058
1059 set(generated_files_to_clean
1060   ${generated_headers}
1061   ${generated_headers_to_install}
1062   ${CMAKE_BINARY_DIR}/bin/smpicc
1063   ${CMAKE_BINARY_DIR}/bin/smpicxx
1064   ${CMAKE_BINARY_DIR}/bin/smpiff
1065   ${CMAKE_BINARY_DIR}/bin/smpif90
1066   ${CMAKE_BINARY_DIR}/bin/smpirun
1067   ${CMAKE_BINARY_DIR}/bin/colorize
1068   ${CMAKE_BINARY_DIR}/bin/simgrid_update_xml
1069   ${CMAKE_BINARY_DIR}/examples/smpi/tracing/smpi_traced.trace
1070   )
1071
1072 if(NOT "${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_HOME_DIRECTORY}")
1073   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions0.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions0.txt COPYONLY)
1074   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions1.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions1.txt COPYONLY)
1075   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_allReduce.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allReduce.txt COPYONLY)
1076   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_barrier.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_barrier.txt COPYONLY)
1077   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_bcast.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_bcast.txt COPYONLY)
1078   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_with_isend.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_with_isend.txt COPYONLY)
1079   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_alltoall.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoall.txt COPYONLY)
1080   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_alltoallv.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoallv.txt COPYONLY)
1081   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_waitall.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_waitall.txt COPYONLY)
1082   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_reducescatter.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_reducescatter.txt COPYONLY)
1083   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_gather.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_gather.txt COPYONLY)
1084   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_allgatherv.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allgatherv.txt COPYONLY)
1085   configure_file(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/hostfile ${CMAKE_BINARY_DIR}/teshsuite/smpi/hostfile COPYONLY)
1086   
1087   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/description_file ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/description_file COPYONLY)
1088   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/README ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/README COPYONLY)
1089   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/smpi_replay.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/smpi_replay.txt COPYONLY)
1090   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)
1091   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)
1092   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)
1093   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)
1094   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)
1095   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)
1096   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)
1097   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)
1098   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)
1099   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)
1100   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)
1101   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)
1102   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)
1103   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)
1104   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)
1105   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)
1106   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)
1107   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)
1108   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)
1109   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)
1110   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)
1111   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)
1112   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)
1113   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)
1114   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)
1115   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)
1116   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)
1117   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)
1118   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)
1119   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)
1120   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)
1121   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)
1122
1123   set(generated_files_to_clean
1124     ${generated_files_to_clean}
1125     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions0.txt
1126     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions1.txt
1127     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allReduce.txt
1128     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_barrier.txt
1129     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_bcast.txt
1130     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_with_isend.txt
1131     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoall.txt
1132     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoallv.txt
1133     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_waitall.txt
1134     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_gather.txt
1135     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allgatherv.txt
1136     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_reducescatter.txt
1137     ${CMAKE_BINARY_DIR}/teshsuite/smpi/hostfile
1138     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/description_file
1139     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/README
1140     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/smpi_replay.txt
1141     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace0.txt
1142     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace1.txt
1143     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace2.txt
1144     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace3.txt
1145     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace4.txt
1146     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace5.txt
1147     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace6.txt
1148     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace7.txt
1149     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace8.txt
1150     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace9.txt
1151     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace10.txt
1152     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace11.txt
1153     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace12.txt
1154     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace13.txt
1155     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace14.txt
1156     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace15.txt
1157     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace16.txt
1158     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace17.txt
1159     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace18.txt
1160     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace19.txt
1161     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace20.txt
1162     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace21.txt
1163     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace22.txt
1164     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace23.txt
1165     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace24.txt
1166     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace25.txt
1167     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace26.txt
1168     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace27.txt
1169     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace28.txt
1170     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace29.txt
1171     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace30.txt
1172     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace31.txt
1173     )
1174 endif()
1175
1176 SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
1177   "${generated_files_to_clean}")
1178
1179 configure_file("${CMAKE_HOME_DIRECTORY}/tools/cmake/src/simgrid.nsi.in" "${CMAKE_BINARY_DIR}/simgrid.nsi" @ONLY IMMEDIATE)
1180
1181 ### Define source packages for Libs
1182 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/DefinePackages.cmake)
1183
1184 ### Build some Maintainer files
1185 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/MaintainerMode.cmake)
1186 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/UnitTesting.cmake)
1187
1188 ### Setup gcc & clang flags
1189 if (NOT MSVC)
1190   include(${CMAKE_HOME_DIRECTORY}/tools/cmake/GCCFlags.cmake)
1191 endif()
1192
1193 ### Make Libs
1194 if(NOT WIN32)
1195   include(${CMAKE_HOME_DIRECTORY}/tools/cmake/MakeLib.cmake)
1196 else()
1197   include(${CMAKE_HOME_DIRECTORY}/tools/cmake/MakeLibWin.cmake)
1198 endif()
1199
1200 if(enable_java)
1201   include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Java.cmake)
1202 endif()
1203
1204 ### Make tests
1205 if(enable_memcheck_xml)
1206   set(enable_memcheck true)
1207 endif()
1208
1209 INCLUDE(CTest)
1210 ENABLE_TESTING()
1211 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Tests.cmake)
1212 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/CTestConfig.cmake)
1213
1214 ### Define subdirectories
1215 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/MakeExe.cmake)
1216
1217 ### Setup the distrib
1218 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Distrib.cmake)
1219
1220 ### Build the doc (Windows downloads the doc instead of regenerating)
1221 #
1222 if(NOT WIN32)
1223   include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Documentation.cmake)
1224 else()
1225   find_program(WGET_PROGRAM  NAMES wget)
1226   message(STATUS "wget: ${WGET_PROGRAM}")
1227   if(WGET_PROGRAM)
1228     ADD_CUSTOM_TARGET(simgrid_documentation
1229       COMMENT "Downloading the SimGrid documentation..."
1230       COMMAND ${WGET_PROGRAM} -r -np -nH -nd http://simgrid.gforge.inria.fr/simgrid/${release_version}/doc/
1231       WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/doc/html
1232     )
1233   endif()
1234 endif()
1235
1236 ### Print ARGS
1237 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/PrintArgs.cmake)
1238
1239 INCLUDE(Dart)