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)
53 string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/" "" location "${location}")
55 DESTINATION $ENV{DESTDIR}${prefix}/${location})
56 endforeach(file ${install_HEADERS})
59 foreach(file ${examples_to_install_in_doc})
60 string(REPLACE "${PROJECT_DIRECTORY}/examples/" "" file ${file})
61 get_filename_component(location ${file} PATH)
62 install(FILES "examples/${file}"
63 DESTINATION $ENV{DESTDIR}${prefix}/doc/simgrid/examples/${location})
64 endforeach(file ${examples_to_install_in_doc})
68 install(FILES ${CMAKE_BINARY_DIR}/simgrid.jar
69 DESTINATION $ENV{DESTDIR}${prefix}/share/)
73 file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/lib/lua/5.1")
74 add_custom_target(simgrid_lua ALL
76 ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
79 OUTPUT ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
80 COMMAND ${CMAKE_COMMAND} -E create_symlink ../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
82 install(FILES ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
83 DESTINATION $ENV{DESTDIR}${prefix}/lib/lua/5.1
88 string(REGEX REPLACE "^.*ruby/" "" install_link_ruby "${RUBY_ARCH_DIR}")
89 file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}")
90 add_custom_target(ruby_simgrid ALL
92 ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
95 OUTPUT ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
96 COMMAND ${CMAKE_COMMAND} -E create_symlink ../../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
98 install(FILES ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
99 DESTINATION $ENV{DESTDIR}${prefix}/lib/ruby/${install_link_ruby}/
101 install(FILES ${PROJECT_DIRECTORY}/src/bindings/ruby/simgrid.rb
102 DESTINATION $ENV{DESTDIR}${prefix}/lib/ruby/${install_link_ruby}/)
106 ###########################################
107 ### Fill in the "make uninstall" target ###
108 ###########################################
110 add_custom_target(uninstall
111 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/doc/simgrid
112 COMMAND ${CMAKE_COMMAND} -E echo "uninstall doc ok"
113 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/libgras*
114 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/libsimgrid*
115 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/libsmpi*
116 COMMAND ${CMAKE_COMMAND} -E echo "uninstall lib ok"
117 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/bin/smpicc
118 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/bin/smpirun
119 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/bin/tesh
120 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/bin/simgrid-colorizer
121 COMMAND ${CMAKE_COMMAND} -E echo "uninstall bin ok"
122 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/amok
123 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/gras
124 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/instr
125 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/msg
126 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/simdag
127 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/smpi
128 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/surf
129 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/xbt
130 COMMAND ${CMAKE_COMMAND} -E remove_directory ${prefix}/include/mc
131 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/include/simgrid_config.h
132 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/include/gras.h
133 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/include/xbt.h
134 COMMAND ${CMAKE_COMMAND} -E echo "uninstal include ok"
135 WORKING_DIRECTORY "${prefix}"
139 add_custom_command(TARGET uninstall
140 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/share/simgrid.jar
141 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding java ok"
142 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
147 add_custom_command(TARGET uninstall
148 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding lua ok"
149 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/lua/5.1/simgrid.${LIB_EXE}
150 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
155 string(REGEX REPLACE "^.*ruby/" "" install_link_ruby "${RUBY_ARCH_DIR}")
156 add_custom_command(TARGET uninstall
157 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding ruby ok"
158 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
159 COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/ruby/${install_link_ruby}/simgrid.rb
160 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
164 ######################################
165 ### Fill in the "make html" target ###
166 ######################################
168 add_custom_target(html
169 DEPENDS ${PROJECT_DIRECTORY}/doc/all_bib.html
170 COMMAND ${CMAKE_COMMAND} -E echo "cmake -DBIBTEX2HTML=${BIBTEX2HTML} ./"
171 COMMAND ${CMAKE_COMMAND} -DBIBTEX2HTML=${BIBTEX2HTML} ./
172 COMMAND ${CMAKE_COMMAND} -E remove_directory ${PROJECT_DIRECTORY}/buildtools/Cmake/doc/CMakeFiles
173 COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/buildtools/Cmake/doc/CMakeCache.txt
174 COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/buildtools/Cmake/doc/cmake_install.cmake
175 COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/buildtools/Cmake/doc/Makefile
176 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/buildtools/Cmake/doc"
180 OUTPUT ${PROJECT_DIRECTORY}/doc/all_bib.html
181 ${PROJECT_DIRECTORY}/doc/all_bib.latin1.html
182 ${PROJECT_DIRECTORY}/doc/all_bib.latin1.html.tmp
183 ${PROJECT_DIRECTORY}/doc/logcategories.sh
184 ${PROJECT_DIRECTORY}/doc/publis_core.bib
185 ${PROJECT_DIRECTORY}/doc/publis_core_bib.html
186 ${PROJECT_DIRECTORY}/doc/publis_core_bib.latin1.html
187 ${PROJECT_DIRECTORY}/doc/publis_core_bib.latin1.html.tmp
188 ${PROJECT_DIRECTORY}/doc/publis_count.html
189 ${PROJECT_DIRECTORY}/doc/publis_extern.bib
190 ${PROJECT_DIRECTORY}/doc/publis_extern_bib.html
191 ${PROJECT_DIRECTORY}/doc/publis_extern_bib.latin1.html
192 ${PROJECT_DIRECTORY}/doc/publis_extern_bib.latin1.html.tmp
193 ${PROJECT_DIRECTORY}/doc/publis_intra.bib
194 ${PROJECT_DIRECTORY}/doc/publis_intra_bib.html
195 ${PROJECT_DIRECTORY}/doc/publis_intra_bib.latin1.html
196 ${PROJECT_DIRECTORY}/doc/publis_intra_bib.latin1.html.tmp
197 ${PROJECT_DIRECTORY}/doc/tmp.realtoc
198 ${PROJECT_DIRECTORY}/doc/using_bib.html
199 ${PROJECT_DIRECTORY}/doc/using_bib.latin1.html
200 ${PROJECT_DIRECTORY}/doc/using_bib.latin1.html.tmp
201 ${PROJECT_DIRECTORY}/doc/realtoc.sh
202 ${PROJECT_DIRECTORY}/doc/html
203 COMMAND ${CMAKE_COMMAND} -E echo "Make the html doc"
206 ################################################################
207 ## Build a sain "make dist" target to build a source package ###
208 ## containing only the files that I explicitely state ###
209 ## (instead of any cruft laying on my disk as CPack does) ###
210 ################################################################
212 ##########################################
213 ### Fill in the "make dist-dir" target ###
214 ##########################################
216 add_custom_target(dist-dir
217 COMMAND test -e simgrid-${release_version}/ && chmod -R a+w simgrid-${release_version}/ || true
218 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}
219 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}
220 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/doc/html/
221 COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_DIRECTORY}/doc/html/ simgrid-${release_version}/doc/html/
224 set(dirs_in_tarball "")
225 foreach(file ${source_to_pack})
226 # This damn prefix is still set somewhere (seems to be in subdirs)
227 string(REPLACE "${PROJECT_DIRECTORY}/" "" file "${file}")
229 # Create the directory on need
230 get_filename_component(file_location ${file} PATH)
231 string(REGEX MATCH ";${file_location};" OPERATION "${dirs_in_tarball}")
233 set(dirs_in_tarball "${dirs_in_tarball};${file_location};")
236 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/${file_location}/
240 # Actually copy the file
243 COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_DIRECTORY}/${file} simgrid-${release_version}/${file_location}/
245 endforeach(file ${source_to_pack})
247 ######################################
248 ### Fill in the "make dist" target ###
249 ######################################
251 add_custom_target(dist
252 DEPENDS ${CMAKE_BINARY_DIR}/simgrid-${release_version}.tar.gz
255 OUTPUT ${CMAKE_BINARY_DIR}/simgrid-${release_version}.tar.gz
256 COMMAND ${CMAKE_COMMAND} -E tar cf simgrid-${release_version}.tar simgrid-${release_version}/
257 COMMAND gzip -9v simgrid-${release_version}.tar
258 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}
260 add_dependencies(dist dist-dir)
262 ###########################################
263 ### Fill in the "make distcheck" target ###
264 ###########################################
266 # Allow to test the "make dist"
267 add_custom_target(distcheck
268 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}.cpy
269 COMMAND ${CMAKE_COMMAND} -E copy_directory simgrid-${release_version}/ simgrid-${release_version}.cpy
270 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_build
271 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_inst
273 # This stupid cmake creates a directory in source, killing the purpose of the chmod
275 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/CMakeFiles
276 # COMMAND chmod -R a-w simgrid-${release_version}/ # FIXME: we should pass without commenting that line
277 COMMAND chmod -R a+w simgrid-${release_version}/_build
278 COMMAND chmod -R a+w simgrid-${release_version}/_inst
279 COMMAND chmod -R a+w simgrid-${release_version}/CMakeFiles
281 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ${CMAKE_COMMAND} build .. -Dprefix=../_inst
282 # COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make dist-dir
283 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make
285 # This fails, unfortunately, because GRAS is broken for now
286 # COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ctest -j5 --output-on-failure
288 COMMAND ${CMAKE_COMMAND} -E echo "XXX Check that cleaning works"
289 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make clean
290 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/_build
291 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/_inst
292 COMMAND diff -ruN simgrid-${release_version}.cpy simgrid-${release_version}
293 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}.cpy
294 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/
296 add_dependencies(distcheck dist-dir)
298 #######################################
299 ### Fill in the "make check" target ###
300 #######################################
303 add_custom_target(check
304 COMMAND ctest -D ExperimentalMemCheck
306 else(enable_memcheck)
307 add_custom_target(check
310 endif(enable_memcheck)
312 #######################################
313 ### Fill in the "make xxx-clean" target ###
314 #######################################
316 add_custom_target(maintainer-clean
317 COMMAND ${CMAKE_COMMAND} -E remove -f src/config_unit.c
318 COMMAND ${CMAKE_COMMAND} -E remove -f src/cunit_unit.c
319 COMMAND ${CMAKE_COMMAND} -E remove -f src/dict_unit.c
320 COMMAND ${CMAKE_COMMAND} -E remove -f src/dynar_unit.c
321 COMMAND ${CMAKE_COMMAND} -E remove -f src/ex_unit.c
322 COMMAND ${CMAKE_COMMAND} -E remove -f src/set_unit.c
323 COMMAND ${CMAKE_COMMAND} -E remove -f src/simgrid_units_main.c
324 COMMAND ${CMAKE_COMMAND} -E remove -f src/swag_unit.c
325 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_sha_unit.c
326 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_str_unit.c
327 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_strbuff_unit.c
328 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_synchro_unit.c
329 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
332 add_custom_target(supernovae-clean
333 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_gras.c
334 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_sg.c
335 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_smpi.c
336 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
339 #############################################
340 ### Fill in the "make sync-gforge" target ###
341 #############################################
343 add_custom_target(sync-gforge
344 COMMAND chmod g+rw -R doc/
345 COMMAND chmod a+rX -R doc/
346 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
347 COMMAND scp doc/index.php doc/webcruft/robots.txt scm.gforge.inria.fr:/home/groups/simgrid/htdocs/
348 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/
349 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"