Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Delete error in windows.
[simgrid.git] / buildtools / Cmake / src / CMakeDistrib.txt
1 set(CMAKE_INSTALL_PREFIX ${prefix} CACHE TYPE INTERNAL FORCE)
2
3 #########################################
4 ### Fill in the "make install" target ###
5 #########################################
6           
7 # doc
8 if(EXISTS ${PROJECT_DIRECTORY}/doc/html/)
9         install(DIRECTORY "${PROJECT_DIRECTORY}/doc/html/"
10           DESTINATION "$ENV{DESTDIR}${prefix}/doc/simgrid/html/"
11           PATTERN ".svn" EXCLUDE 
12           PATTERN ".git" EXCLUDE 
13           PATTERN "*.o" EXCLUDE
14           PATTERN "*~" EXCLUDE
15         )
16 endif(EXISTS ${PROJECT_DIRECTORY}/doc/html/)
17
18 # binaries
19 install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/smpicc
20                  ${CMAKE_BINARY_DIR}/bin/smpirun
21                  ${CMAKE_BINARY_DIR}/bin/tesh
22                 DESTINATION $ENV{DESTDIR}${prefix}/bin/)
23         
24 install(PROGRAMS tools/MSG_visualization/colorize.pl
25         DESTINATION $ENV{DESTDIR}${prefix}/bin/
26                 RENAME simgrid-colorizer)
27
28 # libraries
29 install(TARGETS simgrid gras 
30         DESTINATION $ENV{DESTDIR}${prefix}/lib/)
31         
32 install(FILES ${CMAKE_BINARY_DIR}/lib/libsimgrid_static.a 
33         RENAME libsimgrid.a
34         DESTINATION $ENV{DESTDIR}${prefix}/lib/)
35         
36 if(enable_smpi) 
37   install(TARGETS smpi
38           DESTINATION $ENV{DESTDIR}${prefix}/lib/)
39 endif(enable_smpi)      
40
41 # include files
42 foreach(file ${install_HEADERS})
43   get_filename_component(location ${file} PATH)
44   install(FILES ${file}
45           DESTINATION $ENV{DESTDIR}${prefix}/${location})
46 endforeach(file ${install_HEADERS})
47
48 # example files
49 foreach(file ${examples_to_install_in_doc})
50   string(REPLACE "${PROJECT_DIRECTORY}/examples/" "" file ${file})
51   get_filename_component(location ${file} PATH)
52   install(FILES "examples/${file}"
53           DESTINATION $ENV{DESTDIR}${prefix}/doc/simgrid/examples/${location})
54 endforeach(file ${examples_to_install_in_doc})
55
56 # bindings cruft
57 if(HAVE_JAVA)
58   install(FILES ${CMAKE_BINARY_DIR}/simgrid.jar
59           DESTINATION $ENV{DESTDIR}${prefix}/share/)
60 endif(HAVE_JAVA)
61
62 if(HAVE_LUA)
63   add_custom_target(absolute_liblink ALL
64     COMMAND ${CMAKE_COMMAND} -E create_symlink $ENV{DESTDIR}${prefix}/lib/libsimgrid.so ${CMAKE_BINARY_DIR}/libsimgrid.so)
65   install(FILES ${CMAKE_BINARY_DIR}/libsimgrid.so
66           DESTINATION $ENV{DESTDIR}${prefix}/lib/lua/5.1
67           RENAME simgrid.so)
68 endif(HAVE_LUA)
69
70 if(HAVE_RUBY)
71   string(REGEX REPLACE "^.*ruby/" "" install_link_ruby "${RUBY_ARCH_DIR}")
72   install(FILES ${CMAKE_BINARY_DIR}/libsimgrid.so
73                 ${PROJECT_DIRECTORY}/src/bindings/ruby/simgrid.rb
74           DESTINATION $ENV{DESTDIR}${prefix}/lib/ruby/${install_link_ruby}/)
75 endif(HAVE_RUBY)
76
77 ###########################################
78 ### Fill in the "make uninstall" target ###
79 ###########################################
80
81 add_custom_target(uninstall
82 COMMAND ${CMAKE_COMMAND} -E     remove_directory ${prefix}/doc/simgrid
83 COMMAND ${CMAKE_COMMAND} -E     echo "uninstall doc ok"
84 COMMAND ${CMAKE_COMMAND} -E     remove -f ${uninstall_libs}
85 COMMAND ${CMAKE_COMMAND} -E     echo "uninstall lib ok"
86 COMMAND ${CMAKE_COMMAND} -E     remove -f ${uninstall_bins}
87 COMMAND ${CMAKE_COMMAND} -E     remove -f ${prefix}/bin/simgrid_colorizer.pl
88 COMMAND ${CMAKE_COMMAND} -E     echo "uninstall bin ok"
89 COMMAND ${CMAKE_COMMAND} -E     remove -f ${uninstall_HEADERS}
90 COMMAND ${CMAKE_COMMAND} -E     echo "uninstal include ok"
91 COMMAND ${CMAKE_COMMAND} -E     remove_directory ${prefix}/include/amok
92 COMMAND ${CMAKE_COMMAND} -E     remove_directory ${prefix}/include/gras
93 COMMAND ${CMAKE_COMMAND} -E     remove_directory ${prefix}/include/instr
94 COMMAND ${CMAKE_COMMAND} -E     remove_directory ${prefix}/include/msg 
95 COMMAND ${CMAKE_COMMAND} -E     remove_directory ${prefix}/include/simdag
96 COMMAND ${CMAKE_COMMAND} -E     remove_directory ${prefix}/include/smpi
97 COMMAND ${CMAKE_COMMAND} -E     remove_directory ${prefix}/include/surf
98 COMMAND ${CMAKE_COMMAND} -E     remove_directory ${prefix}/include/xbt
99 WORKING_DIRECTORY "${prefix}"
100 )
101
102 if(HAVE_JAVA)
103         add_custom_command(TARGET uninstall
104         COMMAND ${CMAKE_COMMAND} -E     remove -f ${prefix}/share/simgrid.jar
105         COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding java"
106         WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
107         )       
108 endif(HAVE_JAVA)
109
110 if(HAVE_LUA)
111         add_custom_command(TARGET uninstall
112         COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding lua"
113         COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/lua/5.1/simgrid.so  
114         WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
115         )
116 endif(HAVE_LUA)
117
118 if(HAVE_RUBY)
119         string(REGEX REPLACE "^.*ruby/" "" install_link_ruby "${RUBY_ARCH_DIR}")
120         add_custom_command(TARGET uninstall
121         COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding ruby"
122         COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/ruby/${install_link_ruby}/libsimgrid.so
123         COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/ruby/${install_link_ruby}/simgrid.rb
124         WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
125         )
126 endif(HAVE_RUBY)
127
128 ######################################
129 ### Fill in the "make html" target ###
130 ######################################
131
132 add_custom_target(html
133 COMMAND ${CMAKE_COMMAND} -E echo "Make the html doc"
134 COMMAND ${CMAKE_COMMAND} -E echo "cmake -DBIBTEX2HTML=${BIBTEX2HTML} ./"
135 COMMAND ${CMAKE_COMMAND} -DBIBTEX2HTML=${BIBTEX2HTML} ./
136 COMMAND ${CMAKE_COMMAND} -E remove_directory ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/CMakeFiles
137 COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/CMakeCache.txt
138 COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/cmake_install.cmake
139 COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/Makefile
140 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc"
141 )
142
143 ################################################################
144 ## Build a sain "make dist" target to build a source package ###
145 ##   containing only the files that I explicitely state      ###
146 ##   (instead of any cruft laying on my disk as CPack does)  ###
147 ################################################################
148
149 ##########################################
150 ### Fill in the "make dist-dir" target ###
151 ##########################################
152
153 add_custom_target(dist-dir
154   COMMAND test -e simgrid-${release_version}/ && chmod -R a+w simgrid-${release_version}/ || true
155   COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}
156   COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}
157 )
158
159 set(dirs_in_tarball "")
160 foreach(file ${source_to_pack} ${txt_files})
161   # This damn prefix is still set somewhere (seems to be in subdirs)
162   string(REPLACE "${PROJECT_DIRECTORY}/" "" file ${file})
163   
164   # Create the directory on need
165   get_filename_component(file_location ${file} PATH)
166   string(REGEX MATCH ";${file_location};" OPERATION "${dirs_in_tarball}")
167   if(NOT OPERATION)
168        set(dirs_in_tarball "${dirs_in_tarball};${file_location};")
169        add_custom_command(
170          TARGET dist-dir
171          COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/${file_location}/
172        )       
173    endif(NOT OPERATION)
174    
175    # Actually copy the file
176    add_custom_command(
177      TARGET dist-dir
178      COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_DIRECTORY}/${file} simgrid-${release_version}/${file_location}/
179    )
180 endforeach(file ${source_to_pack})
181
182 ######################################
183 ### Fill in the "make dist" target ###
184 ######################################
185
186 add_custom_target(dist
187   COMMAND ${CMAKE_COMMAND} -E tar cf simgrid-${release_version}.tar simgrid-${release_version}/
188   COMMAND gzip -9v simgrid-${release_version}.tar
189   COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}
190 )
191 add_dependencies(dist dist-dir)
192
193 ###########################################
194 ### Fill in the "make distcheck" target ###
195 ###########################################
196
197 # Allow to test the "make dist"
198 add_custom_target(distcheck
199   COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_build
200   COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/_inst
201   
202   # This stupid cmake creates a directory in source, killing the purpose of the chmod
203   # (tricking around)
204   COMMAND ${CMAKE_COMMAND} -E make_directory simgrid-${release_version}/CMakeFiles 
205 #  COMMAND chmod -R a-w simgrid-${release_version}/ # FIXME: we should pass without commenting that line
206   COMMAND chmod -R a+w simgrid-${release_version}/_build
207   COMMAND chmod -R a+w simgrid-${release_version}/_inst
208   COMMAND chmod -R a+w simgrid-${release_version}/CMakeFiles
209   
210   COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build ${CMAKE_COMMAND} build ..  -Dprefix=../_inst
211 #  COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make dist-dir
212   COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make -j5 || ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make
213   COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make test -j5
214   COMMAND ${CMAKE_COMMAND} -E chdir simgrid-${release_version}/_build make clean
215 #  COMMAND ${CMAKE_COMMAND} -E remove_directory simgrid-${release_version}/
216 )
217 add_dependencies(distcheck dist-dir)
218
219 #######################################
220 ### Fill in the "make check" target ###
221 #######################################
222
223 add_custom_target(check
224 COMMAND make test
225 #WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
226 )
227
228 #######################################
229 ### Fill in the "make all-clean" target ###
230 #######################################
231
232 add_custom_target(maintainer-clean
233 COMMAND ${CMAKE_COMMAND} -E remove -f src/config_unit.c
234 COMMAND ${CMAKE_COMMAND} -E remove -f src/cunit_unit.c
235 COMMAND ${CMAKE_COMMAND} -E remove -f src/dict_unit.c
236 COMMAND ${CMAKE_COMMAND} -E remove -f src/dynar_unit.c
237 COMMAND ${CMAKE_COMMAND} -E remove -f src/ex_unit.c
238 COMMAND ${CMAKE_COMMAND} -E remove -f src/set_unit.c
239 COMMAND ${CMAKE_COMMAND} -E remove -f src/simgrid_units_main.c
240 COMMAND ${CMAKE_COMMAND} -E remove -f src/swag_unit.c
241 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_sha_unit.c
242 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_str_unit.c
243 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_strbuff_unit.c
244 COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_synchro_unit.c
245 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
246 )
247
248 add_custom_target(supernovae-clean
249 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_gras.c
250 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_sg.c
251 COMMAND ${CMAKE_COMMAND} -E remove -f src/supernovae_smpi.c
252 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
253 )
254
255 add_custom_target(doc-clean
256 COMMAND ${CMAKE_COMMAND} -E remove -f doc/all_bib.html
257 COMMAND ${CMAKE_COMMAND} -E remove -f doc/all_bib.latin1.html
258 COMMAND ${CMAKE_COMMAND} -E remove -f doc/all_bib.latin1.html.tmp
259 COMMAND ${CMAKE_COMMAND} -E remove -f doc/logcategories.sh
260 COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_core.bib
261 COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_core_bib.html
262 COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_core_bib.latin1.html
263 COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_core_bib.latin1.html.tmp
264 COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_count.html
265 COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_extern.bib
266 COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_extern_bib.html
267 COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_extern_bib.latin1.html
268 COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_extern_bib.latin1.html.tmp
269 COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_intra.bib
270 COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_intra_bib.html
271 COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_intra_bib.latin1.html
272 COMMAND ${CMAKE_COMMAND} -E remove -f doc/publis_intra_bib.latin1.html.tmp
273 COMMAND ${CMAKE_COMMAND} -E remove -f doc/tmp.realtoc
274 COMMAND ${CMAKE_COMMAND} -E remove -f doc/using_bib.html
275 COMMAND ${CMAKE_COMMAND} -E remove -f doc/using_bib.latin1.html
276 COMMAND ${CMAKE_COMMAND} -E remove -f doc/using_bib.latin1.html.tmp
277 COMMAND ${CMAKE_COMMAND} -E remove -f doc/realtoc.sh
278 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
279 )
280
281 add_custom_target(java-clean
282 COMMAND ${CMAKE_COMMAND} -E remove -f src/simgrid.jar
283 COMMAND ${CMAKE_COMMAND} -E remove_directory src/.classes
284 COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/basic/BasicTest.class
285 COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/basic/FinalizeTask.class
286 COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/basic/Forwarder.class
287 COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/basic/Master.class
288 COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/basic/Slave.class
289 COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/comm_time/CommTimeTest.class
290 COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/comm_time/FinalizeTask.class
291 COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/comm_time/Master.class
292 COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/comm_time/Slave.class
293 COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/ping_pong/PingPongTask.class
294 COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/ping_pong/PingPongTest.class
295 COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/ping_pong/Receiver.class
296 COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/ping_pong/Sender.class
297 COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/suspend/DreamMaster.class
298 COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/suspend/LazyGuy.class
299 COMMAND ${CMAKE_COMMAND} -E remove -f examples/java/suspend/SuspendTest.class
300 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
301 )
302
303 add_custom_target(all-clean
304 COMMAND make clean
305 COMMAND make java-clean
306 COMMAND make doc-clean
307 COMMAND make supernovae-clean
308 )
309 if(enable_maintainer_mode)
310         add_custom_command(TARGET all-clean
311         COMMAND make maintainer-clean
312         )
313 endif(enable_maintainer_mode)
314
315 #############################################
316 ### Fill in the "make sync-gforge" target ###
317 #############################################
318
319 add_custom_target(sync-gforge
320 COMMAND chmod g+rw -R doc/
321 COMMAND chmod a+rX -R doc/
322 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
323 COMMAND scp doc/index.php doc/webcruft/robots.txt scm.gforge.inria.fr:/home/groups/simgrid/htdocs/
324 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/
325 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
326 )
327
328 include(CPack)