Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
78ff494c20f43072159bf9765213475edd617289
[simgrid.git] / examples / s4u / CMakeLists.txt
1
2 # Regular examples: with only one source and tested with all factories by default
3 #################################################################################
4 ### Define the examples' specificities
5
6 set(_app-bittorrent_sources app-bittorrent/s4u-bittorrent.cpp app-bittorrent/s4u-bittorrent.hpp
7                             app-bittorrent/s4u-peer.cpp app-bittorrent/s4u-peer.hpp
8                             app-bittorrent/s4u-tracker.cpp app-bittorrent/s4u-tracker.hpp)
9 set(_dht-chord_sources    dht-chord/s4u-dht-chord.cpp dht-chord/s4u-dht-chord-node.cpp)
10 set(_dht-kademlia_sources dht-kademlia/s4u-dht-kademlia.cpp dht-kademlia/node.cpp
11                           dht-kademlia/routing_table.cpp dht-kademlia/answer.cpp dht-kademlia/message.hpp)
12
13 set(_actor-stacksize_factories "raw;boost;ucontext") # Threads ignore modifications of the stack size
14
15 # The maestro-set example only works for threads and when not using windows.
16 set(_maestro-set_factories "thread")
17 if(WIN32)
18   set(_maestro-set_disable 1)
19 endif()
20
21 foreach (example mc-failing-assert)
22   if(NOT SIMGRID_HAVE_MC)
23     set(_${example}_disable 1)
24   endif()
25   set(_${example}_factories "ucontext;raw;boost")
26 endforeach()
27
28 # Deal with each example
29
30 foreach (example actor-create actor-daemon actor-exiting actor-join actor-kill
31                  actor-lifetime actor-migrate actor-suspend actor-yield actor-stacksize
32                  app-bittorrent app-chainsend app-pingpong app-token-ring
33                  async-ready async-wait async-waitany async-waitall async-waituntil
34                  comm-dependent
35                  cloud-capping cloud-migration cloud-simple
36                  dht-chord dht-kademlia
37                  energy-exec energy-boot energy-link energy-vm energy-exec-ptask
38                  engine-filtering
39                  exec-async exec-basic exec-dvfs exec-ptask exec-remote exec-waitany exec-waitfor exec-dependent
40                  maestro-set
41                  mc-failing-assert
42                  io-async io-file-system io-file-remote io-disk-raw io-dependent
43                  platform-failures platform-profile platform-properties
44                  plugin-hostload
45                  replay-comm replay-io
46                  routing-get-clusters
47                  synchro-barrier synchro-condition-variable synchro-mutex synchro-semaphore)
48
49   # Use default source file unless specified otherwise
50   if(NOT DEFINED _${example}_sources)
51     set(_${example}_sources ${example}/s4u-${example}.cpp)
52   endif()
53
54   if(NOT DEFINED _${example}_disable)
55     add_executable       (s4u-${example} EXCLUDE_FROM_ALL ${_${example}_sources})
56     add_dependencies     (tests s4u-${example})
57     target_link_libraries(s4u-${example} simgrid)
58     set_target_properties(s4u-${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example})
59
60     # Use default factories unless specified otherwise
61     if(NOT DEFINED _${example}_factories)
62       set(_${example}_factories "thread;ucontext;raw;boost")
63     endif()
64 #    message("Factories of ${example}: ${_${example}_factories}")
65
66     ADD_TESH_FACTORIES(s4u-${example} "${_${example}_factories}"
67                                       --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example} 
68                                       --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms 
69                                       --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example} 
70                                       ${CMAKE_HOME_DIRECTORY}/examples/s4u/${example}/s4u-${example}.tesh)
71   else()
72     message(STATUS "Example ${example} disabled, thus not compiled.")
73     unset(_${example}_disabled)
74   endif()
75
76   set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u-${example}.tesh)
77   foreach(file ${_${example}_sources})
78     set(examples_src  ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${file})
79   endforeach()
80
81   unset(_${example}_factories)
82   unset(_${example}_sources)
83 endforeach()
84
85
86 # Specific examples
87 ###################
88
89 # MASTERWORKERS EXAMPLE
90 foreach(variant fun class) 
91   add_executable       (s4u-app-masterworkers-${variant} EXCLUDE_FROM_ALL app-masterworkers/s4u-app-masterworkers-${variant}.cpp)
92   target_link_libraries(s4u-app-masterworkers-${variant} simgrid)
93   set_target_properties(s4u-app-masterworkers-${variant} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/app-masterworkers)
94   add_dependencies(tests s4u-app-masterworkers-${variant})
95
96   set(examples_src  ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworkers/s4u-app-masterworkers-${variant}.cpp)
97 endforeach()
98 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworkers/s4u-app-masterworkers.tesh)
99
100
101
102 # The tests the parallel variant of of DHTs
103
104 if(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "i386" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
105   # Thread-local storage (TLS) is needed for parallel execution, but it doesn't
106   # play well with Ucontexts on 64bit SunOS (at least on x86_64).
107   set(parallel-factories "thread;raw;boost")
108 else()
109   set(parallel-factories "thread;ucontext;raw;boost")
110 endif()
111
112 foreach(example app-bittorrent app-masterworkers 
113                 dht-chord dht-kademlia
114                 )
115   ADD_TESH_FACTORIES(s4u-${example}-parallel "${parallel-factories}" --cfg contexts/nthreads:4 ${CONTEXTS_SYNCHRO}
116                                              --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example} 
117                                              --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms 
118                                              --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example} 
119                                              ${CMAKE_HOME_DIRECTORY}/examples/s4u/${example}/s4u-${example}.tesh)
120 endforeach()
121
122 # Examples not accepting factories
123 ##################################
124
125 foreach (example trace-platform)
126   add_executable       (s4u-${example} EXCLUDE_FROM_ALL ${example}/s4u-${example}.cpp)
127   target_link_libraries(s4u-${example} simgrid)
128   set_target_properties(s4u-${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example})
129   add_dependencies(tests s4u-${example})
130
131   set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u-${example}.tesh)
132   set(examples_src  ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u-${example}.cpp)
133   
134   ADD_TESH(s4u-${example} --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
135                           --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms 
136                           ${CMAKE_HOME_DIRECTORY}/examples/s4u/${example}/s4u-${example}.tesh)
137 endforeach()
138
139 if (NOT enable_memcheck AND NOT WIN32)
140   ADD_TESH(simix-breakpoint --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/app-pingpong
141                             --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
142                             ${CMAKE_CURRENT_SOURCE_DIR}/app-pingpong/simix-breakpoint.tesh)
143 endif()
144
145 # Add all extra files to the archive
146 ####################################
147
148 set(examples_src  ${examples_src}                                                                          PARENT_SCOPE)
149 set(tesh_files    ${tesh_files}   ${CMAKE_CURRENT_SOURCE_DIR}/app-pingpong/simix-breakpoint.tesh           PARENT_SCOPE)
150 set(xml_files     ${xml_files}    ${CMAKE_CURRENT_SOURCE_DIR}/actor-create/s4u-actor-create_d.xml
151                                   ${CMAKE_CURRENT_SOURCE_DIR}/actor-lifetime/s4u-actor-lifetime_d.xml
152                                   ${CMAKE_CURRENT_SOURCE_DIR}/actor-yield/s4u-actor-yield_d.xml
153                                   ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/s4u-app-bittorrent_d.xml
154                                   ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworkers/s4u-app-masterworkers_d.xml
155                                   ${CMAKE_CURRENT_SOURCE_DIR}/async-wait/s4u-async-wait_d.xml
156                                   ${CMAKE_CURRENT_SOURCE_DIR}/async-waitany/s4u-async-waitany_d.xml
157                                   ${CMAKE_CURRENT_SOURCE_DIR}/async-waitall/s4u-async-waitall_d.xml
158                                   ${CMAKE_CURRENT_SOURCE_DIR}/async-ready/s4u-async-ready_d.xml
159                                   ${CMAKE_CURRENT_SOURCE_DIR}/async-waituntil/s4u-async-waituntil_d.xml
160                                   ${CMAKE_CURRENT_SOURCE_DIR}/dht-chord/s4u-dht-chord_d.xml
161                                   ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/s4u-dht-kademlia_d.xml
162                                   ${CMAKE_CURRENT_SOURCE_DIR}/energy-boot/platform_boot.xml
163                                   ${CMAKE_CURRENT_SOURCE_DIR}/io-file-remote/s4u-io-file-remote_d.xml
164                                   ${CMAKE_CURRENT_SOURCE_DIR}/platform-properties/s4u-platform-properties_d.xml
165                                   ${CMAKE_CURRENT_SOURCE_DIR}/platform-failures/s4u-platform-failures_d.xml
166                                   ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm-split_d.xml
167                                   ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm_d.xml
168                                   ${CMAKE_CURRENT_SOURCE_DIR}/replay-io/s4u-replay-io_d.xml
169                   PARENT_SCOPE)
170 set(bin_files     ${bin_files}    ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/generate.py                     PARENT_SCOPE)
171 set(txt_files     ${txt_files}    ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm-split-p0.txt
172                                   ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm-split-p1.txt
173                                   ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm.txt
174                                   ${CMAKE_CURRENT_SOURCE_DIR}/replay-io/s4u-replay-io.txt                  PARENT_SCOPE)
175