1 #########################################
2 ### Fill in the "make install" target ###
3 #########################################
7 if(NOT EXISTS ${PROJECT_DIRECTORY}/doc/html/)
8 file(MAKE_DIRECTORY ${PROJECT_DIRECTORY}/doc/html/)
9 endif(NOT EXISTS ${PROJECT_DIRECTORY}/doc/html/)
10 install(DIRECTORY "${PROJECT_DIRECTORY}/doc/html/"
11 DESTINATION "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/doc/simgrid/html/"
12 PATTERN ".svn" EXCLUDE
13 PATTERN ".git" EXCLUDE
20 install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/smpicc
21 ${CMAKE_BINARY_DIR}/bin/smpif2c
22 ${CMAKE_BINARY_DIR}/bin/smpiff
23 ${CMAKE_BINARY_DIR}/bin/smpirun
24 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
26 install(PROGRAMS ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/tesh.pl
27 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/
29 add_custom_target(tesh
30 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/tesh.pl ${CMAKE_BINARY_DIR}/bin/tesh
33 install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/tesh
34 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
37 install(PROGRAMS ${CMAKE_HOME_DIRECTORY}/tools/MSG_visualization/colorize.pl
38 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/
39 RENAME simgrid-colorizer)
41 add_custom_target(simgrid-colorizer ALL
42 COMMENT "Install ${CMAKE_BINARY_DIR}/bin/colorize"
43 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/tools/MSG_visualization/colorize.pl ${CMAKE_BINARY_DIR}/bin/colorize
46 install(PROGRAMS ${CMAKE_HOME_DIRECTORY}/tools/simgrid_update_xml.pl
47 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/
48 RENAME simgrid_update_xml)
50 add_custom_target(simgrid_update_xml ALL
51 COMMENT "Install ${CMAKE_BINARY_DIR}/bin/simgrid_update_xml"
52 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/tools/simgrid_update_xml.pl ${CMAKE_BINARY_DIR}/bin/simgrid_update_xml
55 install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/gras_stub_generator
56 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
59 install(TARGETS simgrid gras
60 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
64 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
67 if(enable_lib_static AND NOT WIN32)
68 install(TARGETS simgrid_static
69 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
71 install(TARGETS smpi_static
72 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
74 endif(enable_lib_static AND NOT WIN32)
77 foreach(file ${install_HEADERS})
78 get_filename_component(location ${file} PATH)
79 string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/" "" location "${location}")
81 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${location})
82 endforeach(file ${install_HEADERS})
85 foreach(file ${examples_to_install_in_doc})
86 string(REPLACE "${PROJECT_DIRECTORY}/examples/" "" file ${file})
87 get_filename_component(location ${file} PATH)
88 install(FILES "examples/${file}"
89 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/doc/simgrid/examples/${location})
90 endforeach(file ${examples_to_install_in_doc})
93 foreach(file ${README_examples_files})
94 string(REPLACE "${PROJECT_DIRECTORY}/examples/" "" file ${file})
95 get_filename_component(location ${file} PATH)
96 install(FILES "examples/${file}"
97 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/doc/simgrid/examples/${location})
98 endforeach(file ${README_examples_files})
102 install(FILES ${CMAKE_BINARY_DIR}/simgrid.jar
103 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/share/)
107 file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/lib/lua/5.1")
108 add_custom_target(simgrid_lua ALL
110 ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
113 OUTPUT ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
114 COMMAND ${CMAKE_COMMAND} -E create_symlink ../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
116 install(FILES ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
117 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/lua/5.1
122 string(REGEX REPLACE "^.*ruby/" "" install_link_ruby "${RUBY_ARCH_DIR}")
123 file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}")
124 add_custom_target(ruby_simgrid ALL
126 ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
129 OUTPUT ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
130 COMMAND ${CMAKE_COMMAND} -E create_symlink ../../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
132 install(FILES ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
133 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/ruby/${install_link_ruby}/
135 install(FILES ${PROJECT_DIRECTORY}/src/bindings/ruby/simgrid.rb
136 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/ruby/${install_link_ruby}/)
140 ###########################################
141 ### Fill in the "make uninstall" target ###
142 ###########################################
144 add_custom_target(uninstall
145 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/doc/simgrid
146 COMMAND ${CMAKE_COMMAND} -E echo "uninstall doc ok"
147 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/libgras*
148 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/libsimgrid*
149 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/libsmpi*
150 COMMAND ${CMAKE_COMMAND} -E echo "uninstall lib ok"
151 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpicc
152 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpif2c
153 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpiff
154 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpirun
155 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/tesh
156 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/simgrid-colorizer
157 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/simgrid_update_xml
158 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/gras_stub_generator
159 COMMAND ${CMAKE_COMMAND} -E echo "uninstall bin ok"
160 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/amok
161 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/gras
162 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/instr
163 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/msg
164 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/simdag
165 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/smpi
166 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/surf
167 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/xbt
168 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/mc
169 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/include/simgrid_config.h
170 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/include/gras.h
171 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/include/xbt.h
172 COMMAND ${CMAKE_COMMAND} -E echo "uninstal include ok"
173 WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
177 add_custom_command(TARGET uninstall
178 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/share/simgrid.jar
179 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding java ok"
180 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
185 add_custom_command(TARGET uninstall
186 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding lua ok"
187 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/lua/5.1/simgrid.${LIB_EXE}
188 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
193 string(REGEX REPLACE "^.*ruby/" "" install_link_ruby "${RUBY_ARCH_DIR}")
194 add_custom_command(TARGET uninstall
195 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding ruby ok"
196 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
197 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/ruby/${install_link_ruby}/simgrid.rb
198 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
202 ################################################################
203 ## Build a sain "make dist" target to build a source package ###
204 ## containing only the files that I explicitely state ###
205 ## (instead of any cruft laying on my disk as CPack does) ###
206 ################################################################
208 ##########################################
209 ### Fill in the "make dist-dir" target ###
210 ##########################################
213 add_custom_target(dist-dir
214 COMMENT "Generating the distribution directory"
215 COMMAND test -e simgrid-${release_version}/ && chmod -R a+w simgrid-${release_version}/ || true
216 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/
217 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}
218 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/doc/html/
219 COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_DIRECTORY}/doc/html/ simgrid-${release_version}/doc/html/
221 add_dependencies(dist-dir simgrid_documentation)
223 add_custom_target(dist-dir
224 COMMAND ${CMAKE_COMMAND} -E echo "Please enable the doc to generate the doc"
225 COMMAND I_said_PLEASE_ENABLE_THE_DOC_GENERATION_BEFORE_BUILDING_AN_ARCHIVE
229 set(dirs_in_tarball "")
230 foreach(file ${source_to_pack})
232 # This damn prefix is still set somewhere (seems to be in subdirs)
233 string(REPLACE "${PROJECT_DIRECTORY}/" "" file "${file}")
235 # Create the directory on need
236 get_filename_component(file_location ${file} PATH)
237 string(REGEX MATCH ";${file_location};" OPERATION "${dirs_in_tarball}")
239 set(dirs_in_tarball "${dirs_in_tarball};${file_location};")
242 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/${file_location}/
246 # Actually copy the file
249 COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_DIRECTORY}/${file} simgrid-${release_version}/${file_location}/
251 endforeach(file ${source_to_pack})
253 ######################################
254 ### Fill in the "make dist" target ###
255 ######################################
257 add_custom_target(dist
258 DEPENDS ${CMAKE_BINARY_DIR}/simgrid-${release_version}.tar.gz
261 OUTPUT ${CMAKE_BINARY_DIR}/simgrid-${release_version}.tar.gz
262 COMMENT "Compressing the archive from the distribution directory"
263 COMMAND ${CMAKE_COMMAND} -E tar cf simgrid-${release_version}.tar simgrid-${release_version}/
264 COMMAND gzip -9v simgrid-${release_version}.tar
265 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/
267 add_dependencies(dist dist-dir)
269 ###########################################
270 ### Fill in the "make distcheck" target ###
271 ###########################################
273 # Allow to test the "make dist"
274 add_custom_target(distcheck
275 COMMAND ${CMAKE_COMMAND} -E echo "XXX remove old copy"
276 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}.cpy
277 COMMAND ${CMAKE_COMMAND} -E echo "XXX copy again the source tree"
278 COMMAND ${CMAKE_COMMAND} -E copy_directory simgrid-${release_version}/ simgrid-${release_version}.cpy
279 COMMAND ${CMAKE_COMMAND} -E echo "XXX create build and install subtrees"
280 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_build
281 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_inst
283 # This stupid cmake creates a directory in source, killing the purpose of the chmod
285 COMMAND ${CMAKE_COMMAND} -E echo "XXX change the modes of directories"
286 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/CMakeFiles
287 COMMAND chmod -R a-w simgrid-${release_version}/ # FIXME: we should pass without commenting that line
288 COMMAND chmod -R a+w simgrid-${release_version}/_build
289 COMMAND chmod -R a+w simgrid-${release_version}/_inst
290 COMMAND chmod -R a+w simgrid-${release_version}/CMakeFiles
292 COMMAND ${CMAKE_COMMAND} -E echo "XXX Configure"
293 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ${CMAKE_COMMAND} build .. -DCMAKE_INSTALL_PREFIX=../_inst -Wno-dev -Denable_doc=OFF
294 # COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make dist-dir
295 COMMAND ${CMAKE_COMMAND} -E echo "XXX Build"
296 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make VERBOSE=1
298 # This fails, unfortunately, because GRAS is broken for now
299 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ctest -j5 --output-on-failure
301 COMMAND ${CMAKE_COMMAND} -E echo "XXX Check that cleaning works"
302 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make clean
303 COMMAND ${CMAKE_COMMAND} -E echo "XXX Display what is remaining after make clean"
304 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ls -lR
305 COMMAND ${CMAKE_COMMAND} -E echo "XXX Remove _build and _inst directories"
306 COMMAND chmod a+w simgrid-${release_version}/
307 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/_build
308 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/_inst
309 COMMAND ${CMAKE_COMMAND} -E echo "XXX The output of the diff follows"
310 COMMAND diff -ruN simgrid-${release_version}.cpy simgrid-${release_version}
311 COMMAND ${CMAKE_COMMAND} -E echo "XXX end of the diff, random cleanups now"
312 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}.cpy
313 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}
315 add_dependencies(distcheck dist-dir)
317 #######################################
318 ### Fill in the "make check" target ###
319 #######################################
322 add_custom_target(check
323 COMMAND ctest -D ExperimentalMemCheck
325 else(enable_memcheck)
326 add_custom_target(check
329 endif(enable_memcheck)
331 #######################################
332 ### Fill in the "make xxx-clean" target ###
333 #######################################
335 add_custom_target(maintainer-clean
336 COMMAND ${CMAKE_COMMAND} -E remove -f src/config_unit.c
337 COMMAND ${CMAKE_COMMAND} -E remove -f src/cunit_unit.c
338 COMMAND ${CMAKE_COMMAND} -E remove -f src/dict_unit.c
339 COMMAND ${CMAKE_COMMAND} -E remove -f src/dynar_unit.c
340 COMMAND ${CMAKE_COMMAND} -E remove -f src/ex_unit.c
341 COMMAND ${CMAKE_COMMAND} -E remove -f src/set_unit.c
342 COMMAND ${CMAKE_COMMAND} -E remove -f src/simgrid_units_main.c
343 COMMAND ${CMAKE_COMMAND} -E remove -f src/swag_unit.c
344 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_sha_unit.c
345 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_str_unit.c
346 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_strbuff_unit.c
347 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_synchro_unit.c
348 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
351 add_custom_target(supernovae-clean
352 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_gras.c
353 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_sg.c
354 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_smpi.c
355 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
358 #############################################
359 ### Fill in the "make sync-gforge" target ###
360 #############################################
362 add_custom_target(sync-gforge
363 COMMAND chmod g+rw -R doc/
364 COMMAND chmod a+rX -R doc/
365 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
366 COMMAND scp doc/index.php doc/webcruft/robots.txt scm.gforge.inria.fr:/home/groups/simgrid/htdocs/
367 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/
368 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"