Logo AND Algorithmique Numérique Distribuée

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