Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
do not build the examples by default, only when running 'make tests'
[simgrid.git] / examples / msg / CMakeLists.txt
1 # C examples
2 foreach(x app-masterworker cloud-masterworker
3           dht-pastry energy-vm platform-failures 
4           process-create 
5           synchro-semaphore trace-categories 
6           trace-route-user-variables trace-link-user-variables trace-masterworker
7           trace-process-migration trace-host-user-variables)
8   add_executable       (${x}  EXCLUDE_FROM_ALL ${x}/${x}.c)
9   target_link_libraries(${x}  simgrid)
10   set_target_properties(${x}  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
11   add_dependencies(tests ${x})
12   set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.c)
13   set(tesh_files   ${tesh_files}   ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
14 endforeach()
15
16 # CPP examples
17 foreach(x maestro-set)
18   add_executable       (${x}  EXCLUDE_FROM_ALL ${x}/${x}.cpp)
19   target_link_libraries(${x}     simgrid)
20   set_target_properties(${x}  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
21   add_dependencies(tests ${x})
22   set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.cpp)
23   set(tesh_files   ${tesh_files}   ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
24 endforeach()
25
26 if(SIMGRID_HAVE_NS3)
27   add_executable       (network-ns3 EXCLUDE_FROM_ALL network-ns3/network-ns3.c)
28   target_link_libraries(network-ns3 simgrid)
29   set_target_properties(network-ns3  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/network-ns3)
30   add_dependencies(tests network-ns3)    
31 endif()
32
33 add_executable       (dht-kademlia EXCLUDE_FROM_ALL dht-kademlia/dht-kademlia.c dht-kademlia/node.c dht-kademlia/routing_table.c dht-kademlia/task.c dht-kademlia/answer.c)
34 target_link_libraries(dht-kademlia simgrid)
35 set_target_properties(dht-kademlia PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dht-kademlia)
36 add_dependencies(tests dht-kademlia)
37 foreach (file answer dht-kademlia node routing_table task)
38   set(examples_src  ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/${file}.c  ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/${file}.h)
39 endforeach()
40
41 foreach (file app-masterworker dht-kademlia dht-pastry)
42   set(xml_files    ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/${file}/${file}_d.xml)
43 endforeach()
44
45 set(txt_files    ${txt_files}     ${CMAKE_CURRENT_SOURCE_DIR}/README.doc          PARENT_SCOPE)
46 set(bin_files    ${bin_files}     ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/generate.py
47                                   ${CMAKE_CURRENT_SOURCE_DIR}/dht-pastry/generate.py                       PARENT_SCOPE)
48 set(examples_src ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/common.h
49                                   ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/network-ns3.c                    PARENT_SCOPE)
50 set(tesh_files   ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/dht-kademlia.tesh
51                                   ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker-multicore.tesh
52                                   ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker-vivaldi.tesh
53                                   ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/network-ns3.tesh                 PARENT_SCOPE)
54 set(xml_files    ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker-multicore_d.xml
55                                   ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker-vivaldi_d.xml
56                                   ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/3hosts_2links_d.xml
57                                   ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/3links-timer_d.xml
58                                   ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/3links_d.xml
59                                   ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/crosstraffic_d.xml
60                                   ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/dogbone_d.xml
61                                   ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/onelink_d.xml
62                                   ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/one_cluster_d.xml        PARENT_SCOPE)
63
64 foreach(x app-masterworker cloud-masterworker
65           dht-pastry dht-kademlia # FIXME: platform-failures is disabled
66           energy-vm
67           process-create 
68           synchro-semaphore)
69   ADD_TESH_FACTORIES(msg-${x} "thread;ucontext;raw;boost" 
70                               --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/${x}
71                               --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg/${x} 
72                               --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms 
73                               ${CMAKE_HOME_DIRECTORY}/examples/msg/${x}/${x}.tesh)
74 endforeach()
75
76 foreach (x trace-categories trace-route-user-variables trace-link-user-variables trace-masterworker trace-process-migration trace-host-user-variables)
77   ADD_TESH(msg-${x} --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/${x}
78                     --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg/${x} 
79                     --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms 
80                     --cd ${CMAKE_BINARY_DIR}/examples/msg/${x}
81                     ${CMAKE_HOME_DIRECTORY}/examples/msg/${x}/${x}.tesh)
82 endforeach()
83
84 if(HAVE_SANITIZER_THREAD)
85   ADD_TESH_FACTORIES(msg-dht-kademlia-parallel "thread" --cfg contexts/nthreads:4 ${CONTEXTS_SYNCHRO}
86                                                --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/dht-kademlia
87                                                --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg/dht-kademlia
88                                                --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
89                                                ${CMAKE_HOME_DIRECTORY}/examples/msg/dht-kademlia/dht-kademlia.tesh)
90 else()
91   ADD_TESH_FACTORIES(msg-dht-kademlia-parallel "thread;ucontext;raw;boost" --cfg contexts/nthreads:4 ${CONTEXTS_SYNCHRO}
92                                                --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/dht-kademlia
93                                                --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg/dht-kademlia
94                                                --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
95                                                ${CMAKE_HOME_DIRECTORY}/examples/msg/dht-kademlia/dht-kademlia.tesh)
96 endif()
97
98 if(NOT WIN32)
99   ADD_TESH_FACTORIES(msg-maestro-set   "thread" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/maestro-set/maestro-set.tesh)
100 else()
101   message("Test maestro-set disabled on windows: this feature is not working")
102 endif()
103
104 ADD_TESH_FACTORIES(app-masterworker-multicore   "thread;ucontext;raw;boost" 
105                                                 --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg/app-masterworker 
106                                                 --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/app-masterworker
107                                                 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
108                                                 ${CMAKE_HOME_DIRECTORY}/examples/msg/app-masterworker/app-masterworker-multicore.tesh)
109 ADD_TESH_FACTORIES(app-masterworker-vivaldi     "thread;ucontext;raw;boost" 
110                                                 --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg/app-masterworker 
111                                                 --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/app-masterworker
112                                                 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
113                                                 ${CMAKE_HOME_DIRECTORY}/examples/msg/app-masterworker/app-masterworker-vivaldi.tesh)
114
115 if(SIMGRID_HAVE_NS3)
116   ADD_TESH_FACTORIES(msg-network-ns3 "thread;ucontext;raw;boost"
117                                       --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg
118                                       --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg
119                                       --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
120                                       ${CMAKE_HOME_DIRECTORY}/examples/msg/network-ns3/network-ns3.tesh)
121 endif()