Logo AND Algorithmique Numérique Distribuée

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