Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
30e6bdf55451f4fed1777a57e7420a72ca524123
[simgrid.git] / buildtools / Cmake / src / CMakeMakeExeLib.txt
1 ### Make Libs
2
3 if(enable_supernovae)
4         include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeSupernovae.txt)
5 else(enable_supernovae) 
6         add_library(simgrid SHARED ${simgrid_sources})
7         add_library(simgrid_static STATIC ${simgrid_sources})
8         add_library(gras SHARED ${gras_sources})
9         if(enable_smpi)
10                 add_library(smpi SHARED ${SMPI_SRC})
11         endif(enable_smpi)
12 endif(enable_supernovae)
13
14 set_target_properties(simgrid PROPERTIES VERSION ${libsimgrid_version})
15 set_target_properties(gras PROPERTIES VERSION ${libgras_version})
16 if(enable_smpi)
17         set_target_properties(smpi PROPERTIES VERSION ${libsmpi_version})
18 endif(enable_smpi)
19
20
21 set(GRAS_DEP "-lm -lpthread")
22 set(SIMGRID_DEP "-lm")
23 set(SMPI_DEP "")
24
25 if(HAVE_RUBY)
26         set(SIMGRID_DEP "${SIMGRID_DEP} -l${RUBY_LIBRARY_NAME} -module")
27         exec_program("ln -sf ${PROJECT_DIRECTORY}/src/.libs/libsimgrid.so ${PROJECT_DIRECTORY}/src/bindings/ruby/libsimgrid.so" "${PROJECT_DIRECTORY}"  OUTPUT_VARIABLE LIEN_OK)
28 endif(HAVE_RUBY)
29
30 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
31         add_definitions("-D_XOPEN_SOURCE")
32 endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
33
34
35 if(pthread)
36         if(with_context MATCHES pthread)
37                 SET(SIMGRID_DEP "${SIMGRID_DEP} -lpthread")
38         endif(with_context MATCHES pthread)
39         
40         if(with_context MATCHES windows)
41                 SET(GRAS_DEP "msg")
42         endif(with_context MATCHES windows)
43 endif(pthread)
44
45 if(HAVE_LUA)
46         SET(SIMGRID_DEP "${SIMGRID_DEP} -ldl -l${liblua}")
47         exec_program("ln -sf ${PROJECT_DIRECTORY}/src/.libs/libsimgrid.so ${PROJECT_DIRECTORY}/examples/lua/simgrid.so" "${PROJECT_DIRECTORY}"  OUTPUT_VARIABLE LIEN_OK)
48 endif(HAVE_LUA)
49
50 if(HAVE_GTNETS)
51         SET(SIMGRID_DEP "${SIMGRID_DEP} -lgtnets")
52 endif(HAVE_GTNETS)
53
54 if(HAVE_POSIX_GETTIME)
55         SET(SIMGRID_DEP "${SIMGRID_DEP} -lrt")
56         SET(GRAS_DEP "${GRAS_DEP} -lrt")
57 endif(HAVE_POSIX_GETTIME)
58
59 target_link_libraries(simgrid   ${SIMGRID_DEP} -fprofile-arcs)
60 target_link_libraries(simgrid_static    ${SIMGRID_DEP} -fprofile-arcs)
61 target_link_libraries(gras      ${GRAS_DEP} -fprofile-arcs)
62 if(enable_smpi)
63         target_link_libraries(smpi      simgrid ${SMPI_DEP} -fprofile-arcs)
64 endif(enable_smpi)
65
66
67 ### Make EXEs
68
69 #src/testall
70 add_subdirectory(${PROJECT_DIRECTORY}/src)
71
72 #tools/gras
73 add_subdirectory(${PROJECT_DIRECTORY}/tools/gras)
74
75 #tools/tesh
76 add_subdirectory(${PROJECT_DIRECTORY}/tools/tesh)
77
78 #testsuite/xbt
79 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/xbt)
80
81 #testsuite/surf
82 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/surf)
83
84 #testsuite/simdag
85 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/simdag)
86
87 #teshsuite
88 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/xbt)
89 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/datadesc)
90 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/msg_handle)
91 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/empty_main)
92 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/small_sleep)
93 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag)
94 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network)
95 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/p2p)
96 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/mxn)
97 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/partask)
98 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/platforms)
99 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/msg)
100
101 #examples
102 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/ping)
103 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/rpc)
104 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/spawn)
105 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/timer)
106 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/chrono)
107 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mutual_exclusion/simple_token)
108 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mmrpc)
109 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/all2all)
110 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/pmm)
111 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/synchro)
112 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/properties)
113
114 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/properties)
115 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/actions)
116 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/migration)
117 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/sendrecv)
118 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/suspend)
119 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/parallel_task)
120 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/priority)
121 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/masterslave)
122 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/trace)
123 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/tracing)
124 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/mc)
125 if(HAVE_GTNETS)
126         add_definitions("-lgtnets -L${gtnets_path}/lib -I${gtnets_path}/include/gtnets")
127         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/gtnets)
128 endif(HAVE_GTNETS)
129
130 add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/bandwidth)
131 add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/saturate)
132
133 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag)
134 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/dax)
135 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/metaxml)
136 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/properties)
137 if(enable_smpi)
138         add_subdirectory(${PROJECT_DIRECTORY}/examples/smpi)
139 endif(enable_smpi)
140
141 # FIXME: should be killed once integrated properly in examples' CMakeList.txt
142 set(targets_depended_of_gras_stub_generator
143 ping_client
144 ping_server
145 ping_simulator
146 rpc_client
147 rpc_forwarder
148 rpc_server
149 rpc_simulator
150 spawn_child
151 spawn_father
152 spawn_simulator
153 timer_client
154 timer_simulator
155 chrono_multiplier
156 chrono_simulator
157 simple_token_node
158 simple_token_simulator
159 mmrpc_client
160 mmrpc_server
161 mmrpc_simulator
162 all2all_receiver
163 all2all_sender
164 all2all_simulator
165 pmm_master
166 pmm_simulator
167 pmm_slave
168 synchro_philosopher
169 synchro_simulator
170 properties_alice
171 properties_bob
172 properties_simulator
173 msg_handle_client
174 msg_handle_server
175 msg_handle_simulator
176 empty_main_function
177 empty_main_simulator
178 small_sleep_function
179 small_sleep_simulator
180 bandwidth_maestro
181 bandwidth_sensor
182 bandwidth_simulator
183 saturate_maestro
184 saturate_sensor
185 saturate_simulator
186 )
187 foreach(file ${targets_depended_of_gras_stub_generator})
188         add_dependencies(${file} gras_stub_generator)
189 endforeach(file ${targets_depended_of_gras_stub_generator})