Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
ec65572283cb4f3036ae0fbb40bdd29a698db1ec
[simgrid.git] / tools / cmake / CompleteInFiles.cmake
1 set(CMAKE_MODULE_PATH
2   ${CMAKE_MODULE_PATH}
3   ${CMAKE_HOME_DIRECTORY}/tools/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   if (MSVC)
21     message(STATUS "Disable fast raw contextes on Microsoft Visual.")
22   else()
23     set(HAVE_RAWCTX 1)
24   endif()
25
26 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha")
27   message(STATUS "System processor: alpha")
28
29 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
30   # Subdir is "arm" for both big-endian (arm) and little-endian (armel).
31   message(STATUS "System processor: arm")
32
33 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
34   # mips* machines are bi-endian mostly so processor does not tell
35   # endianess of the underlying system.
36   message(STATUS "System processor: ${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb")
37
38 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
39   message(STATUS "System processor: ppc64")
40
41 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
42   message(STATUS "System processor: ppc")
43
44 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc")
45   # Both flavours can run on the same processor
46   message(STATUS "System processor: ${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9")
47
48 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(parisc|hppa)")
49   message(STATUS "System processor: parisc" "parisc64")
50
51 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^s390")
52   # s390 binaries can run on s390x machines
53   message(STATUS "System processor: ${CMAKE_SYSTEM_PROCESSOR}" "s390" "s390x")
54
55 ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^sh")
56   message(STATUS "System processor: sh")
57
58 ELSE() #PROCESSOR NOT FOUND
59   message(STATUS "PROCESSOR NOT FOUND: ${CMAKE_SYSTEM_PROCESSOR}")
60
61 ENDIF()
62
63 if(ARCH_32_BITS)
64   set(MPI_ADDRESS_SIZE 4)
65 else()
66   set(MPI_ADDRESS_SIZE 8)
67 endif()
68
69 include(CheckFunctionExists)
70 include(CheckTypeSize)
71 include(CheckIncludeFile)
72 include(CheckIncludeFiles)
73 include(CheckLibraryExists)
74 include(CheckSymbolExists)
75 include(TestBigEndian)
76 TEST_BIG_ENDIAN(BIGENDIAN)
77
78 include(FindGraphviz)
79 include(FindLibSigc++)
80
81 if(enable_java)
82   find_package(Java REQUIRED COMPONENTS Runtime Development)
83   find_package(JNI REQUIRED)
84   message("-- [Java] JNI found: ${JNI_FOUND}")
85   message("-- [Java] JNI include dirs: ${JNI_INCLUDE_DIRS}")
86   if(enable_maintainer_mode)
87     find_package(SWIG REQUIRED)
88     include(UseSWIG)
89     message("-- [Java] Swig found: ${SWIG_FOUND} (version ${SWIG_VERSION})")
90   endif()
91   set(HAVE_Java 1)
92 endif()
93 if(enable_scala)
94   find_package(Scala REQUIRED)
95   message("-- [Scala] scalac found: ${SCALA_COMPILE}")
96   set(HAVE_Scala 1)
97 endif()
98 if(enable_lua)
99   include(FindLuaSimgrid)
100 endif()
101
102 set(HAVE_NS3 0)
103 if(enable_ns3)
104   include(FindNS3)
105   if (NOT HAVE_NS3)
106     message(FATAL_ERROR "Cannot find NS3. Please install it (apt-get install ns3 libns3-dev) or disable that cmake option")
107   endif()
108 endif()
109
110 find_package(Boost 1.48)
111 if(Boost_FOUND)
112   include_directories(${Boost_INCLUDE_DIRS})
113 else()
114   if(APPLE)
115     message(FATAL_ERROR "Failed to find Boost libraries (Try to install them with 'sudo fink install boost1.53.nopython')")
116   else()
117     message(FATAL_ERROR "Failed to find Boost libraries."
118                         "Did you install libboost-dev and libboost-context-dev?"
119                         "(libboost-context-dev is optional)")
120   endif()
121 endif()
122
123 # Try again to see if we have libboost-context
124 find_package(Boost 1.42 COMPONENTS context)
125 set(Boost_FOUND 1) # We don't care of whether this component is missing
126
127 if(Boost_FOUND AND Boost_CONTEXT_FOUND)
128   # We should use feature detection for this instead:
129   if (Boost_VERSION LESS 105600)
130     message("Found Boost.Context API v1")
131     set(HAVE_BOOST_CONTEXT 1)
132   else()
133     message("Found Boost.Context API v2")
134     set(HAVE_BOOST_CONTEXT 2)
135   endif()
136 else()
137   message ("   boost        : found.")
138   message ("   boost-context: missing. Install libboost-context-dev for this optional feature.")
139   set(HAVE_BOOST_CONTEXT 0)
140 endif()
141
142 # Checks for header libraries functions.
143 CHECK_LIBRARY_EXISTS(dl      dlopen                  "" HAVE_DLOPEN_IN_LIBDL)
144 CHECK_LIBRARY_EXISTS(execinfo backtrace              "" HAVE_BACKTRACE_IN_LIBEXECINFO)
145 CHECK_LIBRARY_EXISTS(pthread pthread_create          "" HAVE_PTHREAD)
146 CHECK_LIBRARY_EXISTS(pthread sem_init                "" HAVE_SEM_INIT_LIB)
147 CHECK_LIBRARY_EXISTS(pthread sem_open                "" HAVE_SEM_OPEN_LIB)
148 CHECK_LIBRARY_EXISTS(pthread sem_timedwait           "" HAVE_SEM_TIMEDWAIT_LIB)
149 CHECK_LIBRARY_EXISTS(pthread pthread_mutex_timedlock "" HAVE_MUTEX_TIMEDLOCK_LIB)
150 CHECK_LIBRARY_EXISTS(rt      clock_gettime           "" HAVE_POSIX_GETTIME)
151
152 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
153   set(CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700 -D_DARWIN_C_SOURCE")
154 elseif(MINGW)
155   add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
156   set(CMAKE_REQUIRED_DEFINITIONS "-D__USE_MINGW_ANSI_STDIO=1")
157 else()
158   set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
159 endif()
160
161 CHECK_INCLUDE_FILES("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)
162 CHECK_INCLUDE_FILE("valgrind/valgrind.h" HAVE_VALGRIND_VALGRIND_H)
163 CHECK_INCLUDE_FILE("socket.h" HAVE_SOCKET_H)
164 CHECK_INCLUDE_FILE("stat.h" HAVE_STAT_H)
165 CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
166 CHECK_INCLUDE_FILE("windows.h" HAVE_WINDOWS_H)
167 CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H)
168 CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
169 CHECK_INCLUDE_FILE("execinfo.h" HAVE_EXECINFO_H)
170 CHECK_INCLUDE_FILE("signal.h" HAVE_SIGNAL_H)
171 CHECK_INCLUDE_FILE("sys/time.h" HAVE_SYS_TIME_H)
172 CHECK_INCLUDE_FILE("sys/param.h" HAVE_SYS_PARAM_H)
173 CHECK_INCLUDE_FILE("sys/sysctl.h" HAVE_SYS_SYSCTL_H)
174 CHECK_INCLUDE_FILE("time.h" HAVE_TIME_H)
175 CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H)
176 CHECK_INCLUDE_FILE("ucontext.h" HAVE_UCONTEXT_H)
177 CHECK_INCLUDE_FILE("stdio.h" HAVE_STDIO_H)
178 CHECK_INCLUDE_FILE("linux/futex.h" HAVE_FUTEX_H)
179
180 CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
181 CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)
182 CHECK_FUNCTION_EXISTS(getdtablesize HAVE_GETDTABLESIZE)
183 CHECK_FUNCTION_EXISTS(sysconf HAVE_SYSCONF)
184 CHECK_FUNCTION_EXISTS(readv HAVE_READV)
185 CHECK_FUNCTION_EXISTS(popen HAVE_POPEN)
186 CHECK_FUNCTION_EXISTS(signal HAVE_SIGNAL)
187
188 CHECK_SYMBOL_EXISTS(snprintf stdio.h HAVE_SNPRINTF)
189 CHECK_SYMBOL_EXISTS(vsnprintf stdio.h HAVE_VSNPRINTF)
190 CHECK_SYMBOL_EXISTS(asprintf stdio.h HAVE_ASPRINTF)
191 CHECK_SYMBOL_EXISTS(vasprintf stdio.h HAVE_VASPRINTF)
192
193 if(MINGW) 
194   # The detection of asprintf fails on MinGW, assumingly because it's
195   # defined as an inline function in stdio.h instead of a regular
196   # function. So force the result to be 1 despite of the test.
197   set(HAVE_ASPRINTF 1)
198   set(HAVE_VASPRINTF 1)
199 endif()
200
201 CHECK_FUNCTION_EXISTS(makecontext HAVE_MAKECONTEXT)
202 CHECK_FUNCTION_EXISTS(process_vm_readv HAVE_PROCESS_VM_READV)
203
204 CHECK_FUNCTION_EXISTS(mmap HAVE_MMAP)
205
206 #Check if __thread is defined
207 execute_process(
208   COMMAND "${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_thread_storage.c"
209   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
210   RESULT_VARIABLE HAVE_thread_storage_run
211   )
212
213 if(HAVE_thread_storage_run)
214   set(HAVE_THREAD_LOCAL_STORAGE 1)
215 else()
216   set(HAVE_THREAD_LOCAL_STORAGE 0)
217 endif()
218
219 # Our usage of mmap is Linux-specific (flag MAP_ANONYMOUS), but kFreeBSD uses a GNU libc
220 IF(HAVE_MMAP AND
221    NOT "${CMAKE_SYSTEM}" MATCHES "Linux" AND 
222    NOT "${CMAKE_SYSTEM}" MATCHES "kFreeBSD" AND 
223    NOT "${CMAKE_SYSTEM}" MATCHES "GNU" AND 
224    NOT  "${CMAKE_SYSTEM}" MATCHES "Darwin")
225   SET(HAVE_MMAP 0)
226   message(STATUS "Warning: MMAP is thought as non functional on this architecture (${CMAKE_SYSTEM})")
227 ENDIF()
228
229 if(HAVE_MMAP AND HAVE_THREAD_LOCAL_STORAGE)
230   SET(HAVE_MMALLOC 1)
231 else()
232   SET(HAVE_MMALLOC 0)
233 endif()
234
235
236 if(WIN32) # Those files are not detected despite being present
237   set(HAVE_UCONTEXT_H 1)
238   set(HAVE_MAKECONTEXT 1)
239   set(HAVE_SNPRINTF 1)
240   set(HAVE_VSNPRINTF 1)
241 endif()
242
243 set(CONTEXT_UCONTEXT 0)
244 SET(CONTEXT_THREADS 0)
245
246 if(enable_jedule)
247   SET(HAVE_JEDULE 1)
248 endif()
249
250 if(enable_latency_bound_tracking)
251   SET(HAVE_LATENCY_BOUND_TRACKING 1)
252 else()
253   SET(HAVE_LATENCY_BOUND_TRACKING 0)
254 endif()
255
256 if(enable_mallocators)
257   SET(MALLOCATOR_IS_WANTED 1)
258 else()
259   SET(MALLOCATOR_IS_WANTED 0)
260 endif()
261
262 if(enable_model-checking AND HAVE_MMALLOC)
263   SET(HAVE_MC 1)
264   SET(MMALLOC_WANT_OVERRIDE_LEGACY 1)
265   include(FindLibunwind)
266   include(FindLibdw)
267 else()
268   if(enable_model-checking)
269     message(STATUS "Warning: support for model-checking has been disabled because HAVE_MMALLOC is false")
270   endif()
271   SET(HAVE_MC 0)
272   SET(HAVE_MMALLOC 0)
273   SET(MMALLOC_WANT_OVERRIDE_LEGACY 0)
274 endif()
275
276 if(enable_smpi)
277   include(FindGFortran)
278   #really checks for objdump for privatization
279   find_package(BinUtils QUIET)
280   SET(HAVE_SMPI 1)
281
282   if( NOT "${CMAKE_OBJDUMP}" MATCHES "CMAKE_OBJDUMP-NOTFOUND" AND HAVE_MMAP)
283     SET(HAVE_PRIVATIZATION 1)
284   else()
285     SET(HAVE_PRIVATIZATION 0)
286   endif()
287 endif()
288
289 #--------------------------------------------------------------------------------------------------
290 ### Check for GNU dynamic linker
291 CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
292 if (HAVE_DLFCN_H)
293     if(HAVE_DLOPEN_IN_LIBDL)
294       set(DL_LIBRARY "-ldl")
295     endif(HAVE_DLOPEN_IN_LIBDL)
296     execute_process(COMMAND ${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_gnu_dynlinker.c ${DL_LIBRARY} -o test_gnu_ld
297       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
298       OUTPUT_VARIABLE HAVE_GNU_LD_compil
299     )
300     if(HAVE_GNU_LD_compil)
301       set(HAVE_GNU_LD 0)
302       message(STATUS "Warning: test program toward GNU ld failed to compile:")
303       message(STATUS "${HAVE_GNU_LD_comp_output}")
304     else()
305
306       execute_process(COMMAND ./test_gnu_ld
307           WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
308           RESULT_VARIABLE HAVE_GNU_LD_run
309           OUTPUT_VARIABLE var_exec
310       )
311
312       if(NOT HAVE_GNU_LD_run)
313         set(HAVE_GNU_LD 1)
314         message(STATUS "We are using GNU dynamic linker")
315       else()
316         set(HAVE_GNU_LD 0)
317         message(STATUS "Warning: error while checking for GNU ld:")
318         message(STATUS "Test output: '${var_exec}'")
319         message(STATUS "Exit status: ${HAVE_GNU_LD_run}")
320       endif()
321       file(REMOVE test_gnu_ld)
322     endif()
323 endif()
324
325
326 #--------------------------------------------------------------------------------------------------
327 ### Initialize of CONTEXT THREADS
328
329 if(HAVE_PTHREAD)
330   ### Test that we have a way to create semaphores
331
332   if(HAVE_SEM_OPEN_LIB)
333     execute_process(COMMAND ${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_sem_open.c -lpthread -o sem_open
334     WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
335     OUTPUT_VARIABLE HAVE_SEM_OPEN_compil
336     )
337
338     # Test sem_open by compiling:
339     if(HAVE_SEM_OPEN_compil)
340       set(HAVE_SEM_OPEN 0)
341       message(STATUS "Warning: sem_open not compilable")
342       message(STATUS "HAVE_SEM_OPEN_comp_output: ${HAVE_SEM_OPEN_comp_output}")
343     else()
344       set(HAVE_SEM_OPEN 1)
345       message(STATUS "sem_open is compilable")
346     endif()
347
348     # If we're not crosscompiling, we check by executing the program:
349     if (HAVE_SEM_OPEN AND NOT CMAKE_CROSSCOMPILING)
350       execute_process(COMMAND ./sem_open
351       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
352       RESULT_VARIABLE HAVE_SEM_OPEN_run
353       OUTPUT_VARIABLE var_compil
354       )
355       if (NOT HAVE_SEM_OPEN_run)
356         set(HAVE_SEM_OPEN 1)
357         message(STATUS "sem_open is executable")
358       else()
359         set(HAVE_SEM_OPEN 0)
360         if(EXISTS "${CMAKE_BINARY_DIR}/sem_open")
361           message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_open exists!")
362         else()
363           message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_open not exists!")
364         endif()
365         message(STATUS "Warning: sem_open not executable")
366         message(STATUS "Compilation output: '${var_compil}'")
367         message(STATUS "Exit result of sem_open: ${HAVE_SEM_OPEN_run}")
368       endif()
369     endif()
370     file(REMOVE sem_open)
371
372   else()
373     set(HAVE_SEM_OPEN 0)
374   endif()
375
376   if(HAVE_SEM_INIT_LIB)
377     execute_process(COMMAND ${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_sem_init.c -lpthread -o sem_init
378     WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
379     RESULT_VARIABLE HAVE_SEM_INIT_run OUTPUT_VARIABLE HAVE_SEM_INIT_compil)
380
381     # Test sem_init by compiling:
382     if(HAVE_SEM_INIT_compil)
383       set(HAVE_SEM_INIT 0)
384       message(STATUS "Warning: sem_init not compilable")
385       message(STATUS "HAVE_SEM_INIT_comp_output: ${HAVE_SEM_OPEN_comp_output}")
386     else()
387       set(HAVE_SEM_INIT 1)
388       message(STATUS "sem_init is compilable")
389     endif()
390
391     # If we're not crosscompiling, we check by executing the program:
392     if (HAVE_SEM_INIT AND NOT CMAKE_CROSSCOMPILING)
393       execute_process(COMMAND ./sem_init
394       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
395       RESULT_VARIABLE HAVE_SEM_INIT_run
396       OUTPUT_VARIABLE var_compil
397       )
398       if (NOT HAVE_SEM_INIT_run)
399         set(HAVE_SEM_INIT 1)
400         message(STATUS "sem_init is executable")
401       else()
402         set(HAVE_SEM_INIT 0)
403         if(EXISTS "${CMAKE_BINARY_DIR}/sem_init")
404           message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_init exists!")
405         else()
406           message(STATUS "Bin ${CMAKE_BINARY_DIR}/sem_init not exists!")
407         endif()
408         message(STATUS "Warning: sem_init not executable")
409         message(STATUS "Compilation output: '${var_compil}'")
410         message(STATUS "Exit result of sem_init: ${HAVE_SEM_INIT_run}")
411       endif()
412     endif()
413     file(REMOVE sem_init)
414   endif()
415
416   if(NOT HAVE_SEM_OPEN AND NOT HAVE_SEM_INIT)
417     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).")
418   endif()
419
420   ### Test that we have a way to timewait for semaphores
421
422   if(HAVE_SEM_TIMEDWAIT_LIB)
423
424     execute_process(
425       COMMAND "${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_sem_timedwait.c -lpthread"
426       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
427       OUTPUT_VARIABLE HAVE_SEM_TIMEDWAIT_run
428       )
429
430     if(HAVE_SEM_TIMEDWAIT_run)
431       set(HAVE_SEM_TIMEDWAIT 0)
432       message(STATUS "timedwait not compilable")
433     else()
434       set(HAVE_SEM_TIMEDWAIT 1)
435       message(STATUS "timedwait is compilable")
436     endif()
437   endif()
438
439   ### HAVE_MUTEX_TIMEDLOCK
440
441   if(HAVE_MUTEX_TIMEDLOCK_LIB)
442
443     execute_process(
444       COMMAND "${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_mutex_timedlock.c -lpthread"
445       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
446       OUTPUT_VARIABLE HAVE_MUTEX_TIMEDLOCK_run
447       )
448
449     if(HAVE_MUTEX_TIMEDLOCK_run)
450       set(HAVE_MUTEX_TIMEDLOCK 0)
451       message(STATUS "timedlock not compilable")
452     else()
453       message(STATUS "timedlock is compilable")
454       set(HAVE_MUTEX_TIMEDLOCK 1)
455     endif()
456   endif()
457 endif()
458
459 # This is needed for ucontext on MacOS X:
460 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
461   add_definitions(-D_XOPEN_SOURCE=700 -D_DARWIN_C_SOURCE)
462 endif()
463
464 if(WIN32)
465   # We always provide our own implementation of ucontext on Windows.
466   try_compile(HAVE_UCONTEXT
467     ${CMAKE_BINARY_DIR}
468     ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_AC_CHECK_MCSC.c
469     COMPILE_DEFINITIONS _XBT_WIN32
470     INCLUDE_DIRECTORIES
471       ${CMAKE_HOME_DIRECTORY}/src/include
472       ${CMAKE_HOME_DIRECTORY}/src/xbt
473   )
474 else()
475   # We always provide our own implementation of ucontext on Windows.
476   try_compile(HAVE_UCONTEXT
477     ${CMAKE_BINARY_DIR}
478     ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_AC_CHECK_MCSC.c)
479 endif()
480
481 #If can have both context
482
483 if(HAVE_UCONTEXT)
484   set(CONTEXT_UCONTEXT 1)
485   message("-- Support for ucontext factory")
486 endif()
487
488 if(HAVE_PTHREAD)
489   set(CONTEXT_THREADS 1)
490   message("-- Support for thread context factory")
491 endif()
492
493 ###############
494 ## GIT version check
495 ##
496 if(EXISTS ${CMAKE_HOME_DIRECTORY}/.git/)
497   execute_process(COMMAND git remote
498   COMMAND head -n 1
499   WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
500   OUTPUT_VARIABLE remote
501   RESULT_VARIABLE ret
502   )
503   string(REPLACE "\n" "" remote "${remote}")
504   #message(STATUS "Git remote: ${remote}")
505   execute_process(COMMAND git config --get remote.${remote}.url
506   WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
507   OUTPUT_VARIABLE url
508   RESULT_VARIABLE ret
509   )
510   string(REPLACE "\n" "" url "${url}")
511   #message(STATUS "Git url: ${url}")
512   if(url)
513     execute_process(COMMAND git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log --pretty=oneline --abbrev-commit -1
514     WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
515     OUTPUT_VARIABLE GIT_VERSION
516     RESULT_VARIABLE ret
517     )
518     string(REPLACE "\n" "" GIT_VERSION "${GIT_VERSION}")
519     message(STATUS "Git version: ${GIT_VERSION}")
520     execute_process(COMMAND git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log -n 1 --pretty=format:%ai .
521     WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
522     OUTPUT_VARIABLE GIT_DATE
523     RESULT_VARIABLE ret
524     )
525     string(REPLACE "\n" "" GIT_DATE "${GIT_DATE}")
526     message(STATUS "Git date: ${GIT_DATE}")
527     string(REGEX REPLACE " .*" "" GIT_VERSION "${GIT_VERSION}")
528     
529     execute_process(COMMAND git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log --pretty=format:%H -1
530                     WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/
531                     OUTPUT_VARIABLE SIMGRID_GITHASH
532                     RESULT_VARIABLE ret
533                     )
534     string(REPLACE "\n" "" SIMGRID_GITHASH "${SIMGRID_GITHASH}")
535                     
536   endif()
537 elseif(EXISTS ${CMAKE_HOME_DIRECTORY}/.gitversion)
538   FILE(STRINGS ${CMAKE_HOME_DIRECTORY}/.gitversion GIT_VERSION)
539 endif()
540
541 if(release)
542   set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER}\\nRelease build")
543 else()
544   set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER}\\nDevelopment build")
545 endif()
546 if(GIT_VERSION)
547   set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER} at commit ${GIT_VERSION}")
548 endif()
549 if(GIT_DATE)
550   set(SIMGRID_VERSION_BANNER "${SIMGRID_VERSION_BANNER} (${GIT_DATE})")
551 endif()
552 #--------------------------------------------------------------------------------------------------
553
554 set(makecontext_CPPFLAGS_2 "")
555 if(HAVE_MAKECONTEXT OR WIN32)
556   set(makecontext_CPPFLAGS "-DTEST_makecontext")
557   if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
558     set(makecontext_CPPFLAGS_2 "-D_XOPEN_SOURCE=700")
559   endif()
560
561   if(WIN32)
562     if(ARCH_32_BITS)
563       set(makecontext_CPPFLAGS "-DTEST_makecontext -D_I_X86_")
564     else()
565       set(makecontext_CPPFLAGS "-DTEST_makecontext -D_AMD64_")
566     endif()
567     set(makecontext_CPPFLAGS_2 "-D_XBT_WIN32 -I${CMAKE_HOME_DIRECTORY}/src/include -I${CMAKE_HOME_DIRECTORY}/src/xbt")
568   endif()
569
570   file(REMOVE ${CMAKE_BINARY_DIR}/conftestval)
571
572   if(CMAKE_CROSSCOMPILING)
573     set(RUN_makecontext_VAR "cross")
574     set(COMPILE_makecontext_VAR "cross")
575   else()
576     try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR
577       ${CMAKE_BINARY_DIR}
578       ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_stacksetup.c
579       COMPILE_DEFINITIONS "${makecontext_CPPFLAGS} ${makecontext_CPPFLAGS_2}"
580       )
581   endif()
582
583   if(EXISTS ${CMAKE_BINARY_DIR}/conftestval)
584     file(READ ${CMAKE_BINARY_DIR}/conftestval MAKECONTEXT_ADDR_SIZE)
585     string(REPLACE "\n" "" MAKECONTEXT_ADDR_SIZE "${MAKECONTEXT_ADDR_SIZE}")
586     string(REGEX MATCH ;^.*,;MAKECONTEXT_ADDR "${MAKECONTEXT_ADDR_SIZE}")
587     string(REGEX MATCH ;,.*$; MAKECONTEXT_SIZE "${MAKECONTEXT_ADDR_SIZE}")
588     string(REPLACE "," "" makecontext_addr "${MAKECONTEXT_ADDR}")
589     string(REPLACE "," "" makecontext_size "${MAKECONTEXT_SIZE}")
590     set(pth_skaddr_makecontext "#define pth_skaddr_makecontext(skaddr,sksize) (${makecontext_addr})")
591     set(pth_sksize_makecontext "#define pth_sksize_makecontext(skaddr,sksize) (${makecontext_size})")
592     message(STATUS "${pth_skaddr_makecontext}")
593     message(STATUS "${pth_sksize_makecontext}")
594   else()
595     # message(FATAL_ERROR "makecontext is not compilable")
596   endif()
597 endif()
598
599 #--------------------------------------------------------------------------------------------------
600
601 ### check for stackgrowth
602 if (NOT CMAKE_CROSSCOMPILING)
603   try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR
604     ${CMAKE_BINARY_DIR}
605     ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_stackgrowth.c
606     RUN_OUTPUT_VARIABLE stack
607     )
608 endif()
609 if("${stack}" STREQUAL "down")
610   set(PTH_STACKGROWTH "-1")
611 elseif("${stack}" STREQUAL "up")
612   set(PTH_STACKGROWTH "1")
613 else()
614   if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
615     set(PTH_STACKGROWTH "-1")
616   elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686")
617     set(PTH_STACKGROWTH "-1")
618   else()
619     message(ERROR "Could not figure the stack direction.")
620   endif()
621 endif()
622
623 ###############
624 ## System checks
625 ##
626
627 #SG_CONFIGURE_PART([System checks...])
628 #AC_PROG_CC(xlC gcc cc) -auto
629 #AM_SANITY_CHECK -auto
630
631 #AC_PROG_MAKE_SET
632
633 #AC_CHECK_VA_COPY
634
635 set(diff_va "va_copy((d),(s))"
636   "VA_COPY((d),(s))"
637   "__va_copy((d),(s))"
638   "__builtin_va_copy((d),(s))"
639   "do { (d) = (s)\; } while (0)"
640   "do { *(d) = *(s)\; } while (0)"
641   "memcpy((void *)&(d), (void *)&(s), sizeof(s))"
642   "memcpy((void *)(d), (void *)(s), sizeof(*(s)))"
643   )
644
645 foreach(fct ${diff_va})
646   write_file("${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_va_copy.c" "#include <stdlib.h>
647 #include <stdarg.h>
648 #include <string.h>
649 #define DO_VA_COPY(d,s) ${fct}
650 void test(char *str, ...)
651 {
652   va_list ap, ap2;
653   int i;
654   va_start(ap, str);
655   DO_VA_COPY(ap2, ap);
656   for (i = 1; i <= 9; i++) {
657     int k = (int)va_arg(ap, int);
658     if (k != i)
659       abort();
660   }
661   DO_VA_COPY(ap, ap2);
662   for (i = 1; i <= 9; i++) {
663     int k = (int)va_arg(ap, int);
664     if (k != i)
665       abort();
666   }
667   va_end(ap);
668 }
669 int main(void)
670 {
671   test(\"test\", 1, 2, 3, 4, 5, 6, 7, 8, 9);
672   exit(0);
673 }"
674     )
675
676   execute_process(
677   COMMAND ${CMAKE_C_COMPILER} "${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_va_copy.c"
678   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
679   RESULT_VARIABLE COMPILE_VA_NULL_VAR
680   OUTPUT_QUIET
681   ERROR_QUIET
682   )
683
684   if(NOT COMPILE_VA_NULL_VAR)
685     string(REGEX REPLACE "\;" "" fctbis ${fct})
686     if(${fctbis} STREQUAL "va_copy((d),(s))")
687       set(HAVE_VA_COPY 1)
688       set(ac_cv_va_copy "C99")
689       set(__VA_COPY_USE_C99 "va_copy((d),(s))")
690     endif()
691
692     if(${fctbis} STREQUAL "VA_COPY((d),(s))")
693       set(ac_cv_va_copy "GCM")
694       set(__VA_COPY_USE_GCM "VA_COPY((d),(s))")
695     endif()
696
697     if(${fctbis} STREQUAL "__va_copy((d),(s))")
698       set(ac_cv_va_copy "GCH")
699       set(__VA_COPY_USE_GCH "__va_copy((d),(s))")
700     endif()
701
702     if(${fctbis} STREQUAL "__builtin_va_copy((d),(s))")
703       set(ac_cv_va_copy "GCB")
704       set(__VA_COPY_USE_GCB "__builtin_va_copy((d),(s))")
705     endif()
706
707     if(${fctbis} STREQUAL "do { (d) = (s) } while (0)")
708       set(ac_cv_va_copy "ASS")
709       set(__VA_COPY_USE_ASS "do { (d) = (s); } while (0)")
710     endif()
711
712     if(${fctbis} STREQUAL "do { *(d) = *(s) } while (0)")
713       set(ac_cv_va_copy "ASP")
714       set(__VA_COPY_USE_ASP "do { *(d) = *(s); } while (0)")
715     endif()
716
717     if(${fctbis} STREQUAL "memcpy((void *)&(d), (void *)&(s), sizeof(s))")
718       set(ac_cv_va_copy "CPS")
719       set(__VA_COPY_USE_CPS "memcpy((void *)&(d), (void *)&(s), sizeof(s))")
720     endif()
721
722     if(${fctbis} STREQUAL "memcpy((void *)(d), (void *)(s), sizeof(*(s)))")
723       set(ac_cv_va_copy "CPP")
724       set(__VA_COPY_USE_CPP "memcpy((void *)(d), (void *)(s), sizeof(*(s)))")
725     endif()
726
727     if(NOT STATUS_OK)
728       set(__VA_COPY_USE "__VA_COPY_USE_${ac_cv_va_copy}(d, s)")
729     endif()
730     set(STATUS_OK "1")
731
732   endif()
733
734 endforeach(fct ${diff_va})
735
736 #--------------------------------------------------------------------------------------------------
737 ### check for a working snprintf
738 if(HAVE_SNPRINTF AND HAVE_VSNPRINTF OR WIN32)
739   if(WIN32)
740     #set(HAVE_SNPRINTF 1)
741     #set(HAVE_VSNPRINTF 1)
742   endif()
743
744   if(CMAKE_CROSSCOMPILING)
745     set(RUN_SNPRINTF_FUNC "cross")
746     #set(PREFER_PORTABLE_SNPRINTF 1)
747   else()
748     try_run(RUN_SNPRINTF_FUNC_VAR COMPILE_SNPRINTF_FUNC_VAR
749       ${CMAKE_BINARY_DIR}
750       ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_snprintf.c
751       )
752   endif()
753
754   if(CMAKE_CROSSCOMPILING)
755     set(RUN_VSNPRINTF_FUNC "cross")
756     set(PREFER_PORTABLE_VSNPRINTF 1)
757   else()
758     try_run(RUN_VSNPRINTF_FUNC_VAR COMPILE_VSNPRINTF_FUNC_VAR
759       ${CMAKE_BINARY_DIR}
760       ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_vsnprintf.c
761       )
762   endif()
763
764   set(PREFER_PORTABLE_SNPRINTF 0)
765   if(RUN_VSNPRINTF_FUNC_VAR MATCHES "FAILED_TO_RUN")
766     set(PREFER_PORTABLE_SNPRINTF 1)
767   endif()
768   if(RUN_SNPRINTF_FUNC_VAR MATCHES "FAILED_TO_RUN")
769     set(PREFER_PORTABLE_SNPRINTF 1)
770   endif()
771 endif()
772
773 ### check for asprintf function familly
774 if(HAVE_ASPRINTF)
775   SET(simgrid_need_asprintf "")
776   SET(NEED_ASPRINTF 0)
777 else()
778   SET(simgrid_need_asprintf "#define SIMGRID_NEED_ASPRINTF 1")
779   SET(NEED_ASPRINTF 1)
780 endif()
781
782 if(HAVE_VASPRINTF)
783   SET(simgrid_need_vasprintf "")
784   SET(NEED_VASPRINTF 0)
785 else()
786   SET(simgrid_need_vasprintf "#define SIMGRID_NEED_VASPRINTF 1")
787   SET(NEED_VASPRINTF 1)
788 endif()
789
790 ### check for addr2line
791
792 find_path(ADDR2LINE NAMES addr2line     PATHS NO_DEFAULT_PATHS  )
793 if(ADDR2LINE)
794   set(ADDR2LINE "${ADDR2LINE}/addr2line")
795 endif()
796
797 ### File to create
798
799 configure_file("${CMAKE_HOME_DIRECTORY}/src/context_sysv_config.h.in"
800   "${CMAKE_BINARY_DIR}/src/context_sysv_config.h" @ONLY IMMEDIATE)
801
802 SET( CMAKEDEFINE "#cmakedefine" )
803 configure_file("${CMAKE_HOME_DIRECTORY}/tools/cmake/src/internal_config.h.in" "${CMAKE_BINARY_DIR}/src/internal_config.h" @ONLY IMMEDIATE)
804 configure_file("${CMAKE_BINARY_DIR}/src/internal_config.h" "${CMAKE_BINARY_DIR}/src/internal_config.h" @ONLY IMMEDIATE)
805 configure_file("${CMAKE_HOME_DIRECTORY}/include/simgrid_config.h.in" "${CMAKE_BINARY_DIR}/include/simgrid_config.h" @ONLY IMMEDIATE)
806
807 set(top_srcdir "${CMAKE_HOME_DIRECTORY}")
808 set(srcdir "${CMAKE_HOME_DIRECTORY}/src")
809 set(bindir "${CMAKE_BINARY_DIR}")
810
811 ### Script used when simgrid is installed
812 set(exec_prefix ${CMAKE_INSTALL_PREFIX})
813 set(includeflag "-I${CMAKE_INSTALL_PREFIX}/include -I${CMAKE_INSTALL_PREFIX}/include/smpi")
814 set(includedir "${CMAKE_INSTALL_PREFIX}/include")
815 set(libdir ${exec_prefix}/lib)
816 set(CMAKE_SMPI_COMMAND "export LD_LIBRARY_PATH=\"${CMAKE_INSTALL_PREFIX}/lib")
817 if(NS3_LIBRARY_PATH)
818   set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${NS3_LIBRARY_PATH}")
819 endif()
820 set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:\${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}\"")
821
822 file(READ ${CMAKE_HOME_DIRECTORY}/src/smpi/smpitools.sh SMPITOOLS_SH)
823 configure_file(${CMAKE_HOME_DIRECTORY}/include/smpi/mpif.h.in ${CMAKE_BINARY_DIR}/include/smpi/mpif.h @ONLY)
824 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_BINARY_DIR}/bin/smpicc @ONLY)
825 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicxx.in ${CMAKE_BINARY_DIR}/bin/smpicxx @ONLY)
826 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpiff.in ${CMAKE_BINARY_DIR}/bin/smpiff @ONLY)
827 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif90.in ${CMAKE_BINARY_DIR}/bin/smpif90 @ONLY)
828 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpirun.in ${CMAKE_BINARY_DIR}/bin/smpirun @ONLY)
829
830 ### Script used when simgrid is compiling
831 set(includeflag "-I${CMAKE_HOME_DIRECTORY}/include -I${CMAKE_HOME_DIRECTORY}/include/smpi")
832 set(includeflag "${includeflag} -I${CMAKE_BINARY_DIR}/include -I${CMAKE_BINARY_DIR}/include/smpi")
833 set(includedir "${CMAKE_HOME_DIRECTORY}/include")
834 set(exec_prefix "${CMAKE_BINARY_DIR}/smpi_script/")
835 set(CMAKE_SMPI_COMMAND "export LD_LIBRARY_PATH=\"${CMAKE_BINARY_DIR}/lib")
836 if(NS3_LIBRARY_PATH)
837   set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:${NS3_LIBRARY_PATH}")
838 endif()
839 set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:\${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}\"")
840 set(libdir "${CMAKE_BINARY_DIR}/lib")
841
842 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc @ONLY)
843 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicxx.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicxx @ONLY)
844 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpiff.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff @ONLY)
845 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif90.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpif90 @ONLY)
846 configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpirun.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun @ONLY)
847
848 set(top_builddir ${CMAKE_HOME_DIRECTORY})
849
850 if(NOT WIN32)
851   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpicc)
852   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpicxx)
853   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpiff)
854   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpif90)
855   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpirun)
856   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc)
857   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicxx)
858   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff)
859   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpif90)
860   execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun)
861 endif()
862
863 set(generated_headers_to_install
864   ${CMAKE_CURRENT_BINARY_DIR}/include/smpi/mpif.h
865   ${CMAKE_CURRENT_BINARY_DIR}/include/simgrid_config.h
866   )
867
868 set(generated_headers
869   ${CMAKE_CURRENT_BINARY_DIR}/src/context_sysv_config.h
870   ${CMAKE_CURRENT_BINARY_DIR}/src/internal_config.h
871   )
872
873 set(generated_files_to_clean
874   ${generated_headers}
875   ${generated_headers_to_install}
876   ${CMAKE_BINARY_DIR}/bin/smpicc
877   ${CMAKE_BINARY_DIR}/bin/smpicxx
878   ${CMAKE_BINARY_DIR}/bin/smpiff
879   ${CMAKE_BINARY_DIR}/bin/smpif90
880   ${CMAKE_BINARY_DIR}/bin/smpirun
881   ${CMAKE_BINARY_DIR}/bin/colorize
882   ${CMAKE_BINARY_DIR}/bin/simgrid_update_xml
883   ${CMAKE_BINARY_DIR}/examples/smpi/tracing/smpi_traced.trace
884   )
885
886 if(NOT "${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_HOME_DIRECTORY}")
887   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions0.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions0.txt COPYONLY)
888   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions1.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions1.txt COPYONLY)
889   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_allReduce.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allReduce.txt COPYONLY)
890   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_barrier.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_barrier.txt COPYONLY)
891   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_bcast.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_bcast.txt COPYONLY)
892   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_with_isend.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_with_isend.txt COPYONLY)
893   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_alltoall.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoall.txt COPYONLY)
894   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_alltoallv.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoallv.txt COPYONLY)
895   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_waitall.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_waitall.txt COPYONLY)
896   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_reducescatter.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_reducescatter.txt COPYONLY)
897   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_gather.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_gather.txt COPYONLY)
898   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_allgatherv.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allgatherv.txt COPYONLY)
899   configure_file(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/hostfile ${CMAKE_BINARY_DIR}/teshsuite/smpi/hostfile COPYONLY)
900   
901   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/description_file ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/description_file COPYONLY)
902   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/README ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/README COPYONLY)
903   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/smpi_replay.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/smpi_replay.txt COPYONLY)
904   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace0.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace0.txt COPYONLY)
905   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace1.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace1.txt COPYONLY)
906   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace2.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace2.txt COPYONLY)
907   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace3.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace3.txt COPYONLY)
908   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace4.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace4.txt COPYONLY)
909   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace5.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace5.txt COPYONLY)
910   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace6.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace6.txt COPYONLY)
911   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace7.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace7.txt COPYONLY)
912   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace8.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace8.txt COPYONLY)
913   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace9.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace9.txt COPYONLY)
914   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace10.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace10.txt COPYONLY)
915   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace11.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace11.txt COPYONLY)
916   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace12.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace12.txt COPYONLY)
917   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace13.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace13.txt COPYONLY)
918   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace14.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace14.txt COPYONLY)
919   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace15.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace15.txt COPYONLY)
920   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace16.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace16.txt COPYONLY)
921   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace17.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace17.txt COPYONLY)
922   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace18.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace18.txt COPYONLY)
923   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace19.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace19.txt COPYONLY)
924   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace20.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace20.txt COPYONLY)
925   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace21.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace21.txt COPYONLY)
926   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace22.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace22.txt COPYONLY)
927   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace23.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace23.txt COPYONLY)
928   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace24.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace24.txt COPYONLY)
929   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace25.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace25.txt COPYONLY)
930   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace26.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace26.txt COPYONLY)
931   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace27.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace27.txt COPYONLY)
932   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace28.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace28.txt COPYONLY)
933   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace29.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace29.txt COPYONLY)
934   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace30.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace30.txt COPYONLY)
935   configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace31.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace31.txt 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}/examples/smpi/replay/actions_gather.txt
949     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allgatherv.txt
950     ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_reducescatter.txt
951     ${CMAKE_BINARY_DIR}/teshsuite/smpi/hostfile
952     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/description_file
953     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/README
954     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/smpi_replay.txt
955     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace0.txt
956     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace1.txt
957     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace2.txt
958     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace3.txt
959     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace4.txt
960     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace5.txt
961     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace6.txt
962     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace7.txt
963     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace8.txt
964     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace9.txt
965     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace10.txt
966     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace11.txt
967     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace12.txt
968     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace13.txt
969     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace14.txt
970     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace15.txt
971     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace16.txt
972     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace17.txt
973     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace18.txt
974     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace19.txt
975     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace20.txt
976     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace21.txt
977     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace22.txt
978     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace23.txt
979     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace24.txt
980     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace25.txt
981     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace26.txt
982     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace27.txt
983     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace28.txt
984     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace29.txt
985     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace30.txt
986     ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace31.txt
987     )
988 endif()
989
990 SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
991   "${generated_files_to_clean}")
992
993 IF(${ARCH_32_BITS})
994   set(WIN_ARCH "32")
995 ELSE()
996   set(WIN_ARCH "64")
997 ENDIF()
998 configure_file("${CMAKE_HOME_DIRECTORY}/tools/cmake/src/simgrid.nsi.in" "${CMAKE_BINARY_DIR}/simgrid.nsi" @ONLY IMMEDIATE)