Logo AND Algorithmique Numérique Distribuée

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