Logo AND Algorithmique Numérique Distribuée

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