Logo AND Algorithmique Numérique Distribuée

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