Logo AND Algorithmique Numérique Distribuée

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