Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
let the binding examples work without the funky symlinks. This is a step further...
[simgrid.git] / buildtools / Cmake / MakeExeLib.cmake
1 ### Make Libs
2 include(FindSupernovae)
3
4 if(enable_supernovae AND HAVE_SUPERNOVAE_TOOLS)
5         include(${PROJECT_DIRECTORY}/buildtools/Cmake/Supernovae.cmake)
6 else(enable_supernovae AND HAVE_SUPERNOVAE_TOOLS)       
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 endif(enable_supernovae AND HAVE_SUPERNOVAE_TOOLS)
19
20 set_target_properties(simgrid PROPERTIES VERSION ${libsimgrid_version})
21 set_target_properties(gras PROPERTIES VERSION ${libgras_version})
22 if(enable_smpi)
23         set_target_properties(smpi PROPERTIES VERSION ${libsmpi_version})
24 endif(enable_smpi)
25
26 set(GRAS_DEP "-lm -lpthread")
27 set(SIMGRID_DEP "-lm")
28 set(SMPI_DEP "")
29 if(APPLE)
30     set(SMPI_DEP "-Wl,-U -Wl,_smpi_simulated_main")
31 endif(APPLE)
32
33 if(HAVE_PCRE_LIB)
34        SET(SIMGRID_DEP "${SIMGRID_DEP} -lpcre")
35 endif(HAVE_PCRE_LIB)
36
37 if(HAVE_RUBY)
38         set(SIMGRID_DEP "${SIMGRID_DEP} -l${RUBY_LIBRARY_NAME} -module")
39 endif(HAVE_RUBY)
40
41 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
42         add_definitions("-D_XOPEN_SOURCE")
43 endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
44
45 if(pthread)
46         if(with_context MATCHES pthread)
47                 SET(SIMGRID_DEP "${SIMGRID_DEP} -lpthread")
48         endif(with_context MATCHES pthread)
49         
50         if(with_context MATCHES windows)
51                 SET(GRAS_DEP "msg")
52         endif(with_context MATCHES windows)
53 endif(pthread)
54
55 if(HAVE_LUA)
56         SET(SIMGRID_DEP "${SIMGRID_DEP} -ldl -l${LIB_LUA_NAME}")          
57 endif(HAVE_LUA)
58
59 if(HAVE_GRAPHVIZ)
60
61     if(HAVE_CGRAPH_LIB)
62             SET(SIMGRID_DEP "${SIMGRID_DEP} -lcgraph")
63         else(HAVE_CGRAPH_LIB)
64         if(HAVE_AGRAPH_LIB)
65             SET(SIMGRID_DEP "${SIMGRID_DEP} -lagraph -lcdt")
66         endif(HAVE_AGRAPH_LIB)  
67     endif(HAVE_CGRAPH_LIB)
68             
69 endif(HAVE_GRAPHVIZ)
70
71 if(HAVE_GTNETS)
72         SET(SIMGRID_DEP "${SIMGRID_DEP} -lgtnets")
73 endif(HAVE_GTNETS)
74
75 if(HAVE_POSIX_GETTIME)
76         SET(SIMGRID_DEP "${SIMGRID_DEP} -lrt")
77         SET(GRAS_DEP "${GRAS_DEP} -lrt")
78 endif(HAVE_POSIX_GETTIME)
79
80 target_link_libraries(simgrid   ${SIMGRID_DEP})
81 target_link_libraries(gras      ${GRAS_DEP})
82 add_dependencies(gras maintainer_files)
83 add_dependencies(simgrid maintainer_files)                              
84 if(enable_smpi)
85         target_link_libraries(smpi      simgrid ${SMPI_DEP})
86 endif(enable_smpi)
87
88 if(enable_lib_static)
89         target_link_libraries(simgrid_static    ${SIMGRID_DEP})
90         add_dependencies(simgrid_static maintainer_files)
91         set_target_properties(simgrid_static PROPERTIES OUTPUT_NAME simgrid)
92         if(enable_smpi)
93                 target_link_libraries(smpi_static       simgrid ${SMPI_DEP})
94                 set_target_properties(smpi_static PROPERTIES OUTPUT_NAME smpi)
95         endif(enable_smpi)
96 endif(enable_lib_static)
97
98 ### Make EXEs
99
100 #tools/gras
101 add_subdirectory(${PROJECT_DIRECTORY}/tools/gras)
102
103 #tools/tesh
104 add_subdirectory(${PROJECT_DIRECTORY}/tools/tesh)
105
106 #testsuite/xbt
107 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/xbt)
108
109 #testsuite/surf
110 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/surf)
111
112 #testsuite/simdag
113 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/simdag)
114
115 #teshsuite
116 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/xbt)
117 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/datadesc)
118 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/msg_handle)
119 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/empty_main)
120 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/small_sleep)
121 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag)
122 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network)
123 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/p2p)
124 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/mxn)
125 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/partask)
126 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/platforms)
127 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/msg)
128
129 #examples
130 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/ping)
131 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/rpc)
132 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/spawn)
133 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/timer)
134 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/chrono)
135 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mutual_exclusion/simple_token)
136 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mmrpc)
137 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/all2all)
138 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/pmm)
139 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/synchro)
140 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/properties)
141 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/console)
142
143 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/properties)
144 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/actions)
145 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/migration)
146 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/sendrecv)
147 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/suspend)
148 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/parallel_task)
149 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/priority)
150 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/masterslave)
151 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/trace)
152 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/tracing)
153 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/icomms)
154
155 if(HAVE_MC)
156         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/mc)
157 endif(HAVE_MC)
158
159 if(HAVE_GTNETS)
160         add_definitions("-lgtnets -L${gtnets_path}/lib -I${gtnets_path}/include/gtnets")
161         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/gtnets)
162 endif(HAVE_GTNETS)
163
164 add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/bandwidth)
165 add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/saturate)
166
167 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag)
168 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/dax)
169 if(HAVE_GRAPHVIZ)
170   add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/dot)
171 endif(HAVE_GRAPHVIZ)
172 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/metaxml)
173 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/properties)
174 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/scheduling)
175 if(enable_smpi)
176         add_subdirectory(${PROJECT_DIRECTORY}/examples/smpi)
177 endif(enable_smpi)