Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
c3e9e9048345e847af00e1865e03be291e0ae6bd
[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                 add_library(smpi_static STATIC ${SMPI_SRC})
12         endif(enable_smpi)
13 endif(enable_supernovae)
14
15 set_target_properties(simgrid PROPERTIES VERSION ${libsimgrid_version})
16 set_target_properties(gras PROPERTIES VERSION ${libgras_version})
17
18 if(enable_smpi)
19         set_target_properties(smpi PROPERTIES VERSION ${libsmpi_version})
20 endif(enable_smpi)
21
22 set(GRAS_DEP "-lm -lpthread")
23 set(SIMGRID_DEP "-lm")
24 set(SMPI_DEP "")
25
26 if(HAVE_RUBY)
27         set(SIMGRID_DEP "${SIMGRID_DEP} -l${RUBY_LIBRARY_NAME} -module")
28         ADD_CUSTOM_TARGET(link_simgrid_ruby ALL
29           DEPENDS simgrid
30           COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.so ${PROJECT_DIRECTORY}/src/bindings/ruby/libsimgrid.so
31           COMMENT "Generating libsimgrid.so link for binding ruby..."
32           )
33         
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           
53     ADD_CUSTOM_TARGET(link_simgrid_lua ALL
54       DEPENDS simgrid
55           COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.so ${PROJECT_DIRECTORY}/examples/lua/simgrid.so #for test
56           COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.so ${PROJECT_DIRECTORY}/examples/msg/masterslave/simgrid.so #for test
57           COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.so ${PROJECT_DIRECTORY}/examples/simdag/simgrid.so #for test
58           COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.so ${PROJECT_DIRECTORY}/examples/gras/console/simgrid.so #for compil
59           COMMENT "Generating libsimgrid.so link for binding lua..."
60         )
61         
62 endif(HAVE_LUA)
63
64 if(HAVE_CGRAPH_LIB AND HAVE_CGRAPH_H)
65         SET(SIMGRID_DEP "${SIMGRID_DEP} -lcgraph")
66 endif(HAVE_CGRAPH_LIB AND HAVE_CGRAPH_H)
67
68 if(HAVE_GTNETS)
69         SET(SIMGRID_DEP "${SIMGRID_DEP} -lgtnets")
70 endif(HAVE_GTNETS)
71
72 if(HAVE_POSIX_GETTIME)
73         SET(SIMGRID_DEP "${SIMGRID_DEP} -lrt")
74         SET(GRAS_DEP "${GRAS_DEP} -lrt")
75 endif(HAVE_POSIX_GETTIME)
76
77 target_link_libraries(simgrid   ${SIMGRID_DEP})
78 target_link_libraries(simgrid_static    ${SIMGRID_DEP})
79 target_link_libraries(gras      ${GRAS_DEP})
80
81 add_dependencies(gras maintainer_files)
82 add_dependencies(simgrid maintainer_files)
83 add_dependencies(simgrid_static maintainer_files)
84                                 
85 if(enable_smpi)
86         target_link_libraries(smpi      simgrid ${SMPI_DEP})
87         target_link_libraries(smpi_static simgrid ${SMPI_DEP})
88 endif(enable_smpi)
89
90 ### Make EXEs
91
92 #src/testall
93 add_subdirectory(${PROJECT_DIRECTORY}/src)
94
95 #tools/gras
96 add_subdirectory(${PROJECT_DIRECTORY}/tools/gras)
97
98 #tools/tesh
99 add_subdirectory(${PROJECT_DIRECTORY}/tools/tesh)
100
101 #testsuite/xbt
102 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/xbt)
103
104 #testsuite/surf
105 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/surf)
106
107 #testsuite/simdag
108 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/simdag)
109
110 #teshsuite
111 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/xbt)
112 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/datadesc)
113 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/msg_handle)
114 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/empty_main)
115 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/small_sleep)
116 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag)
117 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network)
118 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/p2p)
119 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/mxn)
120 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/partask)
121 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/platforms)
122 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/msg)
123
124 #examples
125 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/ping)
126 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/rpc)
127 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/spawn)
128 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/timer)
129 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/chrono)
130 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mutual_exclusion/simple_token)
131 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mmrpc)
132 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/all2all)
133 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/pmm)
134 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/synchro)
135 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/properties)
136 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/console)
137
138 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/properties)
139 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/actions)
140 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/migration)
141 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/sendrecv)
142 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/suspend)
143 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/parallel_task)
144 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/priority)
145 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/masterslave)
146 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/trace)
147 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/tracing)
148 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/icomms)
149
150 if(HAVE_MC)
151         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/mc)
152 endif(HAVE_MC)
153
154 if(HAVE_GTNETS)
155         add_definitions("-lgtnets -L${gtnets_path}/lib -I${gtnets_path}/include/gtnets")
156         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/gtnets)
157 endif(HAVE_GTNETS)
158
159 add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/bandwidth)
160 add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/saturate)
161
162 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag)
163 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/dax)
164 if(HAVE_CGRAPH_H)
165 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/dot)
166 endif(HAVE_CGRAPH_H)
167 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/metaxml)
168 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/properties)
169 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/scheduling)
170 if(enable_smpi)
171         add_subdirectory(${PROJECT_DIRECTORY}/examples/smpi)
172 endif(enable_smpi)