Logo AND Algorithmique Numérique Distribuée

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