Logo AND Algorithmique Numérique Distribuée

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