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/)
38 install(FILES ${CMAKE_BINARY_DIR}/lib/libsimgrid_static.a
40 DESTINATION $ENV{DESTDIR}${prefix}/lib/)
44 DESTINATION $ENV{DESTDIR}${prefix}/lib/)
45 install(FILES ${CMAKE_BINARY_DIR}/lib/libsmpi_static.a
47 DESTINATION $ENV{DESTDIR}${prefix}/lib/)
51 foreach(file ${install_HEADERS})
52 get_filename_component(location ${file} PATH)
54 DESTINATION $ENV{DESTDIR}${prefix}/${location})
55 endforeach(file ${install_HEADERS})
58 foreach(file ${examples_to_install_in_doc})
59 string(REPLACE "${PROJECT_DIRECTORY}/examples/" "" file ${file})
60 get_filename_component(location ${file} PATH)
61 install(FILES "examples/${file}"
62 DESTINATION $ENV{DESTDIR}${prefix}/doc/simgrid/examples/${location})
63 endforeach(file ${examples_to_install_in_doc})
67 install(FILES ${CMAKE_BINARY_DIR}/simgrid.jar
68 DESTINATION $ENV{DESTDIR}${prefix}/share/)
72 file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/lib/lua/5.1")
73 add_custom_target(simgrid_lua ALL
75 ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
78 OUTPUT ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
79 COMMAND ${CMAKE_COMMAND} -E create_symlink ../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
81 install(FILES ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
82 DESTINATION $ENV{DESTDIR}${prefix}/lib/lua/5.1
87 string(REGEX REPLACE "^.*ruby/" "" install_link_ruby "${RUBY_ARCH_DIR}")
88 file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}")
89 add_custom_target(ruby_simgrid ALL
91 ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
94 OUTPUT ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
95 COMMAND ${CMAKE_COMMAND} -E create_symlink ../../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
97 install(FILES ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
98 DESTINATION $ENV{DESTDIR}${prefix}/lib/ruby/${install_link_ruby}/
100 install(FILES ${PROJECT_DIRECTORY}/src/bindings/ruby/simgrid.rb
101 DESTINATION $ENV{DESTDIR}${prefix}/lib/ruby/${install_link_ruby}/)
105 ###########################################
106 ### Fill in the "make uninstall" target ###
107 ###########################################
109 add_custom_target(uninstall
110 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/doc/simgrid
111 COMMAND ${CMAKE_COMMAND} -E echo "uninstall doc ok"
112 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/libgras*
113 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/libsimgrid*
114 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/libsmpi*
115 COMMAND ${CMAKE_COMMAND} -E echo "uninstall lib ok"
116 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/bin/smpicc
117 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/bin/smpirun
118 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/bin/tesh
119 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/bin/simgrid-colorizer
120 COMMAND ${CMAKE_COMMAND} -E echo "uninstall bin ok"
121 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/amok
122 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/gras
123 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/instr
124 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/msg
125 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/simdag
126 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/smpi
127 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/surf
128 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/xbt
129 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/mc
130 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/include/simgrid_config.h
131 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/include/gras.h
132 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/include/xbt.h
133 COMMAND ${CMAKE_COMMAND} -E echo "uninstal include ok"
134 WORKING_DIRECTORY "${prefix}"
138 add_custom_command(TARGET uninstall
139 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/share/simgrid.jar
140 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding java ok"
141 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
146 add_custom_command(TARGET uninstall
147 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding lua ok"
148 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/lua/5.1/simgrid.${LIB_EXE}
149 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
154 string(REGEX REPLACE "^.*ruby/" "" install_link_ruby "${RUBY_ARCH_DIR}")
155 add_custom_command(TARGET uninstall
156 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding ruby ok"
157 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
158 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/ruby/${install_link_ruby}/simgrid.rb
159 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
163 ######################################
164 ### Fill in the "make html" target ###
165 ######################################
167 add_custom_target(html
168 DEPENDS ${PROJECT_DIRECTORY}/doc/all_bib.html
169 COMMAND ${CMAKE_COMMAND} -E echo "cmake -DBIBTEX2HTML=${BIBTEX2HTML} ./"
170 COMMAND ${CMAKE_COMMAND} -DBIBTEX2HTML=${BIBTEX2HTML} ./
171 COMMAND ${CMAKE_COMMAND} -E remove_directory ${PROJECT_DIRECTORY}/buildtools/Cmake/doc/CMakeFiles
172 COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/buildtools/Cmake/doc/CMakeCache.txt
173 COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/buildtools/Cmake/doc/cmake_install.cmake
174 COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/buildtools/Cmake/doc/Makefile
175 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/buildtools/Cmake/doc"
179 OUTPUT ${PROJECT_DIRECTORY}/doc/all_bib.html
180 ${PROJECT_DIRECTORY}/doc/all_bib.latin1.html
181 ${PROJECT_DIRECTORY}/doc/all_bib.latin1.html.tmp
182 ${PROJECT_DIRECTORY}/doc/logcategories.sh
183 ${PROJECT_DIRECTORY}/doc/publis_core.bib
184 ${PROJECT_DIRECTORY}/doc/publis_core_bib.html
185 ${PROJECT_DIRECTORY}/doc/publis_core_bib.latin1.html
186 ${PROJECT_DIRECTORY}/doc/publis_core_bib.latin1.html.tmp
187 ${PROJECT_DIRECTORY}/doc/publis_count.html
188 ${PROJECT_DIRECTORY}/doc/publis_extern.bib
189 ${PROJECT_DIRECTORY}/doc/publis_extern_bib.html
190 ${PROJECT_DIRECTORY}/doc/publis_extern_bib.latin1.html
191 ${PROJECT_DIRECTORY}/doc/publis_extern_bib.latin1.html.tmp
192 ${PROJECT_DIRECTORY}/doc/publis_intra.bib
193 ${PROJECT_DIRECTORY}/doc/publis_intra_bib.html
194 ${PROJECT_DIRECTORY}/doc/publis_intra_bib.latin1.html
195 ${PROJECT_DIRECTORY}/doc/publis_intra_bib.latin1.html.tmp
196 ${PROJECT_DIRECTORY}/doc/tmp.realtoc
197 ${PROJECT_DIRECTORY}/doc/using_bib.html
198 ${PROJECT_DIRECTORY}/doc/using_bib.latin1.html
199 ${PROJECT_DIRECTORY}/doc/using_bib.latin1.html.tmp
200 ${PROJECT_DIRECTORY}/doc/realtoc.sh
201 ${PROJECT_DIRECTORY}/doc/html
202 COMMAND ${CMAKE_COMMAND} -E echo "Make the html doc"
205 ################################################################
206 ## Build a sain "make dist" target to build a source package ###
207 ## containing only the files that I explicitely state ###
208 ## (instead of any cruft laying on my disk as CPack does) ###
209 ################################################################
211 ##########################################
212 ### Fill in the "make dist-dir" target ###
213 ##########################################
215 add_custom_target(dist-dir
216 COMMAND test -e simgrid-${release_version}/ && chmod -R a+w simgrid-${release_version}/ || true
217 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}
218 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}
219 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/doc/html/
220 COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_DIRECTORY}/doc/html/ simgrid-${release_version}/doc/html/
223 set(dirs_in_tarball "")
224 foreach(file ${source_to_pack})
225 # This damn prefix is still set somewhere (seems to be in subdirs)
226 string(REPLACE "${PROJECT_DIRECTORY}/" "" file "${file}")
228 # Create the directory on need
229 get_filename_component(file_location ${file} PATH)
230 string(REGEX MATCH ";${file_location};" OPERATION "${dirs_in_tarball}")
232 set(dirs_in_tarball "${dirs_in_tarball};${file_location};")
235 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/${file_location}/
239 # Actually copy the file
242 COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_DIRECTORY}/${file} simgrid-${release_version}/${file_location}/
244 endforeach(file ${source_to_pack})
246 ######################################
247 ### Fill in the "make dist" target ###
248 ######################################
250 add_custom_target(dist
251 DEPENDS ${CMAKE_BINARY_DIR}/simgrid-${release_version}.tar.gz
254 OUTPUT ${CMAKE_BINARY_DIR}/simgrid-${release_version}.tar.gz
255 COMMAND ${CMAKE_COMMAND} -E tar cf simgrid-${release_version}.tar simgrid-${release_version}/
256 COMMAND gzip -9v simgrid-${release_version}.tar
257 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}
259 add_dependencies(dist dist-dir)
261 ###########################################
262 ### Fill in the "make distcheck" target ###
263 ###########################################
265 # Allow to test the "make dist"
266 add_custom_target(distcheck
267 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}.cpy
268 COMMAND ${CMAKE_COMMAND} -E copy_directory simgrid-${release_version}/ simgrid-${release_version}.cpy
269 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_build
270 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_inst
272 # This stupid cmake creates a directory in source, killing the purpose of the chmod
274 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/CMakeFiles
275 # COMMAND chmod -R a-w simgrid-${release_version}/ # FIXME: we should pass without commenting that line
276 COMMAND chmod -R a+w simgrid-${release_version}/_build
277 COMMAND chmod -R a+w simgrid-${release_version}/_inst
278 COMMAND chmod -R a+w simgrid-${release_version}/CMakeFiles
280 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ${CMAKE_COMMAND} build .. -Dprefix=../_inst
281 # COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make dist-dir
282 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make
284 # This fails, unfortunately, because GRAS is broken for now
285 # COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ctest -j5 --output-on-failure
287 COMMAND ${CMAKE_COMMAND} -E echo "XXX Check that cleaning works"
288 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make clean
289 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/_build
290 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/_inst
291 COMMAND diff -ruN simgrid-${release_version}.cpy simgrid-${release_version}
292 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}.cpy
293 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/
295 add_dependencies(distcheck dist-dir)
297 #######################################
298 ### Fill in the "make check" target ###
299 #######################################
302 add_custom_target(check
303 COMMAND ctest -D ExperimentalMemCheck
305 else(enable_memcheck)
306 add_custom_target(check
309 endif(enable_memcheck)
311 #######################################
312 ### Fill in the "make xxx-clean" target ###
313 #######################################
315 add_custom_target(maintainer-clean
316 COMMAND ${CMAKE_COMMAND} -E remove -f src/config_unit.c
317 COMMAND ${CMAKE_COMMAND} -E remove -f src/cunit_unit.c
318 COMMAND ${CMAKE_COMMAND} -E remove -f src/dict_unit.c
319 COMMAND ${CMAKE_COMMAND} -E remove -f src/dynar_unit.c
320 COMMAND ${CMAKE_COMMAND} -E remove -f src/ex_unit.c
321 COMMAND ${CMAKE_COMMAND} -E remove -f src/set_unit.c
322 COMMAND ${CMAKE_COMMAND} -E remove -f src/simgrid_units_main.c
323 COMMAND ${CMAKE_COMMAND} -E remove -f src/swag_unit.c
324 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_sha_unit.c
325 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_str_unit.c
326 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_strbuff_unit.c
327 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_synchro_unit.c
328 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
331 add_custom_target(supernovae-clean
332 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_gras.c
333 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_sg.c
334 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_smpi.c
335 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
338 #############################################
339 ### Fill in the "make sync-gforge" target ###
340 #############################################
342 add_custom_target(sync-gforge
343 COMMAND chmod g+rw -R doc/
344 COMMAND chmod a+rX -R doc/
345 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
346 COMMAND scp doc/index.php doc/webcruft/robots.txt scm.gforge.inria.fr:/home/groups/simgrid/htdocs/
347 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/
348 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"