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)
81 foreach(file ${install_HEADERS})
82 get_filename_component(location ${file} PATH)
83 string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/" "" location "${location}")
85 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${location})
86 endforeach(file ${install_HEADERS})
89 foreach(file ${examples_to_install_in_doc})
90 string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/examples/" "" file ${file})
91 get_filename_component(location ${file} PATH)
92 install(FILES "examples/${file}"
93 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/doc/simgrid/examples/${location})
94 endforeach(file ${examples_to_install_in_doc})
99 file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/lib/lua/5.1")
100 add_custom_target(simgrid_lua ALL
102 ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
105 OUTPUT ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
106 COMMAND ${CMAKE_COMMAND} -E create_symlink ../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
108 install(FILES ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
109 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/lua/5.1
113 ###########################################
114 ### Fill in the "make uninstall" target ###
115 ###########################################
117 add_custom_target(uninstall
118 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/doc/simgrid
119 COMMAND ${CMAKE_COMMAND} -E echo "uninstall doc ok"
120 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/libgras*
121 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/libsimgrid*
122 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/libsmpi*
123 COMMAND ${CMAKE_COMMAND} -E echo "uninstall lib ok"
124 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpicc
125 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpif2c
126 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpiff
127 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpirun
128 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/tesh
129 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/simgrid-colorizer
130 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/simgrid_update_xml
131 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/gras_stub_generator
132 COMMAND ${CMAKE_COMMAND} -E echo "uninstall bin ok"
133 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/amok
134 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/gras
135 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/instr
136 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/msg
137 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/simdag
138 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/smpi
139 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/surf
140 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/xbt
141 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/mc
142 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/include/simgrid_config.h
143 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/include/gras.h
144 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/include/xbt.h
145 COMMAND ${CMAKE_COMMAND} -E echo "uninstall include ok"
146 WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
150 add_custom_command(TARGET uninstall
151 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding lua ok"
152 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/lua/5.1/simgrid.${LIB_EXE}
153 WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}/"
157 ################################################################
158 ## Build a sain "make dist" target to build a source package ###
159 ## containing only the files that I explicitely state ###
160 ## (instead of any cruft laying on my disk as CPack does) ###
161 ################################################################
163 ##########################################
164 ### Fill in the "make dist-dir" target ###
165 ##########################################
167 add_custom_target(dist-dir
168 COMMENT "Generating the distribution directory"
169 COMMAND test -e simgrid-${release_version}/ && chmod -R a+w simgrid-${release_version}/ || true
170 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/
171 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}
172 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/doc/html/
173 COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_HOME_DIRECTORY}/doc/html/ simgrid-${release_version}/doc/html/
175 add_dependencies(dist-dir simgrid_documentation)
177 set(dirs_in_tarball "")
178 foreach(file ${source_to_pack})
180 # This damn prefix is still set somewhere (seems to be in subdirs)
181 string(REPLACE "${CMAKE_HOME_DIRECTORY}/" "" file "${file}")
183 # Create the directory on need
184 get_filename_component(file_location ${file} PATH)
185 string(REGEX MATCH ";${file_location};" OPERATION "${dirs_in_tarball}")
187 set(dirs_in_tarball "${dirs_in_tarball};${file_location};")
190 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/${file_location}/
194 # Actually copy the file
197 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/${file} simgrid-${release_version}/${file_location}/
202 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/Makefile.default simgrid-${release_version}/Makefile
204 endforeach(file ${source_to_pack})
206 ######################################
207 ### Fill in the "make dist" target ###
208 ######################################
210 add_custom_target(dist
211 DEPENDS ${CMAKE_BINARY_DIR}/simgrid-${release_version}.tar.gz
214 OUTPUT ${CMAKE_BINARY_DIR}/simgrid-${release_version}.tar.gz
215 COMMENT "Compressing the archive from the distribution directory"
216 COMMAND ${CMAKE_COMMAND} -E tar cf simgrid-${release_version}.tar simgrid-${release_version}/
217 COMMAND gzip -9v simgrid-${release_version}.tar
218 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/
220 add_dependencies(dist dist-dir)
222 ###########################################
223 ### Fill in the "make distcheck" target ###
224 ###########################################
226 # Allow to test the "make dist"
227 add_custom_target(distcheck
228 COMMAND ${CMAKE_COMMAND} -E echo "XXX remove old copy"
229 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}.cpy
230 COMMAND ${CMAKE_COMMAND} -E echo "XXX copy again the source tree"
231 COMMAND ${CMAKE_COMMAND} -E copy_directory simgrid-${release_version}/ simgrid-${release_version}.cpy
232 COMMAND ${CMAKE_COMMAND} -E echo "XXX create build and install subtrees"
233 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_build
234 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_inst
236 # This stupid cmake creates a directory in source, killing the purpose of the chmod
238 COMMAND ${CMAKE_COMMAND} -E echo "XXX change the modes of directories"
239 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/CMakeFiles
240 COMMAND chmod -R a-w simgrid-${release_version}/ # FIXME: we should pass without commenting that line
241 COMMAND chmod -R a+w simgrid-${release_version}/_build
242 COMMAND chmod -R a+w simgrid-${release_version}/_inst
243 COMMAND chmod -R a+w simgrid-${release_version}/CMakeFiles
245 COMMAND ${CMAKE_COMMAND} -E echo "XXX Configure"
246 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ${CMAKE_COMMAND} build .. -DCMAKE_INSTALL_PREFIX=../_inst -Wno-dev -Denable_doc=OFF
247 # COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make dist-dir
248 COMMAND ${CMAKE_COMMAND} -E echo "XXX Build"
249 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make VERBOSE=1
251 # This fails, unfortunately, because GRAS is broken for now
252 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ctest -j5 --output-on-failure
254 COMMAND ${CMAKE_COMMAND} -E echo "XXX Check that cleaning works"
255 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make clean
256 COMMAND ${CMAKE_COMMAND} -E echo "XXX Display what is remaining after make clean"
257 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ls -lR
258 COMMAND ${CMAKE_COMMAND} -E echo "XXX Remove _build and _inst directories"
259 COMMAND chmod a+w simgrid-${release_version}/
260 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/_build
261 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/_inst
262 COMMAND ${CMAKE_COMMAND} -E echo "XXX The output of the diff follows"
263 COMMAND diff -ruN simgrid-${release_version}.cpy simgrid-${release_version}
264 COMMAND ${CMAKE_COMMAND} -E echo "XXX end of the diff, random cleanups now"
265 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}.cpy
266 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}
268 add_dependencies(distcheck dist-dir)
270 #######################################
271 ### Fill in the "make check" target ###
272 #######################################
275 add_custom_target(check
276 COMMAND ctest -D ExperimentalMemCheck
278 else(enable_memcheck)
279 add_custom_target(check
282 endif(enable_memcheck)
284 #######################################
285 ### Fill in the "make xxx-clean" target ###
286 #######################################
288 add_custom_target(maintainer-clean
289 COMMAND ${CMAKE_COMMAND} -E remove -f src/config_unit.c
290 COMMAND ${CMAKE_COMMAND} -E remove -f src/cunit_unit.c
291 COMMAND ${CMAKE_COMMAND} -E remove -f src/dict_unit.c
292 COMMAND ${CMAKE_COMMAND} -E remove -f src/dynar_unit.c
293 COMMAND ${CMAKE_COMMAND} -E remove -f src/ex_unit.c
294 COMMAND ${CMAKE_COMMAND} -E remove -f src/set_unit.c
295 COMMAND ${CMAKE_COMMAND} -E remove -f src/simgrid_units_main.c
296 COMMAND ${CMAKE_COMMAND} -E remove -f src/swag_unit.c
297 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_sha_unit.c
298 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_str_unit.c
299 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_strbuff_unit.c
300 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_synchro_unit.c
301 WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}"
304 add_custom_target(supernovae-clean
305 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_gras.c
306 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_sg.c
307 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_smpi.c
308 WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}"
311 #############################################
312 ### Fill in the "make sync-gforge" target ###
313 #############################################
315 add_custom_target(sync-gforge-doc
316 COMMAND chmod g+rw -R doc/
317 COMMAND chmod a+rX -R doc/
318 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
319 COMMAND scp doc/index.php doc/webcruft/robots.txt scm.gforge.inria.fr:/home/groups/simgrid/htdocs/
320 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/
321 WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}"
323 add_custom_target(sync-gforge-dtd
324 COMMAND scp src/surf/simgrid.dtd scm.gforge.inria.fr:/home/groups/simgrid/htdocs/
325 WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}"