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 install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/tesh
30 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
33 install(PROGRAMS tools/MSG_visualization/colorize.pl
34 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/
35 RENAME simgrid-colorizer)
38 install(TARGETS simgrid gras
39 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
43 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
46 if(enable_lib_static AND NOT WIN32)
47 install(TARGETS simgrid_static
48 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
50 install(TARGETS smpi_static
51 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
53 endif(enable_lib_static AND NOT WIN32)
56 foreach(file ${install_HEADERS})
57 get_filename_component(location ${file} PATH)
58 string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/" "" location "${location}")
60 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${location})
61 endforeach(file ${install_HEADERS})
64 foreach(file ${examples_to_install_in_doc})
65 string(REPLACE "${PROJECT_DIRECTORY}/examples/" "" file ${file})
66 get_filename_component(location ${file} PATH)
67 install(FILES "examples/${file}"
68 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/doc/simgrid/examples/${location})
69 endforeach(file ${examples_to_install_in_doc})
73 install(FILES ${CMAKE_BINARY_DIR}/simgrid.jar
74 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/share/)
78 file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/lib/lua/5.1")
79 add_custom_target(simgrid_lua ALL
81 ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
84 OUTPUT ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
85 COMMAND ${CMAKE_COMMAND} -E create_symlink ../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
87 install(FILES ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
88 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/lua/5.1
93 string(REGEX REPLACE "^.*ruby/" "" install_link_ruby "${RUBY_ARCH_DIR}")
94 file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}")
95 add_custom_target(ruby_simgrid ALL
97 ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
100 OUTPUT ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
101 COMMAND ${CMAKE_COMMAND} -E create_symlink ../../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
103 install(FILES ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
104 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/ruby/${install_link_ruby}/
106 install(FILES ${PROJECT_DIRECTORY}/src/bindings/ruby/simgrid.rb
107 DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/ruby/${install_link_ruby}/)
111 ###########################################
112 ### Fill in the "make uninstall" target ###
113 ###########################################
115 add_custom_target(uninstall
116 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/doc/simgrid
117 COMMAND ${CMAKE_COMMAND} -E echo "uninstall doc ok"
118 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/libgras*
119 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/libsimgrid*
120 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/libsmpi*
121 COMMAND ${CMAKE_COMMAND} -E echo "uninstall lib ok"
122 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpicc
123 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpif2c
124 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpiff
125 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpirun
126 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/tesh
127 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/simgrid-colorizer
128 COMMAND ${CMAKE_COMMAND} -E echo "uninstall bin ok"
129 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/amok
130 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/gras
131 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/instr
132 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/msg
133 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/simdag
134 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/smpi
135 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/surf
136 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/xbt
137 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_INSTALL_PREFIX}/include/mc
138 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/include/simgrid_config.h
139 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/include/gras.h
140 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/include/xbt.h
141 COMMAND ${CMAKE_COMMAND} -E echo "uninstal include ok"
142 WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
146 add_custom_command(TARGET uninstall
147 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/share/simgrid.jar
148 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding java ok"
149 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
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 "${PROJECT_DIRECTORY}/"
162 string(REGEX REPLACE "^.*ruby/" "" install_link_ruby "${RUBY_ARCH_DIR}")
163 add_custom_command(TARGET uninstall
164 COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding ruby ok"
165 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
166 COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/ruby/${install_link_ruby}/simgrid.rb
167 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
171 ################################################################
172 ## Build a sain "make dist" target to build a source package ###
173 ## containing only the files that I explicitely state ###
174 ## (instead of any cruft laying on my disk as CPack does) ###
175 ################################################################
177 ##########################################
178 ### Fill in the "make dist-dir" target ###
179 ##########################################
181 add_custom_target(dist-dir
182 COMMAND test -e simgrid-${release_version}/ && chmod -R a+w simgrid-${release_version}/ || true
183 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/
184 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}
185 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/doc/html/
186 COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_DIRECTORY}/doc/html/ simgrid-${release_version}/doc/html/
189 set(dirs_in_tarball "")
190 foreach(file ${source_to_pack})
192 # This damn prefix is still set somewhere (seems to be in subdirs)
193 string(REPLACE "${PROJECT_DIRECTORY}/" "" file "${file}")
195 # Create the directory on need
196 get_filename_component(file_location ${file} PATH)
197 string(REGEX MATCH ";${file_location};" OPERATION "${dirs_in_tarball}")
199 set(dirs_in_tarball "${dirs_in_tarball};${file_location};")
202 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/${file_location}/
206 # Actually copy the file
209 COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_DIRECTORY}/${file} simgrid-${release_version}/${file_location}/
211 endforeach(file ${source_to_pack})
213 ######################################
214 ### Fill in the "make dist" target ###
215 ######################################
217 add_custom_target(dist
218 DEPENDS ${CMAKE_BINARY_DIR}/simgrid-${release_version}.tar.gz
221 OUTPUT ${CMAKE_BINARY_DIR}/simgrid-${release_version}.tar.gz
222 COMMAND ${CMAKE_COMMAND} -E tar cf simgrid-${release_version}.tar simgrid-${release_version}/
223 COMMAND gzip -9v simgrid-${release_version}.tar
224 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/
226 add_dependencies(dist dist-dir)
228 ###########################################
229 ### Fill in the "make distcheck" target ###
230 ###########################################
232 # Allow to test the "make dist"
233 add_custom_target(distcheck
234 COMMAND ${CMAKE_COMMAND} -E echo "XXX remove old copy"
235 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}.cpy
236 COMMAND ${CMAKE_COMMAND} -E echo "XXX copy again the source tree"
237 COMMAND ${CMAKE_COMMAND} -E copy_directory simgrid-${release_version}/ simgrid-${release_version}.cpy
238 COMMAND ${CMAKE_COMMAND} -E echo "XXX create build and install subtrees"
239 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_build
240 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_inst
242 # This stupid cmake creates a directory in source, killing the purpose of the chmod
244 COMMAND ${CMAKE_COMMAND} -E echo "XXX change the modes of directories"
245 COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/CMakeFiles
246 COMMAND chmod -R a-w simgrid-${release_version}/ # FIXME: we should pass without commenting that line
247 COMMAND chmod -R a+w simgrid-${release_version}/_build
248 COMMAND chmod -R a+w simgrid-${release_version}/_inst
249 COMMAND chmod -R a+w simgrid-${release_version}/CMakeFiles
251 COMMAND ${CMAKE_COMMAND} -E echo "XXX Configure"
252 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ${CMAKE_COMMAND} build .. -DCMAKE_INSTALL_PREFIX=../_inst -Wno-dev -Denable_doc=OFF
253 # COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make dist-dir
254 COMMAND ${CMAKE_COMMAND} -E echo "XXX Build"
255 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make VERBOSE=1
257 # This fails, unfortunately, because GRAS is broken for now
258 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ctest -j5 --output-on-failure
260 COMMAND ${CMAKE_COMMAND} -E echo "XXX Check that cleaning works"
261 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make clean
262 COMMAND ${CMAKE_COMMAND} -E echo "XXX Display what is remaining after make clean"
263 COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ls -lR
264 COMMAND ${CMAKE_COMMAND} -E echo "XXX Remove _build and _inst directories"
265 COMMAND chmod a+w simgrid-${release_version}/
266 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/_build
267 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/_inst
268 COMMAND ${CMAKE_COMMAND} -E echo "XXX The output of the diff follows"
269 COMMAND diff -ruN simgrid-${release_version}.cpy simgrid-${release_version}
270 COMMAND ${CMAKE_COMMAND} -E echo "XXX end of the diff, random cleanups now"
271 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}.cpy
272 COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}
274 add_dependencies(distcheck dist-dir)
276 #######################################
277 ### Fill in the "make check" target ###
278 #######################################
281 add_custom_target(check
282 COMMAND ctest -D ExperimentalMemCheck
284 else(enable_memcheck)
285 add_custom_target(check
288 endif(enable_memcheck)
290 #######################################
291 ### Fill in the "make xxx-clean" target ###
292 #######################################
294 add_custom_target(maintainer-clean
295 COMMAND ${CMAKE_COMMAND} -E remove -f src/config_unit.c
296 COMMAND ${CMAKE_COMMAND} -E remove -f src/cunit_unit.c
297 COMMAND ${CMAKE_COMMAND} -E remove -f src/dict_unit.c
298 COMMAND ${CMAKE_COMMAND} -E remove -f src/dynar_unit.c
299 COMMAND ${CMAKE_COMMAND} -E remove -f src/ex_unit.c
300 COMMAND ${CMAKE_COMMAND} -E remove -f src/set_unit.c
301 COMMAND ${CMAKE_COMMAND} -E remove -f src/simgrid_units_main.c
302 COMMAND ${CMAKE_COMMAND} -E remove -f src/swag_unit.c
303 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_sha_unit.c
304 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_str_unit.c
305 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_strbuff_unit.c
306 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_synchro_unit.c
307 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
310 add_custom_target(supernovae-clean
311 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_gras.c
312 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_sg.c
313 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_smpi.c
314 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
317 #############################################
318 ### Fill in the "make sync-gforge" target ###
319 #############################################
321 add_custom_target(sync-gforge
322 COMMAND chmod g+rw -R doc/
323 COMMAND chmod a+rX -R doc/
324 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
325 COMMAND scp doc/index.php doc/webcruft/robots.txt scm.gforge.inria.fr:/home/groups/simgrid/htdocs/
326 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/
327 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"