Logo AND Algorithmique Numérique Distribuée

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