Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
make clean works now
[simgrid.git] / buildtools / Cmake / MakeExeLib.cmake
1 ### Make Libs
2
3 if(enable_supernovae AND NOT WIN32)
4         include(${PROJECT_DIRECTORY}/buildtools/Cmake/Supernovae.cmake)
5 else(enable_supernovae AND NOT WIN32)   
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 AND NOT WIN32)
13
14 set_target_properties(simgrid PROPERTIES VERSION ${libsimgrid_version})
15 set_target_properties(gras PROPERTIES VERSION ${libgras_version})
16 if(enable_smpi)
17         set_target_properties(smpi PROPERTIES VERSION ${libsmpi_version})
18 endif(enable_smpi)
19
20
21 set(GRAS_DEP "-lm -lpthread")
22 set(SIMGRID_DEP "-lm")
23 set(SMPI_DEP "")
24
25 if(WIN32)
26         set(GRAS_DEP "wsock32")
27         set(SIMGRID_DEP "wsock32")
28 endif(WIN32)
29
30 if(HAVE_RUBY)
31         set(SIMGRID_DEP "${SIMGRID_DEP} -l${RUBY_LIBRARY_NAME} -module")
32         exec_program("${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.so ${PROJECT_DIRECTORY}/src/bindings/ruby/libsimgrid.so" 
33                     "${PROJECT_DIRECTORY}"  
34                     OUTPUT_VARIABLE IGNORED)
35         
36         # Make sure this extra link will get cleaned
37         get_directory_property(extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES)
38         set_directory_properties(
39            PROPERTIES
40            ADDITIONAL_MAKE_CLEAN_FILES "${extra_clean_files};${PROJECT_DIRECTORY}/src/bindings/ruby/libsimgrid.so")
41 endif(HAVE_RUBY)
42
43 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
44         add_definitions("-D_XOPEN_SOURCE")
45 endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
46
47
48 if(pthread)
49         if(with_context MATCHES pthread)
50                 SET(SIMGRID_DEP "${SIMGRID_DEP} -lpthread")
51         endif(with_context MATCHES pthread)
52         
53         if(with_context MATCHES windows)
54                 SET(GRAS_DEP "msg")
55         endif(with_context MATCHES windows)
56 endif(pthread)
57
58 if(HAVE_LUA)
59         SET(SIMGRID_DEP "${SIMGRID_DEP} -ldl -l${liblua}")
60         exec_program("${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.so ${PROJECT_DIRECTORY}/examples/lua/simgrid.so" 
61                      "${PROJECT_DIRECTORY}"
62                      OUTPUT_VARIABLE IGNORED)
63                      
64         # Make sure this extra link will get cleaned
65         get_directory_property(extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES)
66         set_directory_properties(
67            PROPERTIES
68            ADDITIONAL_MAKE_CLEAN_FILES "${extra_clean_files};${PROJECT_DIRECTORY}/examples/lua/simgrid.so")
69 endif(HAVE_LUA)
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(simgrid_static    ${SIMGRID_DEP})
82 target_link_libraries(gras      ${GRAS_DEP})
83 if(enable_smpi)
84         target_link_libraries(smpi      simgrid ${SMPI_DEP})
85 endif(enable_smpi)
86
87
88 ### Make EXEs
89
90 #src/testall
91 add_subdirectory(${PROJECT_DIRECTORY}/src)
92
93 #tools/gras
94 add_subdirectory(${PROJECT_DIRECTORY}/tools/gras)
95
96 #tools/tesh
97 add_subdirectory(${PROJECT_DIRECTORY}/tools/tesh)
98
99 #testsuite/xbt
100 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/xbt)
101
102 #testsuite/surf
103 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/surf)
104
105 #testsuite/simdag
106 add_subdirectory(${PROJECT_DIRECTORY}/testsuite/simdag)
107
108 #teshsuite
109 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/xbt)
110 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/datadesc)
111 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/msg_handle)
112 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/empty_main)
113 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/small_sleep)
114 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag)
115 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network)
116 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/p2p)
117 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/network/mxn)
118 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/partask)
119 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/platforms)
120 add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/msg)
121
122 #examples
123 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/ping)
124 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/rpc)
125 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/spawn)
126 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/timer)
127 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/chrono)
128 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mutual_exclusion/simple_token)
129 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/mmrpc)
130 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/all2all)
131 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/pmm)
132 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/synchro)
133 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/properties)
134
135 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/properties)
136 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/actions)
137 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/migration)
138 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/sendrecv)
139 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/suspend)
140 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/parallel_task)
141 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/priority)
142 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/masterslave)
143 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/trace)
144 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/tracing)
145
146 if(HAVE_MC)
147         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/mc)
148 endif(HAVE_MC)
149
150 if(HAVE_GTNETS)
151         add_definitions("-lgtnets -L${gtnets_path}/lib -I${gtnets_path}/include/gtnets")
152         add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/gtnets)
153 endif(HAVE_GTNETS)
154
155 add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/bandwidth)
156 add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/saturate)
157
158 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag)
159 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/dax)
160 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/metaxml)
161 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/properties)
162 if(enable_smpi)
163         add_subdirectory(${PROJECT_DIRECTORY}/examples/smpi)
164 endif(enable_smpi)