1 set(CMAKE_INSTALL_PREFIX "${prefix}" CACHE TYPE INTERNAL FORCE)
3 #########################################
4 ### Fill in the "make install" target ###
5 #########################################
9 if(NOT EXISTS ${PROJECT_DIRECTORY}/doc/html/)
10 file(MAKE_DIRECTORY ${PROJECT_DIRECTORY}/doc/html/)
11 endif(NOT EXISTS ${PROJECT_DIRECTORY}/doc/html/)
12 install(DIRECTORY "${PROJECT_DIRECTORY}/doc/html/"
13 DESTINATION "$ENV{DESTDIR}${prefix}/doc/simgrid/html/"
14 PATTERN ".svn" EXCLUDE
15 PATTERN ".git" EXCLUDE
22 install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/smpicc
23 ${CMAKE_BINARY_DIR}/bin/smpirun
24 DESTINATION $ENV{DESTDIR}${prefix}/bin/)
26 install(PROGRAMS ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/tesh.pl
27 DESTINATION $ENV{DESTDIR}${prefix}/bin/)
29 install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/tesh
30 DESTINATION $ENV{DESTDIR}${prefix}/bin/)
33 install(PROGRAMS tools/MSG_visualization/colorize.pl
34 DESTINATION $ENV{DESTDIR}${prefix}/bin/
35 RENAME simgrid-colorizer)
38 install(TARGETS simgrid gras
39 DESTINATION $ENV{DESTDIR}${prefix}/lib/)
43 DESTINATION $ENV{DESTDIR}${prefix}/lib/)
47 install(TARGETS simgrid_static
48 DESTINATION $ENV{DESTDIR}${prefix}/lib/)
50 install(TARGETS smpi_static
51 DESTINATION $ENV{DESTDIR}${prefix}/lib/)
53 endif(enable_lib_static)
56 foreach(file ${install_HEADERS})
57 get_filename_component(location ${file} PATH)
58 string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/" "" location "${location}")
60 DESTINATION $ENV{DESTDIR}${prefix}/${location})
61 endforeach(file ${install_HEADERS})
64 foreach(file ${examples_to_install_in_doc})
65 string(REPLACE "${PROJECT_DIRECTORY}/examples/" "" file ${file})
66 get_filename_component(location ${file} PATH)
67 install(FILES "examples/${file}"
68 DESTINATION $ENV{DESTDIR}${prefix}/doc/simgrid/examples/${location})
69 endforeach(file ${examples_to_install_in_doc})
73 install(FILES ${CMAKE_BINARY_DIR}/simgrid.jar
74 DESTINATION $ENV{DESTDIR}${prefix}/share/)
78 file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/lib/lua/5.1")
79 add_custom_target(simgrid_lua ALL
81 ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
84 OUTPUT ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
85 COMMAND ${CMAKE_COMMAND} -E create_symlink ../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
87 install(FILES ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
88 DESTINATION $ENV{DESTDIR}${prefix}/lib/lua/5.1
93 string(REGEX REPLACE "^.*ruby/" "" install_link_ruby "${RUBY_ARCH_DIR}")
94 file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}")
95 add_custom_target(ruby_simgrid ALL
97 ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
100 OUTPUT ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
101 COMMAND ${CMAKE_COMMAND} -E create_symlink ../../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
103 install(FILES ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
104 DESTINATION $ENV{DESTDIR}${prefix}/lib/ruby/${install_link_ruby}/
106 install(FILES ${PROJECT_DIRECTORY}/src/bindings/ruby/simgrid.rb
107 DESTINATION $ENV{DESTDIR}${prefix}/lib/ruby/${install_link_ruby}/)
111 ###########################################
112 ### Fill in the "make uninstall" target ###
113 ###########################################
115 add_custom_target(uninstall
116 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/doc/simgrid
117 COMMAND ${CMAKE_COMMAND} -E echo "uninstall doc ok"
118 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/libgras*
119 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/libsimgrid*
120 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/libsmpi*
121 COMMAND ${CMAKE_COMMAND} -E echo "uninstall lib ok"
122 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/bin/smpicc
123 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/bin/smpirun
124 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/bin/tesh
125 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/bin/simgrid-colorizer
126 COMMAND ${CMAKE_COMMAND} -E echo "uninstall bin ok"
127 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/amok
128 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/gras
129 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/instr
130 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/msg
131 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/simdag
132 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/smpi
133 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/surf
134 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/xbt
135 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/mc
136 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/include/simgrid_config.h
137 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/include/gras.h
138 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/include/xbt.h
139 COMMAND ${CMAKE_COMMAND} -E echo "uninstal include ok"
140 WORKING_DIRECTORY "${prefix}"
144 add_custom_command(TARGET uninstall
145 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/share/simgrid.jar
146 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding java ok"
147 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
152 add_custom_command(TARGET uninstall
153 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding lua ok"
154 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/lua/5.1/simgrid.${LIB_EXE}
155 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
160 string(REGEX REPLACE "^.*ruby/" "" install_link_ruby "${RUBY_ARCH_DIR}")
161 add_custom_command(TARGET uninstall
162 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding ruby ok"
163 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
164 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/ruby/${install_link_ruby}/simgrid.rb
165 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
169 ######################################
170 ### Fill in the "make html" target ###
171 ######################################
173 add_custom_target(html
174 DEPENDS ${PROJECT_DIRECTORY}/doc/all_bib.html
175 COMMAND ${CMAKE_COMMAND} -E echo "cmake -DBIBTEX2HTML=${BIBTEX2HTML} ./"
176 COMMAND ${CMAKE_COMMAND} -DBIBTEX2HTML=${BIBTEX2HTML} ./
177 COMMAND ${CMAKE_COMMAND} -E remove_directory ${PROJECT_DIRECTORY}/buildtools/Cmake/doc/CMakeFiles
178 COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/buildtools/Cmake/doc/CMakeCache.txt
179 COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/buildtools/Cmake/doc/cmake_install.cmake
180 COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/buildtools/Cmake/doc/Makefile
181 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/buildtools/Cmake/doc"
185 OUTPUT ${PROJECT_DIRECTORY}/doc/all_bib.html
186 ${PROJECT_DIRECTORY}/doc/all_bib.latin1.html
187 ${PROJECT_DIRECTORY}/doc/all_bib.latin1.html.tmp
188 ${PROJECT_DIRECTORY}/doc/logcategories.sh
189 ${PROJECT_DIRECTORY}/doc/publis_core.bib
190 ${PROJECT_DIRECTORY}/doc/publis_core_bib.html
191 ${PROJECT_DIRECTORY}/doc/publis_core_bib.latin1.html
192 ${PROJECT_DIRECTORY}/doc/publis_core_bib.latin1.html.tmp
193 ${PROJECT_DIRECTORY}/doc/publis_count.html
194 ${PROJECT_DIRECTORY}/doc/publis_extern.bib
195 ${PROJECT_DIRECTORY}/doc/publis_extern_bib.html
196 ${PROJECT_DIRECTORY}/doc/publis_extern_bib.latin1.html
197 ${PROJECT_DIRECTORY}/doc/publis_extern_bib.latin1.html.tmp
198 ${PROJECT_DIRECTORY}/doc/publis_intra.bib
199 ${PROJECT_DIRECTORY}/doc/publis_intra_bib.html
200 ${PROJECT_DIRECTORY}/doc/publis_intra_bib.latin1.html
201 ${PROJECT_DIRECTORY}/doc/publis_intra_bib.latin1.html.tmp
202 ${PROJECT_DIRECTORY}/doc/tmp.realtoc
203 ${PROJECT_DIRECTORY}/doc/using_bib.html
204 ${PROJECT_DIRECTORY}/doc/using_bib.latin1.html
205 ${PROJECT_DIRECTORY}/doc/using_bib.latin1.html.tmp
206 ${PROJECT_DIRECTORY}/doc/realtoc.sh
207 ${PROJECT_DIRECTORY}/doc/html
208 COMMAND ${CMAKE_COMMAND} -E echo "Make the html doc"
211 ################################################################
212 ## Build a sain "make dist" target to build a source package ###
213 ## containing only the files that I explicitely state ###
214 ## (instead of any cruft laying on my disk as CPack does) ###
215 ################################################################
217 ##########################################
218 ### Fill in the "make dist-dir" target ###
219 ##########################################
221 add_custom_target(dist-dir
222 COMMAND test -e simgrid-${release_version}/ && chmod -R a+w simgrid-${release_version}/ || true
223 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/
224 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}
225 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/doc/html/
226 COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_DIRECTORY}/doc/html/ simgrid-${release_version}/doc/html/
229 set(dirs_in_tarball "")
230 foreach(file ${source_to_pack})
231 # This damn prefix is still set somewhere (seems to be in subdirs)
232 string(REPLACE "${PROJECT_DIRECTORY}/" "" file "${file}")
234 # Create the directory on need
235 get_filename_component(file_location ${file} PATH)
236 string(REGEX MATCH ";${file_location};" OPERATION "${dirs_in_tarball}")
238 set(dirs_in_tarball "${dirs_in_tarball};${file_location};")
241 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/${file_location}/
245 # Actually copy the file
248 COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_DIRECTORY}/${file} simgrid-${release_version}/${file_location}/
250 endforeach(file ${source_to_pack})
252 ######################################
253 ### Fill in the "make dist" target ###
254 ######################################
256 add_custom_target(dist
257 DEPENDS ${CMAKE_BINARY_DIR}/simgrid-${release_version}.tar.gz
260 OUTPUT ${CMAKE_BINARY_DIR}/simgrid-${release_version}.tar.gz
261 COMMAND ${CMAKE_COMMAND} -E tar cf simgrid-${release_version}.tar simgrid-${release_version}/
262 COMMAND gzip -9v simgrid-${release_version}.tar
263 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/
265 add_dependencies(dist dist-dir)
267 ###########################################
268 ### Fill in the "make distcheck" target ###
269 ###########################################
271 # Allow to test the "make dist"
272 add_custom_target(distcheck
273 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}.cpy
274 COMMAND ${CMAKE_COMMAND} -E copy_directory simgrid-${release_version}/ simgrid-${release_version}.cpy
275 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_build
276 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_inst
278 # This stupid cmake creates a directory in source, killing the purpose of the chmod
280 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/CMakeFiles
281 # COMMAND chmod -R a-w simgrid-${release_version}/ # FIXME: we should pass without commenting that line
282 COMMAND chmod -R a+w simgrid-${release_version}/_build
283 COMMAND chmod -R a+w simgrid-${release_version}/_inst
284 COMMAND chmod -R a+w simgrid-${release_version}/CMakeFiles
286 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ${CMAKE_COMMAND} build .. -Dprefix=../_inst
287 # COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make dist-dir
288 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make
290 # This fails, unfortunately, because GRAS is broken for now
291 # COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ctest -j5 --output-on-failure
293 COMMAND ${CMAKE_COMMAND} -E echo "XXX Check that cleaning works"
294 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make clean
295 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/_build
296 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/_inst
297 COMMAND diff -ruN simgrid-${release_version}.cpy simgrid-${release_version}
298 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}.cpy
299 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/
301 add_dependencies(distcheck dist-dir)
303 #######################################
304 ### Fill in the "make check" target ###
305 #######################################
308 add_custom_target(check
309 COMMAND ctest -D ExperimentalMemCheck
311 else(enable_memcheck)
312 add_custom_target(check
315 endif(enable_memcheck)
317 #######################################
318 ### Fill in the "make xxx-clean" target ###
319 #######################################
321 add_custom_target(maintainer-clean
322 COMMAND ${CMAKE_COMMAND} -E remove -f src/config_unit.c
323 COMMAND ${CMAKE_COMMAND} -E remove -f src/cunit_unit.c
324 COMMAND ${CMAKE_COMMAND} -E remove -f src/dict_unit.c
325 COMMAND ${CMAKE_COMMAND} -E remove -f src/dynar_unit.c
326 COMMAND ${CMAKE_COMMAND} -E remove -f src/ex_unit.c
327 COMMAND ${CMAKE_COMMAND} -E remove -f src/set_unit.c
328 COMMAND ${CMAKE_COMMAND} -E remove -f src/simgrid_units_main.c
329 COMMAND ${CMAKE_COMMAND} -E remove -f src/swag_unit.c
330 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_sha_unit.c
331 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_str_unit.c
332 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_strbuff_unit.c
333 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_synchro_unit.c
334 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
337 add_custom_target(supernovae-clean
338 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_gras.c
339 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_sg.c
340 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_smpi.c
341 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
344 #############################################
345 ### Fill in the "make sync-gforge" target ###
346 #############################################
348 add_custom_target(sync-gforge
349 COMMAND chmod g+rw -R doc/
350 COMMAND chmod a+rX -R doc/
351 COMMAND rsync --verbose --cvs-exclude --compress --delete --delete-excluded --rsh=ssh --ignore-times --recursive --links --perms --times --omit-dir-times doc/html/ scm.gforge.inria.fr:/home/groups/simgrid/htdocs/doc/ || true
352 COMMAND scp doc/index.php doc/webcruft/robots.txt scm.gforge.inria.fr:/home/groups/simgrid/htdocs/
353 COMMAND scp doc/html/simgrid_modules2.png doc/html/simgrid_modules.png doc/webcruft/simgrid_logo.png doc/webcruft/simgrid_logo_small.png scm.gforge.inria.fr:/home/groups/simgrid/htdocs/
354 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"