Logo AND Algorithmique Numérique Distribuée

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