Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add gras console example, illustrating the use of lua gras generator to setup the...
[simgrid.git] / buildtools / Cmake / MakeExeLib.cmake
1 ### Make Libs
2
3 if(enable_supernovae)
4         include(${PROJECT_DIRECTORY}/buildtools/Cmake/Supernovae.cmake)
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
17 if(enable_smpi)
18         set_target_properties(smpi PROPERTIES VERSION ${libsmpi_version})
19 endif(enable_smpi)
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         ADD_CUSTOM_COMMAND(
28           OUTPUT ${PROJECT_DIRECTORY}/src/bindings/ruby/libsimgrid.so
29           COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.so ${PROJECT_DIRECTORY}/src/bindings/ruby/libsimgrid.so
30           COMMENT "Generating libsimgrid.so link for binding ruby..."
31         )
32         ADD_CUSTOM_TARGET(link_simgrid_ruby ALL
33                           DEPENDS simgrid ${PROJECT_DIRECTORY}/src/bindings/ruby/libsimgrid.so)
34 endif(HAVE_RUBY)
35
36 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
37         add_definitions("-D_XOPEN_SOURCE")
38 endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
39
40 if(pthread)
41         if(with_context MATCHES pthread)
42                 SET(SIMGRID_DEP "${SIMGRID_DEP} -lpthread")
43         endif(with_context MATCHES pthread)
44         
45         if(with_context MATCHES windows)
46                 SET(GRAS_DEP "msg")
47         endif(with_context MATCHES windows)
48 endif(pthread)
49
50 if(HAVE_LUA)
51         SET(SIMGRID_DEP "${SIMGRID_DEP} -ldl -l${liblua}")      
52     ADD_CUSTOM_COMMAND(
53           OUTPUT ${PROJECT_DIRECTORY}/examples/lua/simgrid.so 
54           OUTPUT ${PROJECT_DIRECTORY}/examples/msg/masterslave/simgrid.so
55           OUTPUT ${PROJECT_DIRECTORY}/examples/simdag/simgrid.so
56           OUTPUT ${PROJECT_DIRECTOTY}/examples/gras/console/simgrid.so
57           COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.so ${PROJECT_DIRECTORY}/examples/lua/simgrid.so
58           COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.so ${PROJECT_DIRECTORY}/examples/msg/masterslave/simgrid.so 
59           COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.so ${PROJECT_DIRECTORY}/examples/simdag/simgrid.so 
60           COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.so ${PROJECT_DIRECTORY}/examples/gras/console/simgrid.so
61           COMMENT "Generating libsimgrid.so link for binding lua..."
62         )
63
64         ADD_CUSTOM_TARGET(link_simgrid_lua ALL
65                           DEPENDS simgrid ${PROJECT_DIRECTORY}/examples/lua/simgrid.so)
66
67 endif(HAVE_LUA)
68
69 if(HAVE_CGRAPH_LIB AND HAVE_CGRAPH_H)
70         SET(SIMGRID_DEP "${SIMGRID_DEP} -lcgraph")
71 endif(HAVE_CGRAPH_LIB AND HAVE_CGRAPH_H)
72
73 if(HAVE_GTNETS)
74         SET(SIMGRID_DEP "${SIMGRID_DEP} -lgtnets")
75 endif(HAVE_GTNETS)
76
77 if(HAVE_POSIX_GETTIME)
78         SET(SIMGRID_DEP "${SIMGRID_DEP} -lrt")
79         SET(GRAS_DEP "${GRAS_DEP} -lrt")
80 endif(HAVE_POSIX_GETTIME)
81
82 target_link_libraries(simgrid   ${SIMGRID_DEP})
83 target_link_libraries(simgrid_static    ${SIMGRID_DEP})
84 target_link_libraries(gras      ${GRAS_DEP})
85
86 add_dependencies(gras maintainer_files)
87 add_dependencies(simgrid maintainer_files)
88 add_dependencies(simgrid_static maintainer_files)
89                                 
90 if(enable_smpi)
91         target_link_libraries(smpi      simgrid ${SMPI_DEP})
92 endif(enable_smpi)
93
94 ### Make EXEs
95
96 #src/testall
97 add_subdirectory(${PROJECT_DIRECTORY}/src)
98
99 #tools/gras
100 add_subdirectory(${PROJECT_DIRECTORY}/tools/gras)
101
102 #tools/tesh
103 add_subdirectory(${PROJECT_DIRECTORY}/tools/tesh)
104
105 #testsuite/xbt
106 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/xbt)
107
108 #testsuite/surf
109 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/surf)
110
111 #testsuite/simdag
112 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/simdag)
113
114 #teshsuite
115 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/xbt)
116 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/datadesc)
117 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/msg_handle)
118 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/empty_main)
119 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/small_sleep)
120 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag)
121 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network)
122 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/p2p)
123 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/mxn)
124 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/partask)
125 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/platforms)
126 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/msg)
127
128 #examples
129 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/ping)
130 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/rpc)
131 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/spawn)
132 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/timer)
133 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/chrono)
134 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mutual_exclusion/simple_token)
135 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mmrpc)
136 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/all2all)
137 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/pmm)
138 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/synchro)
139 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/properties)
140 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/console)
141
142 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/properties)
143 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/actions)
144 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/migration)
145 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/sendrecv)
146 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/suspend)
147 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/parallel_task)
148 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/priority)
149 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/masterslave)
150 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/trace)
151 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/tracing)
152 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/icomms)
153
154 if(HAVE_MC)
155         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/mc)
156 endif(HAVE_MC)
157
158 if(HAVE_GTNETS)
159         add_definitions("-lgtnets -L${gtnets_path}/lib -I${gtnets_path}/include/gtnets")
160         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/gtnets)
161 endif(HAVE_GTNETS)
162
163 add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/bandwidth)
164 add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/saturate)
165
166 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag)
167 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/dax)
168 if(HAVE_CGRAPH_H)
169 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/dot)
170 endif(HAVE_CGRAPH_H)
171 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/metaxml)
172 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/properties)
173 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/scheduling)
174 if(enable_smpi)
175         add_subdirectory(${PROJECT_DIRECTORY}/examples/smpi)
176 endif(enable_smpi)