Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix make distcheck and pip builds, again
[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 # Deal with each example
31
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
36                  comm-dependent
37                  cloud-capping cloud-migration cloud-simple
38                  dht-chord dht-kademlia
39                  energy-exec energy-boot energy-link energy-vm energy-exec-ptask
40                  engine-filtering
41                  exec-async exec-basic exec-dvfs exec-ptask exec-remote exec-waitany exec-waitfor exec-dependent
42                  maestro-set
43                  mc-failing-assert
44                  io-async io-file-system io-file-remote io-disk-raw io-dependent
45                  platform-failures platform-profile platform-properties
46                  plugin-hostload
47                  replay-comm replay-io
48                  routing-get-clusters
49                  synchro-barrier synchro-condition-variable synchro-mutex synchro-semaphore)
50
51   # Use default source file unless specified otherwise
52   if(NOT DEFINED _${example}_sources)
53     set(_${example}_sources ${example}/s4u-${example}.cpp)
54   endif()
55
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})
61
62     # Use default factories unless specified otherwise
63     if(NOT DEFINED _${example}_factories)
64       set(_${example}_factories "thread;ucontext;raw;boost")
65     endif()
66 #    message("Factories of ${example}: ${_${example}_factories}")
67
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)
73   else()
74     message(STATUS "Example ${example} disabled, thus not compiled.")
75     unset(_${example}_disabled)
76   endif()
77
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})
81   endforeach()
82
83   unset(_${example}_factories)
84   unset(_${example}_sources)
85 endforeach()
86
87
88 # Specific examples
89 ###################
90
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})
97
98   set(examples_src  ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworkers/s4u-app-masterworkers-${variant}.cpp)
99 endforeach()
100 set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworkers/s4u-app-masterworkers.tesh)
101
102
103
104 # The tests the parallel variant of of DHTs
105
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")
110 else()
111   set(parallel-factories "thread;ucontext;raw;boost")
112 endif()
113
114 foreach(example app-bittorrent app-masterworkers 
115                 dht-chord dht-kademlia
116                 )
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)
122 endforeach()
123
124 # Examples not accepting factories
125 ##################################
126
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})
132
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)
135   
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)
139 endforeach()
140
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)
145 endif()
146
147 # Add all extra files to the archive
148 ####################################
149
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
171                   PARENT_SCOPE)
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)
177