Logo AND Algorithmique Numérique Distribuée

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