Logo AND Algorithmique Numérique Distribuée

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