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