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-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)
13 set(_actor-stacksize_factories "raw;boost;ucontext") # Threads ignore modifications of the stack size
15 # The maestro-set example only works for threads and when not using windows.
16 set(_maestro-set_factories "thread")
18 set(_maestro-set_disable 1)
21 foreach (example mc-failing-assert)
22 if(NOT SIMGRID_HAVE_MC)
23 set(_${example}_disable 1)
25 set(_${example}_factories "ucontext;raw;boost")
28 # Deal with each example
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
35 cloud-capping cloud-migration cloud-simple
36 dht-chord dht-kademlia
37 energy-exec energy-boot energy-link energy-vm energy-exec-ptask
39 exec-async exec-basic exec-dvfs exec-ptask exec-remote exec-waitany exec-waitfor exec-dependent
42 io-async io-file-system io-file-remote io-disk-raw io-dependent
43 platform-failures platform-profile platform-properties
47 synchro-barrier synchro-condition-variable synchro-mutex synchro-semaphore)
49 # Use default source file unless specified otherwise
50 if(NOT DEFINED _${example}_sources)
51 set(_${example}_sources ${example}/s4u-${example}.cpp)
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})
60 # Use default factories unless specified otherwise
61 if(NOT DEFINED _${example}_factories)
62 set(_${example}_factories "thread;ucontext;raw;boost")
64 # message("Factories of ${example}: ${_${example}_factories}")
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)
72 message(STATUS "Example ${example} disabled, thus not compiled.")
73 unset(_${example}_disabled)
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})
81 unset(_${example}_factories)
82 unset(_${example}_sources)
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})
96 set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworkers/s4u-app-masterworkers-${variant}.cpp)
98 set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworkers/s4u-app-masterworkers.tesh)
102 # The tests the parallel variant of of DHTs
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")
109 set(parallel-factories "thread;ucontext;raw;boost")
112 foreach(example app-bittorrent app-masterworkers
113 dht-chord dht-kademlia
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)
122 # Examples not accepting factories
123 ##################################
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})
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)
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)
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)
145 # Add all extra files to the archive
146 ####################################
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
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)