Logo AND Algorithmique Numérique Distribuée

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