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
17 #### Generate the manpages
19 set( MANPAGE_DIR $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/share/man/share/man/man1 )
20 endif( NOT MANPAGE_DIR)
22 add_custom_target(TARGET install
23 COMMAND ${CMAKE_COMMAND} -E make_directory ${MANPAGE_DIR}
24 COMMAND pod2man tools/simgrid_update_xml.pl > ${MANPAGE_DIR}/simgrid_update_xml.1
25 COMMENT "Generating manpages"
29 install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/smpicc
30 ${CMAKE_BINARY_DIR}/bin/smpif2c
31 ${CMAKE_BINARY_DIR}/bin/smpiff
32 ${CMAKE_BINARY_DIR}/bin/smpirun
33 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
35 install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/tesh
36 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
38 install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/graphicator
39 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
41 install(PROGRAMS ${CMAKE_HOME_DIRECTORY}/tools/MSG_visualization/colorize.pl
42 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/
43 RENAME simgrid-colorizer)
45 add_custom_target(simgrid-colorizer ALL
46 COMMENT "Install ${CMAKE_BINARY_DIR}/bin/colorize"
47 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/tools/MSG_visualization/colorize.pl ${CMAKE_BINARY_DIR}/bin/colorize
50 install(PROGRAMS ${CMAKE_HOME_DIRECTORY}/tools/simgrid_update_xml.pl
51 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/
52 RENAME simgrid_update_xml)
54 add_custom_target(simgrid_update_xml ALL
55 COMMENT "Install ${CMAKE_BINARY_DIR}/bin/simgrid_update_xml"
56 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/tools/simgrid_update_xml.pl ${CMAKE_BINARY_DIR}/bin/simgrid_update_xml
59 install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/gras_stub_generator
60 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
63 install(TARGETS simgrid gras
64 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
68 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
71 if(enable_lib_static AND NOT WIN32)
72 install(TARGETS simgrid_static
73 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
75 install(TARGETS smpi_static
76 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
78 endif(enable_lib_static AND NOT WIN32)
83 ${generated_headers_to_install}
85 foreach(file ${HEADERS})
86 get_filename_component(location ${file} PATH)
87 string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/" "" location "${location}")
89 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${location})
90 endforeach(file ${HEADERS})
93 foreach(file ${examples_to_install_in_doc})
94 string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/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 ${examples_to_install_in_doc})
103 file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/lib/lua/5.1")
104 add_custom_target(simgrid_lua ALL
106 ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
109 OUTPUT ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
110 COMMAND ${CMAKE_COMMAND} -E create_symlink ../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
112 install(FILES ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
113 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/lua/5.1
117 ###########################################
118 ### Fill in the "make uninstall" target ###
119 ###########################################
121 add_custom_target(uninstall
122 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/doc/simgrid
123 COMMAND ${CMAKE_COMMAND} -E echo "uninstall doc ok"
124 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/libgras*
125 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/libsimgrid*
126 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/libsmpi*
127 COMMAND ${CMAKE_COMMAND} -E echo "uninstall lib ok"
128 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpicc
129 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpif2c
130 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpiff
131 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpirun
132 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/tesh
133 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/simgrid-colorizer
134 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/simgrid_update_xml
135 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/gras_stub_generator
136 COMMAND ${CMAKE_COMMAND} -E echo "uninstall bin ok"
137 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/amok
138 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/gras
139 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/instr
140 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/msg
141 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/simdag
142 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/smpi
143 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/surf
144 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/xbt
145 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/mc
146 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/include/simgrid_config.h
147 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/include/gras.h
148 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/include/xbt.h
149 COMMAND ${CMAKE_COMMAND} -E echo "uninstall include ok"
150 WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
154 add_custom_command(TARGET uninstall
155 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding lua ok"
156 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/lua/5.1/simgrid.${LIB_EXE}
157 WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}/"
161 ################################################################
162 ## Build a sain "make dist" target to build a source package ###
163 ## containing only the files that I explicitely state ###
164 ## (instead of any cruft laying on my disk as CPack does) ###
165 ################################################################
167 ##########################################
168 ### Fill in the "make dist-dir" target ###
169 ##########################################
171 add_custom_target(dist-dir
172 COMMENT "Generating the distribution directory"
173 COMMAND test -e simgrid-${release_version}/ && chmod -R a+w simgrid-${release_version}/ || true
174 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/
175 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}
176 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/doc/html/
177 COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_HOME_DIRECTORY}/doc/html/ simgrid-${release_version}/doc/html/
179 add_dependencies(dist-dir simgrid_documentation)
180 add_dependencies(dist-dir maintainer_files)
182 set(dirs_in_tarball "")
183 foreach(file ${source_to_pack})
185 # This damn prefix is still set somewhere (seems to be in subdirs)
186 string(REPLACE "${CMAKE_HOME_DIRECTORY}/" "" file "${file}")
188 # Create the directory on need
189 get_filename_component(file_location ${file} PATH)
190 string(REGEX MATCH ";${file_location};" OPERATION "${dirs_in_tarball}")
192 set(dirs_in_tarball "${dirs_in_tarball};${file_location};")
195 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/${file_location}/
199 # Actually copy the file
202 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/${file} simgrid-${release_version}/${file_location}/
207 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/Makefile.default simgrid-${release_version}/Makefile
209 endforeach(file ${source_to_pack})
211 ######################################
212 ### Fill in the "make dist" target ###
213 ######################################
215 add_custom_target(dist
216 DEPENDS ${CMAKE_BINARY_DIR}/simgrid-${release_version}.tar.gz
219 OUTPUT ${CMAKE_BINARY_DIR}/simgrid-${release_version}.tar.gz
220 COMMENT "Compressing the archive from the distribution directory"
221 COMMAND ${CMAKE_COMMAND} -E tar cf simgrid-${release_version}.tar simgrid-${release_version}/
222 COMMAND gzip -9v simgrid-${release_version}.tar
223 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/
225 add_dependencies(dist dist-dir)
227 ###########################################
228 ### Fill in the "make distcheck" target ###
229 ###########################################
231 # Allow to test the "make dist"
232 add_custom_target(distcheck
233 COMMAND ${CMAKE_COMMAND} -E echo "XXX remove old copy"
234 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}.cpy
235 COMMAND ${CMAKE_COMMAND} -E echo "XXX copy again the source tree"
236 COMMAND ${CMAKE_COMMAND} -E copy_directory simgrid-${release_version}/ simgrid-${release_version}.cpy
237 COMMAND ${CMAKE_COMMAND} -E echo "XXX create build and install subtrees"
238 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_build
239 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_inst
241 # This stupid cmake creates a directory in source, killing the purpose of the chmod
243 COMMAND ${CMAKE_COMMAND} -E echo "XXX change the modes of directories"
244 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/CMakeFiles
245 COMMAND chmod -R a-w simgrid-${release_version}/ # FIXME: we should pass without commenting that line
246 COMMAND chmod -R a+w simgrid-${release_version}/_build
247 COMMAND chmod -R a+w simgrid-${release_version}/_inst
248 COMMAND chmod -R a+w simgrid-${release_version}/CMakeFiles
250 COMMAND ${CMAKE_COMMAND} -E echo "XXX Configure"
251 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ${CMAKE_COMMAND} build .. -DCMAKE_INSTALL_PREFIX=../_inst -Wno-dev -Denable_doc=OFF
252 # COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make dist-dir
253 COMMAND ${CMAKE_COMMAND} -E echo "XXX Build"
254 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make VERBOSE=1
256 # This fails, unfortunately, because GRAS is broken for now
257 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ctest -j5 --output-on-failure
259 COMMAND ${CMAKE_COMMAND} -E echo "XXX Check that cleaning works"
260 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make clean
261 COMMAND ${CMAKE_COMMAND} -E echo "XXX Display what is remaining after make clean"
262 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ls -lR
263 COMMAND ${CMAKE_COMMAND} -E echo "XXX Remove _build and _inst directories"
264 COMMAND chmod a+w simgrid-${release_version}/
265 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/_build
266 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/_inst
267 COMMAND ${CMAKE_COMMAND} -E echo "XXX The output of the diff follows"
268 COMMAND diff -ruN simgrid-${release_version}.cpy simgrid-${release_version}
269 COMMAND ${CMAKE_COMMAND} -E echo "XXX end of the diff, random cleanups now"
270 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}.cpy
271 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}
273 add_dependencies(distcheck dist-dir)
275 #######################################
276 ### Fill in the "make check" target ###
277 #######################################
280 add_custom_target(check
281 COMMAND ctest -D ExperimentalMemCheck
283 else(enable_memcheck)
284 add_custom_target(check
287 endif(enable_memcheck)
289 #######################################
290 ### Fill in the "make xxx-clean" target ###
291 #######################################
293 add_custom_target(maintainer-clean
294 COMMAND ${CMAKE_COMMAND} -E remove -f src/config_unit.c
295 COMMAND ${CMAKE_COMMAND} -E remove -f src/cunit_unit.c
296 COMMAND ${CMAKE_COMMAND} -E remove -f src/dict_unit.c
297 COMMAND ${CMAKE_COMMAND} -E remove -f src/dynar_unit.c
298 COMMAND ${CMAKE_COMMAND} -E remove -f src/ex_unit.c
299 COMMAND ${CMAKE_COMMAND} -E remove -f src/set_unit.c
300 COMMAND ${CMAKE_COMMAND} -E remove -f src/simgrid_units_main.c
301 COMMAND ${CMAKE_COMMAND} -E remove -f src/swag_unit.c
302 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_sha_unit.c
303 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_str_unit.c
304 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_strbuff_unit.c
305 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_synchro_unit.c
306 WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}"
309 add_custom_target(supernovae-clean
310 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_gras.c
311 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_sg.c
312 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_smpi.c
313 WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}"
316 #############################################
317 ### Fill in the "make sync-gforge" target ###
318 #############################################
320 add_custom_target(sync-gforge-doc
321 COMMAND chmod g+rw -R doc/
322 COMMAND chmod a+rX -R doc/
323 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
324 COMMAND scp doc/index.php doc/webcruft/robots.txt scm.gforge.inria.fr:/home/groups/simgrid/htdocs/
325 COMMAND scp doc/html/simgrid_modules2.png doc/html/simgrid_modules.png doc/webcruft/simgrid_logo.png doc/webcruft/fish.gif doc/webcruft/simgrid_logo_small.png scm.gforge.inria.fr:/home/groups/simgrid/htdocs/
326 WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}"
328 add_custom_target(sync-gforge-dtd
329 COMMAND scp src/surf/simgrid.dtd scm.gforge.inria.fr:/home/groups/simgrid/htdocs/
330 WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}"