1 set(CMAKE_INSTALL_PREFIX "${prefix}" CACHE TYPE INTERNAL FORCE)
3 #########################################
4 ### Fill in the "make install" target ###
5 #########################################
8 if(NOT EXISTS ${PROJECT_DIRECTORY}/doc/html/)
9 file(MAKE_DIRECTORY ${PROJECT_DIRECTORY}/doc/html/)
10 endif(NOT EXISTS ${PROJECT_DIRECTORY}/doc/html/)
11 install(DIRECTORY "${PROJECT_DIRECTORY}/doc/html/"
12 DESTINATION "$ENV{DESTDIR}${prefix}/doc/simgrid/html/"
13 PATTERN ".svn" EXCLUDE
14 PATTERN ".git" EXCLUDE
19 install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/smpicc
20 ${CMAKE_BINARY_DIR}/bin/smpirun
21 DESTINATION $ENV{DESTDIR}${prefix}/bin/)
23 install(PROGRAMS ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/tesh.pl
24 DESTINATION $ENV{DESTDIR}${prefix}/bin/)
26 install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/tesh
27 DESTINATION $ENV{DESTDIR}${prefix}/bin/)
30 install(PROGRAMS tools/MSG_visualization/colorize.pl
31 DESTINATION $ENV{DESTDIR}${prefix}/bin/
32 RENAME simgrid-colorizer)
35 install(TARGETS simgrid gras
36 DESTINATION $ENV{DESTDIR}${prefix}/lib/)
40 DESTINATION $ENV{DESTDIR}${prefix}/lib/)
44 install(TARGETS simgrid_static
45 DESTINATION $ENV{DESTDIR}${prefix}/lib/)
47 install(TARGETS smpi_static
48 DESTINATION $ENV{DESTDIR}${prefix}/lib/)
50 endif(enable_lib_static)
53 foreach(file ${install_HEADERS})
54 get_filename_component(location ${file} PATH)
55 string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/" "" location "${location}")
57 DESTINATION $ENV{DESTDIR}${prefix}/${location})
58 endforeach(file ${install_HEADERS})
61 foreach(file ${examples_to_install_in_doc})
62 string(REPLACE "${PROJECT_DIRECTORY}/examples/" "" file ${file})
63 get_filename_component(location ${file} PATH)
64 install(FILES "examples/${file}"
65 DESTINATION $ENV{DESTDIR}${prefix}/doc/simgrid/examples/${location})
66 endforeach(file ${examples_to_install_in_doc})
70 install(FILES ${CMAKE_BINARY_DIR}/simgrid.jar
71 DESTINATION $ENV{DESTDIR}${prefix}/share/)
75 file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/lib/lua/5.1")
76 add_custom_target(simgrid_lua ALL
78 ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
81 OUTPUT ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
82 COMMAND ${CMAKE_COMMAND} -E create_symlink ../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
84 install(FILES ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
85 DESTINATION $ENV{DESTDIR}${prefix}/lib/lua/5.1
90 string(REGEX REPLACE "^.*ruby/" "" install_link_ruby "${RUBY_ARCH_DIR}")
91 file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}")
92 add_custom_target(ruby_simgrid ALL
94 ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
97 OUTPUT ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
98 COMMAND ${CMAKE_COMMAND} -E create_symlink ../../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
100 install(FILES ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
101 DESTINATION $ENV{DESTDIR}${prefix}/lib/ruby/${install_link_ruby}/
103 install(FILES ${PROJECT_DIRECTORY}/src/bindings/ruby/simgrid.rb
104 DESTINATION $ENV{DESTDIR}${prefix}/lib/ruby/${install_link_ruby}/)
108 ###########################################
109 ### Fill in the "make uninstall" target ###
110 ###########################################
112 add_custom_target(uninstall
113 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/doc/simgrid
114 COMMAND ${CMAKE_COMMAND} -E echo "uninstall doc ok"
115 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/libgras*
116 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/libsimgrid*
117 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/libsmpi*
118 COMMAND ${CMAKE_COMMAND} -E echo "uninstall lib ok"
119 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/bin/smpicc
120 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/bin/smpirun
121 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/bin/tesh
122 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/bin/simgrid-colorizer
123 COMMAND ${CMAKE_COMMAND} -E echo "uninstall bin ok"
124 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/amok
125 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/gras
126 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/instr
127 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/msg
128 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/simdag
129 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/smpi
130 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/surf
131 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/xbt
132 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/mc
133 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/include/simgrid_config.h
134 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/include/gras.h
135 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/include/xbt.h
136 COMMAND ${CMAKE_COMMAND} -E echo "uninstal include ok"
137 WORKING_DIRECTORY "${prefix}"
141 add_custom_command(TARGET uninstall
142 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/share/simgrid.jar
143 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding java ok"
144 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
149 add_custom_command(TARGET uninstall
150 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding lua ok"
151 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/lua/5.1/simgrid.${LIB_EXE}
152 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
157 string(REGEX REPLACE "^.*ruby/" "" install_link_ruby "${RUBY_ARCH_DIR}")
158 add_custom_command(TARGET uninstall
159 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding ruby ok"
160 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
161 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/ruby/${install_link_ruby}/simgrid.rb
162 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
166 ######################################
167 ### Fill in the "make html" target ###
168 ######################################
170 add_custom_target(html
171 DEPENDS ${PROJECT_DIRECTORY}/doc/all_bib.html
172 COMMAND ${CMAKE_COMMAND} -E echo "cmake -DBIBTEX2HTML=${BIBTEX2HTML} ./"
173 COMMAND ${CMAKE_COMMAND} -DBIBTEX2HTML=${BIBTEX2HTML} ./
174 COMMAND ${CMAKE_COMMAND} -E remove_directory ${PROJECT_DIRECTORY}/buildtools/Cmake/doc/CMakeFiles
175 COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/buildtools/Cmake/doc/CMakeCache.txt
176 COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/buildtools/Cmake/doc/cmake_install.cmake
177 COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/buildtools/Cmake/doc/Makefile
178 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/buildtools/Cmake/doc"
182 OUTPUT ${PROJECT_DIRECTORY}/doc/all_bib.html
183 ${PROJECT_DIRECTORY}/doc/all_bib.latin1.html
184 ${PROJECT_DIRECTORY}/doc/all_bib.latin1.html.tmp
185 ${PROJECT_DIRECTORY}/doc/logcategories.sh
186 ${PROJECT_DIRECTORY}/doc/publis_core.bib
187 ${PROJECT_DIRECTORY}/doc/publis_core_bib.html
188 ${PROJECT_DIRECTORY}/doc/publis_core_bib.latin1.html
189 ${PROJECT_DIRECTORY}/doc/publis_core_bib.latin1.html.tmp
190 ${PROJECT_DIRECTORY}/doc/publis_count.html
191 ${PROJECT_DIRECTORY}/doc/publis_extern.bib
192 ${PROJECT_DIRECTORY}/doc/publis_extern_bib.html
193 ${PROJECT_DIRECTORY}/doc/publis_extern_bib.latin1.html
194 ${PROJECT_DIRECTORY}/doc/publis_extern_bib.latin1.html.tmp
195 ${PROJECT_DIRECTORY}/doc/publis_intra.bib
196 ${PROJECT_DIRECTORY}/doc/publis_intra_bib.html
197 ${PROJECT_DIRECTORY}/doc/publis_intra_bib.latin1.html
198 ${PROJECT_DIRECTORY}/doc/publis_intra_bib.latin1.html.tmp
199 ${PROJECT_DIRECTORY}/doc/tmp.realtoc
200 ${PROJECT_DIRECTORY}/doc/using_bib.html
201 ${PROJECT_DIRECTORY}/doc/using_bib.latin1.html
202 ${PROJECT_DIRECTORY}/doc/using_bib.latin1.html.tmp
203 ${PROJECT_DIRECTORY}/doc/realtoc.sh
204 ${PROJECT_DIRECTORY}/doc/html
205 COMMAND ${CMAKE_COMMAND} -E echo "Make the html doc"
208 ################################################################
209 ## Build a sain "make dist" target to build a source package ###
210 ## containing only the files that I explicitely state ###
211 ## (instead of any cruft laying on my disk as CPack does) ###
212 ################################################################
214 ##########################################
215 ### Fill in the "make dist-dir" target ###
216 ##########################################
218 add_custom_target(dist-dir
219 COMMAND test -e simgrid-${release_version}/ && chmod -R a+w simgrid-${release_version}/ || true
220 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}
221 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}
222 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/doc/html/
223 COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_DIRECTORY}/doc/html/ simgrid-${release_version}/doc/html/
226 set(dirs_in_tarball "")
227 foreach(file ${source_to_pack})
228 # This damn prefix is still set somewhere (seems to be in subdirs)
229 string(REPLACE "${PROJECT_DIRECTORY}/" "" file "${file}")
231 # Create the directory on need
232 get_filename_component(file_location ${file} PATH)
233 string(REGEX MATCH ";${file_location};" OPERATION "${dirs_in_tarball}")
235 set(dirs_in_tarball "${dirs_in_tarball};${file_location};")
238 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/${file_location}/
242 # Actually copy the file
245 COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_DIRECTORY}/${file} simgrid-${release_version}/${file_location}/
247 endforeach(file ${source_to_pack})
249 ######################################
250 ### Fill in the "make dist" target ###
251 ######################################
253 add_custom_target(dist
254 DEPENDS ${CMAKE_BINARY_DIR}/simgrid-${release_version}.tar.gz
257 OUTPUT ${CMAKE_BINARY_DIR}/simgrid-${release_version}.tar.gz
258 COMMAND ${CMAKE_COMMAND} -E tar cf simgrid-${release_version}.tar simgrid-${release_version}/
259 COMMAND gzip -9v simgrid-${release_version}.tar
260 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}
262 add_dependencies(dist dist-dir)
264 ###########################################
265 ### Fill in the "make distcheck" target ###
266 ###########################################
268 # Allow to test the "make dist"
269 add_custom_target(distcheck
270 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}.cpy
271 COMMAND ${CMAKE_COMMAND} -E copy_directory simgrid-${release_version}/ simgrid-${release_version}.cpy
272 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_build
273 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_inst
275 # This stupid cmake creates a directory in source, killing the purpose of the chmod
277 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/CMakeFiles
278 # COMMAND chmod -R a-w simgrid-${release_version}/ # FIXME: we should pass without commenting that line
279 COMMAND chmod -R a+w simgrid-${release_version}/_build
280 COMMAND chmod -R a+w simgrid-${release_version}/_inst
281 COMMAND chmod -R a+w simgrid-${release_version}/CMakeFiles
283 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ${CMAKE_COMMAND} build .. -Dprefix=../_inst
284 # COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make dist-dir
285 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make
287 # This fails, unfortunately, because GRAS is broken for now
288 # COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ctest -j5 --output-on-failure
290 COMMAND ${CMAKE_COMMAND} -E echo "XXX Check that cleaning works"
291 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make clean
292 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/_build
293 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/_inst
294 COMMAND diff -ruN simgrid-${release_version}.cpy simgrid-${release_version}
295 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}.cpy
296 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/
298 add_dependencies(distcheck dist-dir)
300 #######################################
301 ### Fill in the "make check" target ###
302 #######################################
305 add_custom_target(check
306 COMMAND ctest -D ExperimentalMemCheck
308 else(enable_memcheck)
309 add_custom_target(check
312 endif(enable_memcheck)
314 #######################################
315 ### Fill in the "make xxx-clean" target ###
316 #######################################
318 add_custom_target(maintainer-clean
319 COMMAND ${CMAKE_COMMAND} -E remove -f src/config_unit.c
320 COMMAND ${CMAKE_COMMAND} -E remove -f src/cunit_unit.c
321 COMMAND ${CMAKE_COMMAND} -E remove -f src/dict_unit.c
322 COMMAND ${CMAKE_COMMAND} -E remove -f src/dynar_unit.c
323 COMMAND ${CMAKE_COMMAND} -E remove -f src/ex_unit.c
324 COMMAND ${CMAKE_COMMAND} -E remove -f src/set_unit.c
325 COMMAND ${CMAKE_COMMAND} -E remove -f src/simgrid_units_main.c
326 COMMAND ${CMAKE_COMMAND} -E remove -f src/swag_unit.c
327 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_sha_unit.c
328 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_str_unit.c
329 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_strbuff_unit.c
330 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_synchro_unit.c
331 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
334 add_custom_target(supernovae-clean
335 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_gras.c
336 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_sg.c
337 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_smpi.c
338 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
341 #############################################
342 ### Fill in the "make sync-gforge" target ###
343 #############################################
345 add_custom_target(sync-gforge
346 COMMAND chmod g+rw -R doc/
347 COMMAND chmod a+rX -R doc/
348 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
349 COMMAND scp doc/index.php doc/webcruft/robots.txt scm.gforge.inria.fr:/home/groups/simgrid/htdocs/
350 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/
351 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"