Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
52aef28cb1b930034f82df10f3d7699b1778ec68
[simgrid.git] / buildtools / Cmake / CompleteInFiles.cmake
1 set(CMAKE_MODULE_PATH
2   ${CMAKE_MODULE_PATH}
3   ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/Modules
4   )
5
6 # x86_64
7 # x86
8 # i.86
9
10 ### Determine the assembly flavor that we need today
11 include(CMakeDetermineSystem)
12 IF(CMAKE_SYSTEM_PROCESSOR MATCHES ".86|AMD64|amd64")
13   IF(${ARCH_32_BITS})
14     message(STATUS "System processor: i686 (${CMAKE_SYSTEM_PROCESSOR}, 32 bits)")
15     set(PROCESSOR_i686 1)
16   ELSE()
17     message(STATUS "System processor: x86_64 (${CMAKE_SYSTEM_PROCESSOR}, 64 bits)")
18     set(PROCESSOR_x86_64 1)
19   ENDIF()
20   set(HAVE_RAWCTX 1)
21
22 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha")
23   message(STATUS "System processor: alpha")
24
25 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
26   # Subdir is "arm" for both big-endian (arm) and little-endian (armel).
27   message(STATUS "System processor: arm")
28
29 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
30   # mips* machines are bi-endian mostly so processor does not tell
31   # endianess of the underlying system.
32   message(STATUS "System processor: ${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb")
33
34 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
35   message(STATUS "System processor: ppc64")
36
37 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
38   message(STATUS "System processor: ppc")
39
40 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc")
41   # Both flavours can run on the same processor
42   message(STATUS "System processor: ${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9")
43
44 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(parisc|hppa)")
45   message(STATUS "System processor: parisc" "parisc64")
46
47 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^s390")
48   # s390 binaries can run on s390x machines
49   message(STATUS "System processor: ${CMAKE_SYSTEM_PROCESSOR}" "s390" "s390x")
50
51 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^sh")
52   message(STATUS "System processor: sh")
53
54 ELSE() #PROCESSOR NOT FOUND
55   message(STATUS "PROCESSOR NOT FOUND: ${CMAKE_SYSTEM_PROCESSOR}")
56
57 ENDIF()
58
59 if(ARCH_32_BITS)
60   set(MPI_ADDRESS_SIZE 4)
61 else()
62   set(MPI_ADDRESS_SIZE 8)
63 endif()
64
65 message(STATUS "Cmake version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}")
66
67 include(CheckFunctionExists)
68 include(CheckTypeSize)
69 include(CheckIncludeFile)
70 include(CheckIncludeFiles)
71 include(CheckLibraryExists)
72 include(TestBigEndian)
73 TEST_BIG_ENDIAN(BIGENDIAN)
74
75 include(FindGraphviz)
76 include(FindLibSigc++)
77
78 if(enable_java)
79   find_package(Java REQUIRED COMPONENTS Runtime Development)
80   find_package(JNI REQUIRED)
81   message("-- [Java] JNI found: ${JNI_FOUND}")
82   message("-- [Java] JNI include dirs: ${JNI_INCLUDE_DIRS}")
83   if(enable_maintainer_mode)
84     find_package(SWIG REQUIRED)
85     include(UseSWIG)
86     message("-- [Java] Swig found: ${SWIG_FOUND} (version ${SWIG_VERSION})")
87   endif()
88   set(HAVE_Java 1)
89 endif()
90 if(enable_scala)
91   find_package(Scala REQUIRED)
92   message("-- [Scala] scalac found: ${SCALA_COMPILE}")
93   set(HAVE_Scala 1)
94 endif()
95 if(enable_lua)
96   include(FindLua51Simgrid)
97 endif()
98
99 set(HAVE_GTNETS 0)
100 if(enable_gtnets)
101   include(FindGTnets)
102   if (NOT HAVE_GTNETS)
103     message(FATAL_ERROR "Cannot find GTNetS. Please install it, or disable that cmake option")
104   endif()
105 endif()
106 set(HAVE_NS3 0)
107 if(enable_ns3)
108   include(FindNS3)
109   if (NOT HAVE_NS3)
110     message(FATAL_ERROR "Cannot find NS3. Please install it (apt-get install ns3 libns3-dev) or disable that cmake option")
111   endif()
112 endif()
113
114 find_package(Boost 1.48)
115 if(Boost_FOUND)
116   include_directories(${Boost_INCLUDE_DIRS})
117 else()
118   if(APPLE)
119     message(FATAL_ERROR "Failed to find Boost libraries (Try to install them with 'sudo fink install boost1.53.nopython')")
120   else()
121     message(FATAL_ERROR "Failed to find Boost libraries."
122                         "Did you install libboost-dev and libboost-context-dev?"
123                         "(libboost-context-dev is optional)")
124   endif()
125 endif()
126
127 # Try again to see if we have libboost-context
128 find_package(Boost 1.42 COMPONENTS context)
129 set(Boost_FOUND 1) # We don't care of whether this component is missing
130
131 if(Boost_FOUND AND Boost_CONTEXT_FOUND)
132   # We should use feature detection for this instead:
133   if (Boost_VERSION LESS 105600)
134     message("Found Boost.Context API v1")
135     set(HAVE_BOOST_CONTEXT 1)
136   else()
137     message("Found Boost.Context API v2")
138     set(HAVE_BOOST_CONTEXT 2)
139   endif()
140 else()
141   message ("   boost        : found.")
142   message ("   boost-context: missing. Install libboost-context-dev for this optional feature.")
143   set(HAVE_BOOST_CONTEXT 0)
144 endif()
145
146 # Checks for header libraries functions.
147 CHECK_LIBRARY_EXISTS(dl      dlopen                  "" HAVE_DLOPEN_IN_LIBDL)
148 CHECK_LIBRARY_EXISTS(execinfo backtrace              "" HAVE_BACKTRACE_IN_LIBEXECINFO)
149 CHECK_LIBRARY_EXISTS(pthread pthread_create          "" pthread)
150 CHECK_LIBRARY_EXISTS(pthread sem_init                "" HAVE_SEM_INIT_LIB)
151 CHECK_LIBRARY_EXISTS(pthread sem_open                "" HAVE_SEM_OPEN_LIB)
152 CHECK_LIBRARY_EXISTS(pthread sem_timedwait           "" HAVE_SEM_TIMEDWAIT_LIB)
153 CHECK_LIBRARY_EXISTS(pthread pthread_mutex_timedlock "" HAVE_MUTEX_TIMEDLOCK_LIB)
154 CHECK_LIBRARY_EXISTS(rt      clock_gettime           "" HAVE_POSIX_GETTIME)
155
156 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
157   set(CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700 -D_DARWIN_C_SOURCE")
158 endif()
159
160 CHECK_INCLUDE_FILES("time.h;sys/time.h" TIME_WITH_SYS_TIME)
161 CHECK_INCLUDE_FILES("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)
162 CHECK_INCLUDE_FILE("pthread.h" HAVE_PTHREAD_H)
163 CHECK_INCLUDE_FILE("valgrind/valgrind.h" HAVE_VALGRIND_VALGRIND_H)
164 CHECK_INCLUDE_FILE("socket.h" HAVE_SOCKET_H)
165 CHECK_INCLUDE_FILE("sys/socket.h" HAVE_SYS_SOCKET_H)
166 CHECK_INCLUDE_FILE("stat.h" HAVE_STAT_H)
167 CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
168 CHECK_INCLUDE_FILE("windows.h" HAVE_WINDOWS_H)
169 CHECK_INCLUDE_FILE("winsock.h" HAVE_WINSOCK_H)
170 CHECK_INCLUDE_FILE("winsock2.h" HAVE_WINSOCK2_H)
171 CHECK_INCLUDE_FILE("windef.h" HAVE_WINDEF_H)
172 CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H)
173 CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
174 CHECK_INCLUDE_FILE("execinfo.h" HAVE_EXECINFO_H)
175 CHECK_INCLUDE_FILE("signal.h" HAVE_SIGNAL_H)
176 CHECK_INCLUDE_FILE("sys/time.h" HAVE_SYS_TIME_H)
177 CHECK_INCLUDE_FILE("sys/param.h" HAVE_SYS_PARAM_H)
178 CHECK_INCLUDE_FILE("sys/sysctl.h" HAVE_SYS_SYSCTL_H)
179 CHECK_INCLUDE_FILE("time.h" HAVE_TIME_H)
180 CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H)
181 CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H)
182 CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H)
183 CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
184 CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H)
185 CHECK_INCLUDE_FILE("ucontext.h" HAVE_UCONTEXT_H)
186 CHECK_INCLUDE_FILE("stdio.h" HAVE_STDIO_H)
187 CHECK_INCLUDE_FILE("linux/futex.h" HAVE_FUTEX_H)
188
189 CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
190 CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)
191 CHECK_FUNCTION_EXISTS(getdtablesize HAVE_GETDTABLESIZE)
192 CHECK_FUNCTION_EXISTS(sysconf HAVE_SYSCONF)
193 CHECK_FUNCTION_EXISTS(readv HAVE_READV)
194 CHECK_FUNCTION_EXISTS(popen HAVE_POPEN)
195 CHECK_FUNCTION_EXISTS(signal HAVE_SIGNAL)
196 CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF)
197 CHECK_FUNCTION_EXISTS(vsnprintf HAVE_VSNPRINTF)
198 CHECK_FUNCTION_EXISTS(asprintf HAVE_ASPRINTF)
199 CHECK_FUNCTION_EXISTS(vasprintf HAVE_VASPRINTF)
200 CHECK_FUNCTION_EXISTS(makecontext HAVE_MAKECONTEXT)
201 CHECK_FUNCTION_EXISTS(mmap HAVE_MMAP)
202 CHECK_FUNCTION_EXISTS(process_vm_readv HAVE_PROCESS_VM_READV)
203 CHECK_FUNCTION_EXISTS(strdup SIMGRID_HAVE_STRDUP)
204 CHECK_FUNCTION_EXISTS(_strdup SIMGRID_HAVE__STRDUP)
205
206 #Check if __thread is defined
207 execute_process(
208   COMMAND "${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_thread_storage.c"
209   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
210   RESULT_VARIABLE HAVE_thread_storage_run
211   )
212
213 if(HAVE_thread_storage_run)
214   set(HAVE_THREAD_LOCAL_STORAGE 1)
215 else()
216   set(HAVE_THREAD_LOCAL_STORAGE 0)
217 endif()
218
219 # Our usage of mmap is Linux-specific (flag MAP_ANONYMOUS), but kFreeBSD uses a GNU libc
220 IF(NOT "${CMAKE_SYSTEM}" MATCHES "Linux" AND NOT "${CMAKE_SYSTEM}" MATCHES "kFreeBSD" AND NOT "${CMAKE_SYSTEM}" MATCHES "GNU" AND NOT  "${CMAKE_SYSTEM}" MATCHES "Darwin")
221   SET(HAVE_MMAP 0)
222   message(STATUS "Warning: MMAP is thought as non functional on this architecture (${CMAKE_SYSTEM})")
223 ENDIF()
224
225 if(HAVE_MMAP AND HAVE_THREAD_LOCAL_STORAGE)
226   SET(HAVE_MMALLOC 1)
227 else()
228   SET(HAVE_MMALLOC 0)
229 endif()
230
231
232 if(WIN32) #THOSE FILES ARE FUNCTIONS ARE NOT DETECTED BUT THEY SHOULD...
233   set(HAVE_UCONTEXT_H 1)
234   set(HAVE_MAKECONTEXT 1)
235   set(HAVE_SNPRINTF 1)
236   set(HAVE_VSNPRINTF 1)
237 endif()
238
239 set(CONTEXT_UCONTEXT 0)
240 SET(CONTEXT_THREADS 0)
241
242 if(enable_jedule)
243   SET(HAVE_JEDULE 1)
244 endif()
245
246 if(enable_latency_bound_tracking)
247   SET(HAVE_LATENCY_BOUND_TRACKING 1)
248 else()
249   if(enable_gtnets)
250     message(STATUS "Warning : Turning latency_bound_tracking to ON because GTNeTs is ON")
251     SET(enable_latency_bound_tracking ON)
252     SET(HAVE_LATENCY_BOUND_TRACKING 1)
253   else()
254     SET(HAVE_LATENCY_BOUND_TRACKING 0)
255   endif()
256 endif()
257
258 if(enable_mallocators)
259   SET(MALLOCATOR_IS_WANTED 1)
260 else()
261   SET(MALLOCATOR_IS_WANTED 0)
262 endif()
263
264 if(enable_model-checking AND HAVE_MMALLOC)
265   SET(HAVE_MC 1)
266   SET(MMALLOC_WANT_OVERRIDE_LEGACY 1)
267   include(FindLibunwind)
268   include(FindLibdw)
269 else()
270   if(enable_model-checking)
271     message(STATUS "Warning: support for model-checking has been disabled because HAVE_MMALLOC is false")
272   endif()
273   SET(HAVE_MC 0)
274   SET(HAVE_MMALLOC 0)
275   SET(MMALLOC_WANT_OVERRIDE_LEGACY 0)
276 endif()
277
278 if(enable_smpi)
279   include(FindGFortran)
280   #really checks for objdump for privatization
281   find_package(BinUtils QUIET)
282   SET(HAVE_SMPI 1)
283
284   if( NOT "${CMAKE_OBJDUMP}" MATCHES "CMAKE_OBJDUMP-NOTFOUND" AND HAVE_MMAP)
285     SET(HAVE_PRIVATIZATION 1)
286   else()
287     SET(HAVE_PRIVATIZATION 0)
288   endif()
289 endif()
290
291 #--------------------------------------------------------------------------------------------------
292 ### Check for some architecture dependent values
293 CHECK_TYPE_SIZE(int SIZEOF_INT)
294 CHECK_TYPE_SIZE(void* SIZEOF_VOIDP)
295
296 #--------------------------------------------------------------------------------------------------
297 ### Check for GNU dynamic linker
298 CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
299 if (HAVE_DLFCN_H)
300     if(HAVE_DLOPEN_IN_LIBDL)
301       set(DL_LIBRARY "-ldl")
302     endif(HAVE_DLOPEN_IN_LIBDL)
303     execute_process(COMMAND ${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_gnu_dynlinker.c ${DL_LIBRARY} -o test_gnu_ld
304       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
305       OUTPUT_VARIABLE HAVE_GNU_LD_compil
306     )
307     if(HAVE_GNU_LD_compil)
308       set(HAVE_GNU_LD 0)
309       message(STATUS "Warning: test program toward GNU ld failed to compile:")
310       message(STATUS "${HAVE_GNU_LD_comp_output}")
311     else()
312
313       execute_process(COMMAND ./test_gnu_ld
314           WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
315           RESULT_VARIABLE HAVE_GNU_LD_run
316           OUTPUT_VARIABLE var_exec
317       )
318
319       if(NOT HAVE_GNU_LD_run)
320         set(HAVE_GNU_LD 1)
321         message(STATUS "We are using GNU dynamic linker")
322       else()
323         set(HAVE_GNU_LD 0)
324         message(STATUS "Warning: error while checking for GNU ld:")
325         message(STATUS "Test output: '${var_exec}'")
326         message(STATUS "Exit status: ${HAVE_GNU_LD_run}")
327       endif()
328       file(REMOVE test_gnu_ld)
329     endif()
330 endif()
331
332
333 #--------------------------------------------------------------------------------------------------
334 ### Initialize of CONTEXT THREADS
335
336 if(pthread)
337   set(pthread 1)
338 elseif(pthread)
339   set(pthread 0)
340 endif()
341
342 if(pthread)
343   ### Test that we have a way to create semaphores
344
345   if(HAVE_SEM_OPEN_LIB)
346     execute_process(COMMAND ${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_sem_open.c -lpthread -o sem_open
347     WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
348     OUTPUT_VARIABLE HAVE_SEM_OPEN_compil
349     )
350
351     # Test sem_open by compiling:
352     if(HAVE_SEM_OPEN_compil)
353       set(HAVE_SEM_OPEN 0)
354       message(STATUS "Warning: sem_open not compilable")
355       message(STATUS "HAVE_SEM_OPEN_comp_output: ${HAVE_SEM_OPEN_comp_output}")
356     else()
357       set(HAVE_SEM_OPEN 1)
358       message(STATUS "sem_open is compilable")
359     endif()
360
361     # If we're not crosscompiling, we check by executing the program:
362     if (HAVE_SEM_OPEN AND NOT CMAKE_CROSSCOMPILING)
363       execute_process(COMMAND ./sem_open
364       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
365       RESULT_VARIABLE HAVE_SEM_OPEN_run
366       OUTPUT_VARIABLE var_compil
367       )
368       if (NOT HAVE_SEM_OPEN_run)
369         set(HAVE_SEM_OPEN 1)
370         message(STATUS "sem_open is executable")
371       else()
372         set(HAVE_SEM_OPEN 0)
373         if(EXISTS "${CMAKE_BINARY_DIR}/sem_open")
374           message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_open exists!")
375         else()
376           message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_open not exists!")
377         endif()
378         message(STATUS "Warning: sem_open not executable")
379         message(STATUS "Compilation output: '${var_compil}'")
380         message(STATUS "Exit result of sem_open: ${HAVE_SEM_OPEN_run}")
381       endif()
382     endif()
383     file(REMOVE sem_open)
384
385   else()
386     set(HAVE_SEM_OPEN 0)
387   endif()
388
389   if(HAVE_SEM_INIT_LIB)
390     execute_process(COMMAND ${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_sem_init.c -lpthread -o sem_init
391     WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
392     RESULT_VARIABLE HAVE_SEM_INIT_run OUTPUT_VARIABLE HAVE_SEM_INIT_compil)
393
394     # Test sem_init by compiling:
395     if(HAVE_SEM_INIT_compil)
396       set(HAVE_SEM_INIT 0)
397       message(STATUS "Warning: sem_init not compilable")
398       message(STATUS "HAVE_SEM_INIT_comp_output: ${HAVE_SEM_OPEN_comp_output}")
399     else()
400       set(HAVE_SEM_INIT 1)
401       message(STATUS "sem_init is compilable")
402     endif()
403
404     # If we're not crosscompiling, we check by executing the program:
405     if (HAVE_SEM_INIT AND NOT CMAKE_CROSSCOMPILING)
406       execute_process(COMMAND ./sem_init
407       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
408       RESULT_VARIABLE HAVE_SEM_INIT_run
409       OUTPUT_VARIABLE var_compil
410       )
411       if (NOT HAVE_SEM_INIT_run)
412         set(HAVE_SEM_INIT 1)
413         message(STATUS "sem_init is executable")
414       else()
415         set(HAVE_SEM_INIT 0)
416         if(EXISTS "${CMAKE_BINARY_DIR}/sem_init")
417           message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_init exists!")
418         else()
419           message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_init not exists!")
420         endif()
421         message(STATUS "Warning: sem_init not executable")
422         message(STATUS "Compilation output: '${var_compil}'")
423         message(STATUS "Exit result of sem_init: ${HAVE_SEM_INIT_run}")
424       endif()
425     endif()
426     file(REMOVE sem_init)
427   endif()
428
429   if(NOT HAVE_SEM_OPEN AND NOT HAVE_SEM_INIT)
430     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).")
431   endif()
432
433   ### Test that we have a way to timewait for semaphores
434
435   if(HAVE_SEM_TIMEDWAIT_LIB)
436
437     execute_process(
438       COMMAND "${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_sem_timedwait.c -lpthread"
439       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
440       OUTPUT_VARIABLE HAVE_SEM_TIMEDWAIT_run
441       )
442
443     if(HAVE_SEM_TIMEDWAIT_run)
444       set(HAVE_SEM_TIMEDWAIT 0)
445       message(STATUS "timedwait not compilable")
446     else()
447       set(HAVE_SEM_TIMEDWAIT 1)
448       message(STATUS "timedwait is compilable")
449     endif()
450   endif()
451
452   ### HAVE_MUTEX_TIMEDLOCK
453
454   if(HAVE_MUTEX_TIMEDLOCK_LIB)
455
456     execute_process(
457       COMMAND "${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_mutex_timedlock.c -lpthread"
458       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
459       OUTPUT_VARIABLE HAVE_MUTEX_TIMEDLOCK_run
460       )
461
462     if(HAVE_MUTEX_TIMEDLOCK_run)
463       set(HAVE_MUTEX_TIMEDLOCK 0)
464       message(STATUS "timedlock not compilable")
465     else()
466       message(STATUS "timedlock is compilable")
467       set(HAVE_MUTEX_TIMEDLOCK 1)
468     endif()
469   endif()
470 endif()
471
472 # This is needed for ucontext on MacOS X:
473 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
474   add_definitions(-D_XOPEN_SOURCE=700 -D_DARWIN_C_SOURCE)
475 endif()
476
477 if(WIN32)
478   # We always provide our own implementation of ucontext on Windows.
479   try_compile(HAVE_UCONTEXT
480     ${CMAKE_BINARY_DIR}
481     ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c
482     COMPILE_DEFINITIONS _XBT_WIN32
483     INCLUDE_DIRECTORIES
484       ${CMAKE_HOME_DIRECTORY}/src/include
485       ${CMAKE_HOME_DIRECTORY}/src/xbt
486   )
487 else()
488   # We always provide our own implementation of ucontext on Windows.
489   try_compile(HAVE_UCONTEXT
490     ${CMAKE_BINARY_DIR}
491     ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c)
492 endif()
493
494 #If can have both context
495
496 if(HAVE_UCONTEXT)
497   set(CONTEXT_UCONTEXT 1)
498   message("-- Support for ucontext factory")
499 endif()
500
501 if(pthread)
502   set(CONTEXT_THREADS 1)
503   message("-- Support for thread context factory")
504 endif()
505
506 ###############
507 ## GIT version check
508 ##
509 if(EXISTS ${CMAKE_HOME_DIRECTORY}/.git/)
510   execute_process(COMMAND git remote
511   COMMAND head -n 1
512   WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
513   OUTPUT_VARIABLE remote
514   RESULT_VARIABLE ret
515   )
516   string(REPLACE "\n" "" remote "${remote}")
517   #message(STATUS "Git remote: ${remote}")
518   execute_process(COMMAND git config --get remote.${remote}.url
519   WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
520   OUTPUT_VARIABLE url
521   RESULT_VARIABLE ret
522   )
523   string(REPLACE "\n" "" url "${url}")
524   #message(STATUS "Git url: ${url}")
525   if(url)
526     execute_process(COMMAND git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log --pretty=oneline --abbrev-commit -1
527     WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
528     OUTPUT_VARIABLE GIT_VERSION
529     RESULT_VARIABLE ret
530     )
531     string(REPLACE "\n" "" GIT_VERSION "${GIT_VERSION}")
532     message(STATUS "Git version: ${GIT_VERSION}")
533     execute_process(COMMAND git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log -n 1 --pretty=format:%ai .
534     WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
535     OUTPUT_VARIABLE GIT_DATE
536     RESULT_VARIABLE ret
537     )
538     string(REPLACE "\n" "" GIT_DATE "${GIT_DATE}")
539     message(STATUS "Git date: ${GIT_DATE}")
540     string(REGEX REPLACE " .*" "" GIT_VERSION "${GIT_VERSION}")
541     
542     execute_process(COMMAND git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log --pretty=format:%H -1
543                     WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
544                     OUTPUT_VARIABLE SIMGRID_GITHASH
545                     RESULT_VARIABLE ret
546                     )
547     string(REPLACE "\n" "" SIMGRID_GITHASH "${SIMGRID_GITHASH}")
548                     
549   endif()
550 elseif(EXISTS ${CMAKE_HOME_DIRECTORY}/.gitversion)
551   FILE(STRINGS ${CMAKE_HOME_DIRECTORY}/.gitversion GIT_VERSION)
552 endif()
553
554 if(release)
555   set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER}\\nRelease build")
556 else()
557   set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER}\\nDevelopment build")
558 endif()
559 if(GIT_VERSION)
560   set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER} at commit ${GIT_VERSION}")
561 endif()
562 if(GIT_DATE)
563   set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER} (${GIT_DATE})")
564 endif()
565 #--------------------------------------------------------------------------------------------------
566
567 set(makecontext_CPPFLAGS_2 "")
568 if(HAVE_MAKECONTEXT OR WIN32)
569   set(makecontext_CPPFLAGS "-DTEST_makecontext")
570   if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
571     set(makecontext_CPPFLAGS_2 "-D_XOPEN_SOURCE=700")
572   endif()
573
574   if(WIN32)
575     if(ARCH_32_BITS)
576       set(makecontext_CPPFLAGS "-DTEST_makecontext -D_I_X86_")
577     else()
578       set(makecontext_CPPFLAGS "-DTEST_makecontext -D_AMD64_")
579     endif()
580     set(makecontext_CPPFLAGS_2 "-D_XBT_WIN32 -I${CMAKE_HOME_DIRECTORY}/src/include -I${CMAKE_HOME_DIRECTORY}/src/xbt")
581   endif()
582
583   file(REMOVE ${CMAKE_BINARY_DIR}/conftestval)
584
585   if(CMAKE_CROSSCOMPILING)
586     set(RUN_makecontext_VAR "cross")
587     set(COMPILE_makecontext_VAR "cross")
588   else()
589     try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR
590       ${CMAKE_BINARY_DIR}
591       ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_stacksetup.c
592       COMPILE_DEFINITIONS "${makecontext_CPPFLAGS} ${makecontext_CPPFLAGS_2}"
593       )
594   endif()
595
596   if(EXISTS ${CMAKE_BINARY_DIR}/conftestval)
597     file(READ ${CMAKE_BINARY_DIR}/conftestval MAKECONTEXT_ADDR_SIZE)
598     string(REPLACE "\n" "" MAKECONTEXT_ADDR_SIZE "${MAKECONTEXT_ADDR_SIZE}")
599     string(REGEX MATCH ;^.*,;MAKECONTEXT_ADDR "${MAKECONTEXT_ADDR_SIZE}")
600     string(REGEX MATCH ;,.*$; MAKECONTEXT_SIZE "${MAKECONTEXT_ADDR_SIZE}")
601     string(REPLACE "," "" makecontext_addr "${MAKECONTEXT_ADDR}")
602     string(REPLACE "," "" makecontext_size "${MAKECONTEXT_SIZE}")
603     set(pth_skaddr_makecontext "#define pth_skaddr_makecontext(skaddr,sksize) (${makecontext_addr})")
604     set(pth_sksize_makecontext "#define pth_sksize_makecontext(skaddr,sksize) (${makecontext_size})")
605     message(STATUS "${pth_skaddr_makecontext}")
606     message(STATUS "${pth_sksize_makecontext}")
607   else()
608     # message(FATAL_ERROR "makecontext is not compilable")
609   endif()
610 endif()
611
612 #--------------------------------------------------------------------------------------------------
613
614 ### check for stackgrowth
615 if (NOT CMAKE_CROSSCOMPILING)
616   try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR
617     ${CMAKE_BINARY_DIR}
618     ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_stackgrowth.c
619     RUN_OUTPUT_VARIABLE stack
620     )
621 endif()
622 if("${stack}" STREQUAL "down")
623   set(PTH_STACKGROWTH "-1")
624 elseif("${stack}" STREQUAL "up")
625   set(PTH_STACKGROWTH "1")
626 else()
627   if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
628     set(PTH_STACKGROWTH "-1")
629   elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686")
630     set(PTH_STACKGROWTH "-1")
631   else()
632     message(ERROR "Could not figure the stack direction.")
633   endif()
634 endif()
635
636 ###############
637 ## System checks
638 ##
639
640 #SG_CONFIGURE_PART([System checks...])
641 #AC_PROG_CC(xlC gcc cc) -auto
642 #AM_SANITY_CHECK -auto
643
644 #AC_PROG_MAKE_SET
645
646 #AC_CHECK_VA_COPY
647
648 set(diff_va "va_copy((d),(s))"
649   "VA_COPY((d),(s))"
650   "__va_copy((d),(s))"
651   "__builtin_va_copy((d),(s))"
652   "do { (d) = (s)\; } while (0)"
653   "do { *(d) = *(s)\; } while (0)"
654   "memcpy((void *)&(d), (void *)&(s), sizeof(s))"
655   "memcpy((void *)(d), (void *)(s), sizeof(*(s)))"
656   )
657
658 foreach(fct ${diff_va})
659   write_file("${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_va_copy.c" "#include <stdlib.h>
660 #include <stdarg.h>
661 #include <string.h>
662 #define DO_VA_COPY(d,s) ${fct}
663 void test(char *str, ...)
664 {
665   va_list ap, ap2;
666   int i;
667   va_start(ap, str);
668   DO_VA_COPY(ap2, ap);
669   for (i = 1; i <= 9; i++) {
670     int k = (int)va_arg(ap, int);
671     if (k != i)
672       abort();
673   }
674   DO_VA_COPY(ap, ap2);
675   for (i = 1; i <= 9; i++) {
676     int k = (int)va_arg(ap, int);
677     if (k != i)
678       abort();
679   }
680   va_end(ap);
681 }
682 int main(void)
683 {
684   test(\"test\", 1, 2, 3, 4, 5, 6, 7, 8, 9);
685   exit(0);
686 }"
687     )
688
689   execute_process(
690   COMMAND ${CMAKE_C_COMPILER} "${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_va_copy.c"
691   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
692   RESULT_VARIABLE COMPILE_VA_NULL_VAR
693   OUTPUT_QUIET
694   ERROR_QUIET
695   )
696
697   if(NOT COMPILE_VA_NULL_VAR)
698     string(REGEX REPLACE "\;" "" fctbis ${fct})
699     if(${fctbis} STREQUAL "va_copy((d),(s))")
700       set(HAVE_VA_COPY 1)
701       set(ac_cv_va_copy "C99")
702       set(__VA_COPY_USE_C99 "va_copy((d),(s))")
703     endif()
704
705     if(${fctbis} STREQUAL "VA_COPY((d),(s))")
706       set(ac_cv_va_copy "GCM")
707       set(__VA_COPY_USE_GCM "VA_COPY((d),(s))")
708     endif()
709
710     if(${fctbis} STREQUAL "__va_copy((d),(s))")
711       set(ac_cv_va_copy "GCH")
712       set(__VA_COPY_USE_GCH "__va_copy((d),(s))")
713     endif()
714
715     if(${fctbis} STREQUAL "__builtin_va_copy((d),(s))")
716       set(ac_cv_va_copy "GCB")
717       set(__VA_COPY_USE_GCB "__builtin_va_copy((d),(s))")
718     endif()
719
720     if(${fctbis} STREQUAL "do { (d) = (s) } while (0)")
721       set(ac_cv_va_copy "ASS")
722       set(__VA_COPY_USE_ASS "do { (d) = (s); } while (0)")
723     endif()
724
725     if(${fctbis} STREQUAL "do { *(d) = *(s) } while (0)")
726       set(ac_cv_va_copy "ASP")
727       set(__VA_COPY_USE_ASP "do { *(d) = *(s); } while (0)")
728     endif()
729
730     if(${fctbis} STREQUAL "memcpy((void *)&(d), (void *)&(s), sizeof(s))")
731       set(ac_cv_va_copy "CPS")
732       set(__VA_COPY_USE_CPS "memcpy((void *)&(d), (void *)&(s), sizeof(s))")
733     endif()
734
735     if(${fctbis} STREQUAL "memcpy((void *)(d), (void *)(s), sizeof(*(s)))")
736       set(ac_cv_va_copy "CPP")
737       set(__VA_COPY_USE_CPP "memcpy((void *)(d), (void *)(s), sizeof(*(s)))")
738     endif()
739
740     if(NOT STATUS_OK)
741       set(__VA_COPY_USE "__VA_COPY_USE_${ac_cv_va_copy}(d, s)")
742     endif()
743     set(STATUS_OK "1")
744
745   endif()
746
747 endforeach(fct ${diff_va})
748
749 #--------------------------------------------------------------------------------------------------
750 ### check for a working snprintf
751 if(HAVE_SNPRINTF AND HAVE_VSNPRINTF OR WIN32)
752   if(WIN32)
753     #set(HAVE_SNPRINTF 1)
754     #set(HAVE_VSNPRINTF 1)
755   endif()
756
757   if(CMAKE_CROSSCOMPILING)
758     set(RUN_SNPRINTF_FUNC "cross")
759     #set(PREFER_PORTABLE_SNPRINTF 1)
760   else()
761     try_run(RUN_SNPRINTF_FUNC_VAR COMPILE_SNPRINTF_FUNC_VAR
762       ${CMAKE_BINARY_DIR}
763       ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_snprintf.c
764       )
765   endif()
766
767   if(CMAKE_CROSSCOMPILING)
768     set(RUN_VSNPRINTF_FUNC "cross")
769     set(PREFER_PORTABLE_VSNPRINTF 1)
770   else()
771     try_run(RUN_VSNPRINTF_FUNC_VAR COMPILE_VSNPRINTF_FUNC_VAR
772       ${CMAKE_BINARY_DIR}
773       ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_vsnprintf.c
774       )
775   endif()
776
777   set(PREFER_PORTABLE_SNPRINTF 0)
778   if(RUN_VSNPRINTF_FUNC_VAR MATCHES "FAILED_TO_RUN")
779     set(PREFER_PORTABLE_SNPRINTF 1)
780   endif()
781   if(RUN_SNPRINTF_FUNC_VAR MATCHES "FAILED_TO_RUN")
782     set(PREFER_PORTABLE_SNPRINTF 1)
783   endif()
784 endif()
785
786 ### check for asprintf function familly
787 if(HAVE_ASPRINTF)
788   SET(simgrid_need_asprintf "")
789   SET(NEED_ASPRINTF 0)
790 else()
791   SET(simgrid_need_asprintf "#define SIMGRID_NEED_ASPRINTF 1")
792   SET(NEED_ASPRINTF 1)
793 endif()
794
795 if(HAVE_VASPRINTF)
796   SET(simgrid_need_vasprintf "")
797   SET(NEED_VASPRINTF 0)
798 else()
799   SET(simgrid_need_vasprintf "#define SIMGRID_NEED_VASPRINTF 1")
800   SET(NEED_VASPRINTF 1)
801 endif()
802
803 ### check for addr2line
804
805 find_path(ADDR2LINE NAMES addr2line     PATHS NO_DEFAULT_PATHS  )
806 if(ADDR2LINE)
807   set(ADDR2LINE "${ADDR2LINE}/addr2line")
808 endif()
809
810 ### Check if OSX can compile with ucontext (with gcc 4.[1-5] it is broken)
811 if(APPLE)
812   if(APPLE_NEED_GCC_VERSION GREATER COMPILER_C_VERSION_MAJOR_MINOR)
813     message(STATUS "Ucontext can't be used with this version of gcc (must be greater than 4.5)")
814     set(HAVE_UCONTEXT_H 0)
815   endif()
816 endif()
817
818 ### File to create
819
820 configure_file("${CMAKE_HOME_DIRECTORY}/src/context_sysv_config.h.in"
821   "${CMAKE_BINARY_DIR}/src/context_sysv_config.h" @ONLY IMMEDIATE)
822
823 SET( CMAKEDEFINE "#cmakedefine" )
824 configure_file("${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/src/internal_config.h.in" "${CMAKE_BINARY_DIR}/src/internal_config.h" @ONLY IMMEDIATE)
825 configure_file("${CMAKE_BINARY_DIR}/src/internal_config.h" "${CMAKE_BINARY_DIR}/src/internal_config.h" @ONLY IMMEDIATE)
826 configure_file("${CMAKE_HOME_DIRECTORY}/include/simgrid_config.h.in" "${CMAKE_BINARY_DIR}/include/simgrid_config.h" @ONLY IMMEDIATE)
827
828 set(top_srcdir "${CMAKE_HOME_DIRECTORY}")
829 set(srcdir "${CMAKE_HOME_DIRECTORY}/src")
830 set(bindir "${CMAKE_BINARY_DIR}")
831
832 ### Script used when simgrid is installed
833 set(exec_prefix ${CMAKE_INSTALL_PREFIX})
834 set(includeflag "-I${CMAKE_INSTALL_PREFIX}/include -I${CMAKE_INSTALL_PREFIX}/include/smpi")
835 set(includedir "${CMAKE_INSTALL_PREFIX}/include")
836 set(libdir ${exec_prefix}/lib)
837 set(CMAKE_SMPI_COMMAND "export LD_LIBRARY_PATH=\"${CMAKE_INSTALL_PREFIX}/lib")
838 if(GTNETS_LIB_PATH)
839   set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${GTNETS_LIB_PATH}")
840 endif()
841 if(NS3_LIBRARY_PATH)
842   set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${NS3_LIBRARY_PATH}")
843 endif()
844 set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:\${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}\"")
845
846 file(READ ${CMAKE_HOME_DIRECTORY}/src/smpi/smpitools.sh SMPITOOLS_SH)
847 configure_file(${CMAKE_HOME_DIRECTORY}/include/smpi/mpif.h.in ${CMAKE_BINARY_DIR}/include/smpi/mpif.h @ONLY)
848 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_BINARY_DIR}/bin/smpicc @ONLY)
849 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicxx.in ${CMAKE_BINARY_DIR}/bin/smpicxx @ONLY)
850 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpiff.in ${CMAKE_BINARY_DIR}/bin/smpiff @ONLY)
851 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif90.in ${CMAKE_BINARY_DIR}/bin/smpif90 @ONLY)
852 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpirun.in ${CMAKE_BINARY_DIR}/bin/smpirun @ONLY)
853
854 ### Script used when simgrid is compiling
855 set(includeflag "-I${CMAKE_HOME_DIRECTORY}/include -I${CMAKE_HOME_DIRECTORY}/include/smpi")
856 set(includeflag "${includeflag} -I${CMAKE_BINARY_DIR}/include -I${CMAKE_BINARY_DIR}/include/smpi")
857 set(includedir "${CMAKE_HOME_DIRECTORY}/include")
858 set(exec_prefix "${CMAKE_BINARY_DIR}/smpi_script/")
859 set(CMAKE_SMPI_COMMAND "export LD_LIBRARY_PATH=\"${CMAKE_BINARY_DIR}/lib")
860 if(GTNETS_LIB_PATH)
861   set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${GTNETS_LIB_PATH}")
862 endif()
863 if(NS3_LIBRARY_PATH)
864   set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${NS3_LIBRARY_PATH}")
865 endif()
866 set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:\${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}\"")
867 set(libdir "${CMAKE_BINARY_DIR}/lib")
868
869 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc @ONLY)
870 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicxx.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicxx @ONLY)
871 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpiff.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff @ONLY)
872 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif90.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpif90 @ONLY)
873 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpirun.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun @ONLY)
874
875 set(top_builddir ${CMAKE_HOME_DIRECTORY})
876
877 if(NOT WIN32)
878   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpicc)
879   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpicxx)
880   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpiff)
881   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpif90)
882   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpirun)
883   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc)
884   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicxx)
885   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff)
886   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpif90)
887   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun)
888 endif()
889
890 set(generated_headers_to_install
891   ${CMAKE_CURRENT_BINARY_DIR}/include/smpi/mpif.h
892   ${CMAKE_CURRENT_BINARY_DIR}/include/simgrid_config.h
893   )
894
895 set(generated_headers
896   ${CMAKE_CURRENT_BINARY_DIR}/src/context_sysv_config.h
897   ${CMAKE_CURRENT_BINARY_DIR}/src/internal_config.h
898   )
899
900 set(generated_files_to_clean
901   ${generated_headers}
902   ${generated_headers_to_install}
903   ${CMAKE_BINARY_DIR}/bin/smpicc
904   ${CMAKE_BINARY_DIR}/bin/smpicxx
905   ${CMAKE_BINARY_DIR}/bin/smpiff
906   ${CMAKE_BINARY_DIR}/bin/smpif90
907   ${CMAKE_BINARY_DIR}/bin/smpirun
908   ${CMAKE_BINARY_DIR}/bin/colorize
909   ${CMAKE_BINARY_DIR}/bin/simgrid_update_xml
910   ${CMAKE_BINARY_DIR}/examples/smpi/tracing/smpi_traced.trace
911   )
912
913 if(NOT "${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_HOME_DIRECTORY}")
914   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions0.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions0.txt COPYONLY)
915   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions1.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions1.txt COPYONLY)
916   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_allReduce.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allReduce.txt COPYONLY)
917   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_barrier.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_barrier.txt COPYONLY)
918   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_bcast.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_bcast.txt COPYONLY)
919   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_with_isend.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_with_isend.txt COPYONLY)
920   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_alltoall.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoall.txt COPYONLY)
921   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_alltoallv.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoallv.txt COPYONLY)
922   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_waitall.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_waitall.txt COPYONLY)
923   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_reducescatter.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_reducescatter.txt COPYONLY)
924   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_gather.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_gather.txt COPYONLY)
925   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_allgatherv.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allgatherv.txt COPYONLY)
926   configure_file(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/hostfile ${CMAKE_BINARY_DIR}/teshsuite/smpi/hostfile COPYONLY)
927   
928   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/description_file ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/description_file COPYONLY)
929   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/README ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/README COPYONLY)
930   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/smpi_replay.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/smpi_replay.txt COPYONLY)
931   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)
932   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)
933   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)
934   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)
935   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)
936   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)
937   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)
938   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)
939   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)
940   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)
941   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)
942   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)
943   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)
944   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)
945   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)
946   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)
947   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)
948   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)
949   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)
950   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)
951   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)
952   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)
953   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)
954   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)
955   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)
956   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)
957   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)
958   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)
959   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)
960   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)
961   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)
962   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)
963
964   set(generated_files_to_clean
965     ${generated_files_to_clean}
966     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions0.txt
967     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions1.txt
968     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allReduce.txt
969     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_barrier.txt
970     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_bcast.txt
971     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_with_isend.txt
972     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoall.txt
973     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoallv.txt
974     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_waitall.txt
975     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_gather.txt
976     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allgatherv.txt
977     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_reducescatter.txt
978     ${CMAKE_BINARY_DIR}/teshsuite/smpi/hostfile
979     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/description_file
980     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/README
981     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/smpi_replay.txt
982     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace0.txt
983     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace1.txt
984     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace2.txt
985     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace3.txt
986     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace4.txt
987     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace5.txt
988     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace6.txt
989     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace7.txt
990     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace8.txt
991     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace9.txt
992     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace10.txt
993     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace11.txt
994     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace12.txt
995     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace13.txt
996     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace14.txt
997     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace15.txt
998     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace16.txt
999     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace17.txt
1000     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace18.txt
1001     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace19.txt
1002     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace20.txt
1003     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace21.txt
1004     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace22.txt
1005     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace23.txt
1006     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace24.txt
1007     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace25.txt
1008     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace26.txt
1009     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace27.txt
1010     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace28.txt
1011     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace29.txt
1012     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace30.txt
1013     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace31.txt
1014     )
1015 endif()
1016
1017 SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
1018   "${generated_files_to_clean}")
1019
1020 IF(${ARCH_32_BITS})
1021   set(WIN_ARCH "32")
1022 ELSE()
1023   set(WIN_ARCH "64")
1024 ENDIF()
1025 configure_file("${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/src/simgrid.nsi.in" "${CMAKE_BINARY_DIR}/simgrid.nsi" @ONLY IMMEDIATE)