Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix supernovae in cmake (we only need perl now); cosmetics in dependencies definitions
[simgrid.git] / buildtools / Cmake / MakeExeLib.cmake
1 ### Make Libs
2
3 # If we need supernovae, rewrite the lib content to use it
4 include(${PROJECT_DIRECTORY}/buildtools/Cmake/Supernovae.cmake)
5
6 # Declare our libraries
7 add_library(simgrid SHARED ${simgrid_sources})
8 add_library(gras SHARED ${gras_sources})
9 if(enable_lib_static)
10         add_library(simgrid_static STATIC ${simgrid_sources})   
11 endif(enable_lib_static)
12 if(enable_smpi)
13         add_library(smpi SHARED ${SMPI_SRC})
14         if(enable_lib_static)
15                 add_library(smpi_static STATIC ${SMPI_SRC})     
16         endif(enable_lib_static)
17 endif(enable_smpi)
18
19 # if supernovaeing, we need some depends to make sure that the source gets generated
20 if (enable_supernovae)
21         add_dependencies(simgrid ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_sg.c)
22         if(enable_lib_static)
23                 add_dependencies(simgrid_static ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_sg.c)
24         endif(enable_lib_static)
25         add_dependencies(gras ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_gras.c)
26
27         if(enable_smpi)
28                 add_dependencies(smpi ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_smpi.c)
29                 if(enable_lib_static)
30                         add_dependencies(smpi_static ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_smpi.c)
31                 endif(enable_lib_static)
32         endif(enable_smpi)
33 endif(enable_supernovae)        
34
35
36 set_target_properties(simgrid PROPERTIES VERSION ${libsimgrid_version})
37 set_target_properties(gras PROPERTIES VERSION ${libgras_version})
38 if(enable_smpi)
39         set_target_properties(smpi PROPERTIES VERSION ${libsmpi_version})
40 endif(enable_smpi)
41
42 set(GRAS_LDEP "-lm -lpthread")
43 set(SIMGRID_LDEP "-lm")
44 set(SMPI_LDEP "")
45 if(APPLE)
46     set(SMPI_LDEP "-Wl,-U -Wl,_smpi_simulated_main")
47 endif(APPLE)
48
49 if(HAVE_PCRE_LIB)
50        SET(SIMGRID_LDEP "${SIMGRID_LDEP} -lpcre")
51 endif(HAVE_PCRE_LIB)
52
53 if(HAVE_RUBY)
54         set(SIMGRID_LDEP "${SIMGRID_LDEP} -l${RUBY_LIBRARY_NAME} -module")
55 endif(HAVE_RUBY)
56
57 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
58         add_definitions("-D_XOPEN_SOURCE")
59 endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
60
61 if(pthread)
62         if(with_context MATCHES pthread)
63                 SET(SIMGRID_LDEP "${SIMGRID_LDEP} -lpthread")
64         endif(with_context MATCHES pthread)
65         
66         if(with_context MATCHES windows)
67                 SET(GRAS_LDEP "msg")
68         endif(with_context MATCHES windows)
69 endif(pthread)
70
71 if(HAVE_LUA)
72         SET(SIMGRID_LDEP "${SIMGRID_LDEP} -ldl -l${LIB_LUA_NAME}")        
73 endif(HAVE_LUA)
74
75 if(HAVE_GRAPHVIZ)
76
77     if(HAVE_CGRAPH_LIB)
78             SET(SIMGRID_LDEP "${SIMGRID_LDEP} -lcgraph")
79         else(HAVE_CGRAPH_LIB)
80         if(HAVE_AGRAPH_LIB)
81             SET(SIMGRID_LDEP "${SIMGRID_LDEP} -lagraph -lcdt")
82         endif(HAVE_AGRAPH_LIB)  
83     endif(HAVE_CGRAPH_LIB)
84             
85 endif(HAVE_GRAPHVIZ)
86
87 if(HAVE_GTNETS)
88         SET(SIMGRID_LDEP "${SIMGRID_LDEP} -lgtnets")
89 endif(HAVE_GTNETS)
90
91 if(HAVE_POSIX_GETTIME)
92         SET(SIMGRID_LDEP "${SIMGRID_LDEP} -lrt")
93         SET(GRAS_LDEP "${GRAS_LDEP} -lrt")
94 endif(HAVE_POSIX_GETTIME)
95
96 target_link_libraries(simgrid   ${SIMGRID_LDEP})
97 target_link_libraries(gras      ${GRAS_LDEP})
98 add_dependencies(gras maintainer_files)
99 add_dependencies(simgrid maintainer_files)                              
100 if(enable_smpi)
101         target_link_libraries(smpi      simgrid ${SMPI_LDEP})
102 endif(enable_smpi)
103
104 if(enable_lib_static)
105         target_link_libraries(simgrid_static    ${SIMGRID_LDEP})
106         add_dependencies(simgrid_static maintainer_files)
107         set_target_properties(simgrid_static PROPERTIES OUTPUT_NAME simgrid)
108         if(enable_smpi)
109                 target_link_libraries(smpi_static       simgrid ${SMPI_LDEP})
110                 set_target_properties(smpi_static PROPERTIES OUTPUT_NAME smpi)
111         endif(enable_smpi)
112 endif(enable_lib_static)
113
114 ### Make EXEs
115
116 #tools/gras
117 add_subdirectory(${PROJECT_DIRECTORY}/tools/gras)
118
119 #tools/tesh
120 add_subdirectory(${PROJECT_DIRECTORY}/tools/tesh)
121
122 #testsuite/xbt
123 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/xbt)
124
125 #testsuite/surf
126 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/surf)
127
128 #testsuite/simdag
129 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/simdag)
130
131 #teshsuite
132 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/xbt)
133 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/datadesc)
134 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/msg_handle)
135 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/empty_main)
136 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/small_sleep)
137 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag)
138 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network)
139 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/p2p)
140 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/mxn)
141 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/partask)
142 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/platforms)
143 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/msg)
144
145 #examples
146 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/ping)
147 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/rpc)
148 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/spawn)
149 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/timer)
150 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/chrono)
151 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mutual_exclusion/simple_token)
152 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mmrpc)
153 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/all2all)
154 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/pmm)
155 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/synchro)
156 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/properties)
157 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/console)
158
159 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/properties)
160 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/actions)
161 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/migration)
162 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/sendrecv)
163 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/suspend)
164 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/parallel_task)
165 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/priority)
166 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/masterslave)
167 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/trace)
168 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/tracing)
169 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/icomms)
170
171 if(HAVE_MC)
172         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/mc)
173 endif(HAVE_MC)
174
175 if(HAVE_GTNETS)
176         add_definitions("-lgtnets -L${gtnets_path}/lib -I${gtnets_path}/include/gtnets")
177         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/gtnets)
178 endif(HAVE_GTNETS)
179
180 add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/bandwidth)
181 add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/saturate)
182
183 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag)
184 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/dax)
185 if(HAVE_GRAPHVIZ)
186   add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/dot)
187 endif(HAVE_GRAPHVIZ)
188 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/metaxml)
189 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/properties)
190 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/scheduling)
191 if(enable_smpi)
192         add_subdirectory(${PROJECT_DIRECTORY}/examples/smpi)
193 endif(enable_smpi)