1 #########################################
2 ### Fill in the "make install" target ###
3 #########################################
6 if(NOT EXISTS ${CMAKE_HOME_DIRECTORY}/doc/html/)
7 file(MAKE_DIRECTORY ${CMAKE_HOME_DIRECTORY}/doc/html/)
8 endif(NOT EXISTS ${CMAKE_HOME_DIRECTORY}/doc/html/)
9 install(DIRECTORY "${CMAKE_HOME_DIRECTORY}/doc/html/"
10 DESTINATION "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/doc/simgrid/html/"
11 PATTERN ".svn" EXCLUDE
12 PATTERN ".git" EXCLUDE
18 install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/smpicc
19 ${CMAKE_BINARY_DIR}/bin/smpif2c
20 ${CMAKE_BINARY_DIR}/bin/smpiff
21 ${CMAKE_BINARY_DIR}/bin/smpirun
22 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
24 install(PROGRAMS ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/tesh.pl
25 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/
27 add_custom_target(tesh
28 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/tesh.pl ${CMAKE_BINARY_DIR}/bin/tesh
31 install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/tesh
32 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
35 install(PROGRAMS ${CMAKE_HOME_DIRECTORY}/tools/MSG_visualization/colorize.pl
36 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/
37 RENAME simgrid-colorizer)
39 add_custom_target(simgrid-colorizer ALL
40 COMMENT "Install ${CMAKE_BINARY_DIR}/bin/colorize"
41 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/tools/MSG_visualization/colorize.pl ${CMAKE_BINARY_DIR}/bin/colorize
44 install(PROGRAMS ${CMAKE_HOME_DIRECTORY}/tools/simgrid_update_xml.pl
45 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/
46 RENAME simgrid_update_xml)
48 add_custom_target(simgrid_update_xml ALL
49 COMMENT "Install ${CMAKE_BINARY_DIR}/bin/simgrid_update_xml"
50 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/tools/simgrid_update_xml.pl ${CMAKE_BINARY_DIR}/bin/simgrid_update_xml
53 install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/gras_stub_generator
54 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
57 install(TARGETS simgrid gras
58 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
62 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
65 if(enable_lib_static AND NOT WIN32)
66 install(TARGETS simgrid_static
67 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
69 install(TARGETS smpi_static
70 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
72 endif(enable_lib_static AND NOT WIN32)
75 foreach(file ${install_HEADERS})
76 get_filename_component(location ${file} PATH)
77 string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/" "" location "${location}")
79 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${location})
80 endforeach(file ${install_HEADERS})
83 foreach(file ${examples_to_install_in_doc})
84 string(REPLACE "${CMAKE_HOME_DIRECTORY}/examples/" "" file ${file})
85 get_filename_component(location ${file} PATH)
86 install(FILES "examples/${file}"
87 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/doc/simgrid/examples/${location})
88 endforeach(file ${examples_to_install_in_doc})
91 foreach(file ${README_examples_files})
92 string(REPLACE "${CMAKE_HOME_DIRECTORY}/examples/" "" file ${file})
93 get_filename_component(location ${file} PATH)
94 install(FILES "examples/${file}"
95 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/doc/simgrid/examples/${location})
96 endforeach(file ${README_examples_files})
100 install(FILES ${CMAKE_BINARY_DIR}/simgrid.jar
101 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/share/)
105 file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/lib/lua/5.1")
106 add_custom_target(simgrid_lua ALL
108 ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
111 OUTPUT ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
112 COMMAND ${CMAKE_COMMAND} -E create_symlink ../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
114 install(FILES ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
115 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/lua/5.1
120 string(REGEX REPLACE "^.*ruby/" "" install_link_ruby "${RUBY_ARCH_DIR}")
121 file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}")
122 add_custom_target(ruby_simgrid ALL
124 ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
127 OUTPUT ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
128 COMMAND ${CMAKE_COMMAND} -E create_symlink ../../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
130 install(FILES ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
131 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/ruby/${install_link_ruby}/
133 install(FILES ${CMAKE_HOME_DIRECTORY}/src/bindings/ruby/simgrid.rb
134 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/ruby/${install_link_ruby}/)
138 ###########################################
139 ### Fill in the "make uninstall" target ###
140 ###########################################
142 add_custom_target(uninstall
143 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/doc/simgrid
144 COMMAND ${CMAKE_COMMAND} -E echo "uninstall doc ok"
145 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/libgras*
146 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/libsimgrid*
147 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/libsmpi*
148 COMMAND ${CMAKE_COMMAND} -E echo "uninstall lib ok"
149 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpicc
150 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpif2c
151 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpiff
152 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpirun
153 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/tesh
154 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/simgrid-colorizer
155 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/simgrid_update_xml
156 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/gras_stub_generator
157 COMMAND ${CMAKE_COMMAND} -E echo "uninstall bin ok"
158 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/amok
159 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/gras
160 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/instr
161 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/msg
162 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/simdag
163 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/smpi
164 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/surf
165 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/xbt
166 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/mc
167 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/include/simgrid_config.h
168 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/include/gras.h
169 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/include/xbt.h
170 COMMAND ${CMAKE_COMMAND} -E echo "uninstall include ok"
171 WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
175 add_custom_command(TARGET uninstall
176 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/share/simgrid.jar
177 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding java ok"
178 WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}/"
183 add_custom_command(TARGET uninstall
184 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding lua ok"
185 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/lua/5.1/simgrid.${LIB_EXE}
186 WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}/"
191 string(REGEX REPLACE "^.*ruby/" "" install_link_ruby "${RUBY_ARCH_DIR}")
192 add_custom_command(TARGET uninstall
193 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding ruby ok"
194 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
195 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/ruby/${install_link_ruby}/simgrid.rb
196 WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}/"
200 ################################################################
201 ## Build a sain "make dist" target to build a source package ###
202 ## containing only the files that I explicitely state ###
203 ## (instead of any cruft laying on my disk as CPack does) ###
204 ################################################################
206 ##########################################
207 ### Fill in the "make dist-dir" target ###
208 ##########################################
211 add_custom_target(dist-dir
212 COMMENT "Generating the distribution directory"
213 COMMAND test -e simgrid-${release_version}/ && chmod -R a+w simgrid-${release_version}/ || true
214 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/
215 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}
216 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/doc/html/
217 COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_HOME_DIRECTORY}/doc/html/ simgrid-${release_version}/doc/html/
219 add_dependencies(dist-dir simgrid_documentation)
221 add_custom_target(dist-dir
222 COMMAND ${CMAKE_COMMAND} -E echo "Please enable the doc to generate the doc"
223 COMMAND I_said_PLEASE_ENABLE_THE_DOC_GENERATION_BEFORE_BUILDING_AN_ARCHIVE
227 set(dirs_in_tarball "")
228 foreach(file ${source_to_pack})
230 # This damn prefix is still set somewhere (seems to be in subdirs)
231 string(REPLACE "${CMAKE_HOME_DIRECTORY}/" "" file "${file}")
233 # Create the directory on need
234 get_filename_component(file_location ${file} PATH)
235 string(REGEX MATCH ";${file_location};" OPERATION "${dirs_in_tarball}")
237 set(dirs_in_tarball "${dirs_in_tarball};${file_location};")
240 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/${file_location}/
244 # Actually copy the file
247 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/${file} simgrid-${release_version}/${file_location}/
249 endforeach(file ${source_to_pack})
251 ######################################
252 ### Fill in the "make dist" target ###
253 ######################################
255 add_custom_target(dist
256 DEPENDS ${CMAKE_BINARY_DIR}/simgrid-${release_version}.tar.gz
259 OUTPUT ${CMAKE_BINARY_DIR}/simgrid-${release_version}.tar.gz
260 COMMENT "Compressing the archive from the distribution directory"
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 echo "XXX remove old copy"
274 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}.cpy
275 COMMAND ${CMAKE_COMMAND} -E echo "XXX copy again the source tree"
276 COMMAND ${CMAKE_COMMAND} -E copy_directory simgrid-${release_version}/ simgrid-${release_version}.cpy
277 COMMAND ${CMAKE_COMMAND} -E echo "XXX create build and install subtrees"
278 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_build
279 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_inst
281 # This stupid cmake creates a directory in source, killing the purpose of the chmod
283 COMMAND ${CMAKE_COMMAND} -E echo "XXX change the modes of directories"
284 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/CMakeFiles
285 COMMAND chmod -R a-w simgrid-${release_version}/ # FIXME: we should pass without commenting that line
286 COMMAND chmod -R a+w simgrid-${release_version}/_build
287 COMMAND chmod -R a+w simgrid-${release_version}/_inst
288 COMMAND chmod -R a+w simgrid-${release_version}/CMakeFiles
290 COMMAND ${CMAKE_COMMAND} -E echo "XXX Configure"
291 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ${CMAKE_COMMAND} build .. -DCMAKE_INSTALL_PREFIX=../_inst -Wno-dev -Denable_doc=OFF
292 # COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make dist-dir
293 COMMAND ${CMAKE_COMMAND} -E echo "XXX Build"
294 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make VERBOSE=1
296 # This fails, unfortunately, because GRAS is broken for now
297 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ctest -j5 --output-on-failure
299 COMMAND ${CMAKE_COMMAND} -E echo "XXX Check that cleaning works"
300 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make clean
301 COMMAND ${CMAKE_COMMAND} -E echo "XXX Display what is remaining after make clean"
302 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ls -lR
303 COMMAND ${CMAKE_COMMAND} -E echo "XXX Remove _build and _inst directories"
304 COMMAND chmod a+w simgrid-${release_version}/
305 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/_build
306 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/_inst
307 COMMAND ${CMAKE_COMMAND} -E echo "XXX The output of the diff follows"
308 COMMAND diff -ruN simgrid-${release_version}.cpy simgrid-${release_version}
309 COMMAND ${CMAKE_COMMAND} -E echo "XXX end of the diff, random cleanups now"
310 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}.cpy
311 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}
313 add_dependencies(distcheck dist-dir)
315 #######################################
316 ### Fill in the "make check" target ###
317 #######################################
320 add_custom_target(check
321 COMMAND ctest -D ExperimentalMemCheck
323 else(enable_memcheck)
324 add_custom_target(check
327 endif(enable_memcheck)
329 #######################################
330 ### Fill in the "make xxx-clean" target ###
331 #######################################
333 add_custom_target(maintainer-clean
334 COMMAND ${CMAKE_COMMAND} -E remove -f src/config_unit.c
335 COMMAND ${CMAKE_COMMAND} -E remove -f src/cunit_unit.c
336 COMMAND ${CMAKE_COMMAND} -E remove -f src/dict_unit.c
337 COMMAND ${CMAKE_COMMAND} -E remove -f src/dynar_unit.c
338 COMMAND ${CMAKE_COMMAND} -E remove -f src/ex_unit.c
339 COMMAND ${CMAKE_COMMAND} -E remove -f src/set_unit.c
340 COMMAND ${CMAKE_COMMAND} -E remove -f src/simgrid_units_main.c
341 COMMAND ${CMAKE_COMMAND} -E remove -f src/swag_unit.c
342 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_sha_unit.c
343 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_str_unit.c
344 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_strbuff_unit.c
345 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_synchro_unit.c
346 WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}"
349 add_custom_target(supernovae-clean
350 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_gras.c
351 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_sg.c
352 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_smpi.c
353 WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}"
356 #############################################
357 ### Fill in the "make sync-gforge" target ###
358 #############################################
360 add_custom_target(sync-gforge
361 COMMAND chmod g+rw -R doc/
362 COMMAND chmod a+rX -R doc/
363 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
364 COMMAND scp doc/index.php doc/webcruft/robots.txt scm.gforge.inria.fr:/home/groups/simgrid/htdocs/
365 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/
366 WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}"