Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add simgrid dependency for bindings.
[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           COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.so ${PROJECT_DIRECTORY}/examples/lua/simgrid.so
55           COMMENT "Generating libsimgrid.so link for binding lua..."
56         )
57         ADD_CUSTOM_TARGET(link_simgrid_lua ALL
58                           DEPENDS simgrid ${PROJECT_DIRECTORY}/examples/lua/simgrid.so)
59 endif(HAVE_LUA)
60
61 if(HAVE_CGRAPH_H)
62         SET(SIMGRID_DEP "${SIMGRID_DEP} -lcgraph")
63 endif(HAVE_CGRAPH_H)
64
65 if(HAVE_GTNETS)
66         SET(SIMGRID_DEP "${SIMGRID_DEP} -lgtnets")
67 endif(HAVE_GTNETS)
68
69 if(HAVE_POSIX_GETTIME)
70         SET(SIMGRID_DEP "${SIMGRID_DEP} -lrt")
71         SET(GRAS_DEP "${GRAS_DEP} -lrt")
72 endif(HAVE_POSIX_GETTIME)
73
74 target_link_libraries(simgrid   ${SIMGRID_DEP})
75 target_link_libraries(simgrid_static    ${SIMGRID_DEP})
76 target_link_libraries(gras      ${GRAS_DEP})
77
78 add_dependencies(gras maintainer_files)
79 add_dependencies(simgrid maintainer_files)
80 add_dependencies(simgrid_static maintainer_files)
81                                 
82 if(enable_smpi)
83         target_link_libraries(smpi      simgrid ${SMPI_DEP})
84 endif(enable_smpi)
85
86 ### Make EXEs
87
88 #src/testall
89 add_subdirectory(${PROJECT_DIRECTORY}/src)
90
91 #tools/gras
92 add_subdirectory(${PROJECT_DIRECTORY}/tools/gras)
93
94 #tools/tesh
95 add_subdirectory(${PROJECT_DIRECTORY}/tools/tesh)
96
97 #testsuite/xbt
98 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/xbt)
99
100 #testsuite/surf
101 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/surf)
102
103 #testsuite/simdag
104 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/simdag)
105
106 #teshsuite
107 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/xbt)
108 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/datadesc)
109 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/msg_handle)
110 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/empty_main)
111 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/small_sleep)
112 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag)
113 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network)
114 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/p2p)
115 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/mxn)
116 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/partask)
117 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/platforms)
118 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/msg)
119
120 #examples
121 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/ping)
122 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/rpc)
123 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/spawn)
124 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/timer)
125 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/chrono)
126 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mutual_exclusion/simple_token)
127 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mmrpc)
128 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/all2all)
129 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/pmm)
130 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/synchro)
131 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/properties)
132
133 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/properties)
134 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/actions)
135 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/migration)
136 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/sendrecv)
137 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/suspend)
138 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/parallel_task)
139 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/priority)
140 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/masterslave)
141 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/trace)
142 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/tracing)
143
144 if(HAVE_MC)
145         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/mc)
146 endif(HAVE_MC)
147
148 if(HAVE_GTNETS)
149         add_definitions("-lgtnets -L${gtnets_path}/lib -I${gtnets_path}/include/gtnets")
150         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/gtnets)
151 endif(HAVE_GTNETS)
152
153 add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/bandwidth)
154 add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/saturate)
155
156 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag)
157 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/dax)
158 if(HAVE_CGRAPH_H)
159 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/dot)
160 endif(HAVE_CGRAPH_H)
161 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/metaxml)
162 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/properties)
163 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/scheduling)
164 if(enable_smpi)
165         add_subdirectory(${PROJECT_DIRECTORY}/examples/smpi)
166 endif(enable_smpi)