Logo AND Algorithmique Numérique Distribuée

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