Logo AND Algorithmique Numérique Distribuée

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