Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add verification before install doc. Cosmetics.
[simgrid.git] / buildtools / Cmake / src / CMakeDistrib.txt
1 set(CMAKE_PROJECT_NAME "${PROJECT_NAME}")
2 set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
3 set(CPACK_PROJECT_NAME "${PROJECT_NAME}")
4 set(CPACK_PACKAGE_FILE_NAME "simgrid-${release_version}")
5 set(CPACK_GENERATOR "TBZ2;TGZ") #;TGZ;TZ;ZIP
6
7 foreach(file ${script_to_install})
8         get_filename_component(file_location ${file} PATH)
9         string(REPLACE "${PROJECT_DIRECTORY}/" "/" file_location ${file_location})
10         install(FILES ${file} DESTINATION "${file_location}")
11 endforeach(file ${EXTRA_DIST})
12
13 foreach(file ${to_svg})
14         get_filename_component(file_location ${file} PATH)
15         string(REPLACE "${PROJECT_DIRECTORY}/" "/" file_location ${file_location})
16         install(FILES ${file} DESTINATION "${file_location}")
17 endforeach(file ${EXTRA_DIST})
18
19 foreach(file ${TEST_UNITS})
20         install(FILES src/${file} DESTINATION "/src/")
21 endforeach(file ${TEST_UNITS})
22
23 ###copy doc
24 install(DIRECTORY "${PROJECT_DIRECTORY}/doc/"
25 DESTINATION "/doc/"
26 PATTERN ".svn" EXCLUDE 
27 PATTERN ".git" EXCLUDE 
28 PATTERN "*.o" EXCLUDE
29 PATTERN "*~" EXCLUDE
30 )
31
32 ###buildtools 
33 install(DIRECTORY "${PROJECT_DIRECTORY}/buildtools/Cmake/"
34 DESTINATION "/buildtools/Cmake/"
35 PATTERN ".svn" EXCLUDE 
36 PATTERN ".git" EXCLUDE
37 PATTERN "*.o" EXCLUDE
38 PATTERN "*~" EXCLUDE
39 )
40
41 set(CPACK_SET_DESTDIR on)
42 set(CMAKE_INSTALL_PREFIX ${prefix} CACHE TYPE INTERNAL FORCE)
43
44 string(REPLACE ";" "\t" install_libs "${install_libs}")
45 set(uninstall_bins "${install_bins}")
46 string(REPLACE "${PROJECT_DIRECTORY}/src/smpi" "${prefix}/bin" uninstall_bins "${uninstall_bins}")
47 string(REPLACE "${PROJECT_DIRECTORY}/tools/gras" "${prefix}/bin" uninstall_bins "${uninstall_bins}")
48 string(REPLACE "${PROJECT_DIRECTORY}/tools/tesh" "${prefix}/bin" uninstall_bins "${uninstall_bins}")
49 string(REPLACE "${PROJECT_DIRECTORY}/tools/MSG_visualization/colorize.pl" "${prefix}/bin/simgrid-colorizer" uninstall_bins "${uninstall_bins}")
50 string(REPLACE "${PROJECT_DIRECTORY}/src/.libs" "${prefix}/lib" uninstall_libs "${install_libs}")
51 string(REPLACE "./" "${prefix}/" uninstall_HEADERS "${install_HEADERS}")
52
53
54
55 add_custom_target(install-simgrid
56 COMMAND mkdir -p $ENV{DESTDIR}${prefix}
57 COMMAND mkdir -p $ENV{DESTDIR}${prefix}/bin
58 COMMAND mkdir -p $ENV{DESTDIR}${prefix}/lib
59 COMMAND mkdir -p $ENV{DESTDIR}${prefix}/include
60 COMMAND mkdir -p $ENV{DESTDIR}${prefix}/doc
61 COMMAND mkdir -p $ENV{DESTDIR}${prefix}/doc/simgrid
62 COMMAND mkdir -p $ENV{DESTDIR}${prefix}/doc/simgrid/html
63 COMMAND mkdir -p $ENV{DESTDIR}${prefix}/include
64 COMMAND mkdir -p $ENV{DESTDIR}${prefix}/include/xbt
65 COMMAND mkdir -p $ENV{DESTDIR}${prefix}/include/mc
66 COMMAND mkdir -p $ENV{DESTDIR}${prefix}/include/msg
67 COMMAND mkdir -p $ENV{DESTDIR}${prefix}/include/simdag
68 COMMAND mkdir -p $ENV{DESTDIR}${prefix}/include/smpi
69 COMMAND mkdir -p $ENV{DESTDIR}${prefix}/include/surf
70 COMMAND mkdir -p $ENV{DESTDIR}${prefix}/include/gras
71 COMMAND mkdir -p $ENV{DESTDIR}${prefix}/include/amok
72 COMMAND mkdir -p $ENV{DESTDIR}${prefix}/include/instr
73 COMMAND cp ${install_bins} $ENV{DESTDIR}${prefix}/bin
74 COMMAND cp ${PROJECT_DIRECTORY}/tools/MSG_visualization/colorize.pl $ENV{DESTDIR}${prefix}/bin/simgrid-colorizer
75 COMMAND echo "install bin           OK"
76 COMMAND cp ${install_libs} $ENV{DESTDIR}${prefix}/lib
77 COMMAND echo "install lib           OK"
78 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
79 )
80
81 foreach(file ${install_HEADERS})
82         add_custom_command(TARGET install-simgrid
83                 COMMAND cp ${file} $ENV{DESTDIR}${prefix}/${file}
84                 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
85         )
86 endforeach(file ${install_HEADERS})
87 add_custom_command(TARGET install-simgrid
88         COMMAND echo "install include       OK"
89         WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
90 )
91
92 add_custom_target(uninstall
93 COMMAND rm -rf ${prefix}/doc/simgrid
94 COMMAND echo "uninstall doc ok"
95 COMMAND rm -f ${uninstall_libs}
96 COMMAND echo "uninstall lib ok"
97 COMMAND rm -f ${uninstall_bins}
98 COMMAND rm -f ${prefix}/bin/simgrid_colorizer.pl
99 COMMAND echo "uninstall bin ok"
100 COMMAND rm -f ${uninstall_HEADERS}
101 COMMAND echo "uninstal include ok"
102 COMMAND rm -Rf ${prefix}/include/amok ${prefix}/include/gras ${prefix}/include/instr ${prefix}/include/msg 
103 COMMAND rm -Rf ${prefix}/include/simdag ${prefix}/include/smpi ${prefix}/include/surf ${prefix}/include/xbt
104 WORKING_DIRECTORY "${prefix}"
105 )
106
107 if(HAVE_JAVA)
108         add_custom_command(TARGET install-simgrid
109         COMMAND mkdir -p $ENV{DESTDIR}${prefix}/share/
110         COMMAND cp ${PROJECT_DIRECTORY}/src/simgrid.jar $ENV{DESTDIR}${prefix}/share/simgrid.jar
111         COMMAND echo "install binding java  OK"
112         WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
113         )
114         add_custom_command(TARGET uninstall
115         COMMAND rm -f ${prefix}/share/simgrid.jar
116         COMMAND echo "uninstall binding java"
117         WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
118         )       
119 endif(HAVE_JAVA)
120
121 if(HAVE_LUA)
122         add_custom_command(TARGET install-simgrid
123         COMMAND mkdir -p $ENV{DESTDIR}${prefix}/lib/lua/5.1/
124         COMMAND ln -sf ${prefix}/lib/libsimgrid.so $ENV{DESTDIR}${prefix}/lib/lua/5.1/simgrid.so
125         COMMAND echo "install binding lua   OK"
126         WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
127         )
128         add_custom_command(TARGET uninstall
129         COMMAND echo "uninstall binding lua"
130         COMMAND rm -f ${prefix}/lib/lua/5.1/simgrid.so  
131         WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
132         )
133 endif(HAVE_LUA)
134
135 if(HAVE_RUBY)
136         string(REGEX REPLACE "^.*ruby/" "" install_link_ruby "${RUBY_ARCH_DIR}")
137         add_custom_command(TARGET install-simgrid
138         COMMAND mkdir -p "$ENV{DESTDIR}${prefix}/lib/ruby/${install_link_ruby}/"
139         COMMAND ln -sf ${prefix}/lib/libsimgrid.so $ENV{DESTDIR}${prefix}/lib/ruby/${install_link_ruby}/libsimgrid.so
140         COMMAND cp ${PROJECT_DIRECTORY}/src/bindings/ruby/simgrid.rb $ENV{DESTDIR}${prefix}/lib/ruby/${install_link_ruby}/simgrid.rb
141         COMMAND echo "install binding ruby  OK"
142         WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
143         )
144         add_custom_command(TARGET uninstall
145         COMMAND echo "uninstall binding ruby"
146         COMMAND rm -f ${prefix}/lib/ruby/${install_link_ruby}/libsimgrid.so
147         COMMAND rm -f ${prefix}/lib/ruby/${install_link_ruby}/simgrid.rb
148         WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
149         )
150 endif(HAVE_RUBY)
151
152 foreach(file ${directory_to_create})
153         string(REPLACE "${PROJECT_DIRECTORY}" "." file "${file}")
154         add_custom_command(TARGET install-simgrid
155                 COMMAND mkdir -p $ENV{DESTDIR}${prefix}/doc/simgrid/${file}
156                 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
157         )
158 endforeach(file ${directory_to_create})
159
160 foreach(file ${ex_to_svg})
161         string(REPLACE "${PROJECT_DIRECTORY}" "." file "${file}")
162         add_custom_command(TARGET install-simgrid
163                 COMMAND cp ${file} $ENV{DESTDIR}${prefix}/doc/simgrid/${file}
164                 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
165         )
166 endforeach(file ${ex_to_svg})
167
168 add_custom_command(TARGET install-simgrid
169         COMMAND echo "install doc/examples  OK"
170         WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
171 )
172 if(NOT EXISTS ${PROJECT_DIRECTORY}/doc/html/)
173         file(MAKE_DIRECTORY ${PROJECT_DIRECTORY}/doc/html/)
174 endif(NOT EXISTS ${PROJECT_DIRECTORY}/doc/html/)
175
176 add_custom_command(TARGET install-simgrid
177         COMMAND cp ${PROJECT_DIRECTORY}/doc/html/* $ENV{DESTDIR}${prefix}/doc/simgrid/html/
178         COMMAND echo "install doc/html      OK"
179         WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
180 )
181
182 add_custom_target(html
183 COMMAND echo "Make the html doc"
184 COMMAND echo "cmake -DBIBTEX2HTML=${BIBTEX2HTML} ./"
185 COMMAND cmake -DBIBTEX2HTML=${BIBTEX2HTML} ./
186 COMMAND rm -rf ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/CMakeFiles
187 COMMAND rm -f ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/CMakeCache.txt
188 COMMAND rm -f ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/cmake_install.cmake
189 COMMAND rm -f ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/Makefile
190 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc"
191 )
192
193 add_custom_target(dist
194 COMMAND make package
195 COMMAND rm -rf _CPack_Packages
196 #WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
197 )
198
199 add_custom_target(check
200 COMMAND make test
201 #WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
202 )
203
204 add_custom_target(distcheck
205 COMMAND make package
206 COMMAND rm -rf _CPack_Packages
207 COMMAND tar xvf ${CPACK_PACKAGE_FILE_NAME}.tar.bz2
208 COMMAND cd ${CPACK_PACKAGE_FILE_NAME} && cmake .
209 COMMAND cd ${CPACK_PACKAGE_FILE_NAME} && make
210 COMMAND cd ${CPACK_PACKAGE_FILE_NAME} && make test
211 COMMAND rm -rf ${CPACK_PACKAGE_FILE_NAME}
212 #WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
213 )
214
215 add_custom_target(maintainer-clean
216 COMMAND rm -f src/config_unit.c
217 COMMAND rm -f src/cunit_unit.c
218 COMMAND rm -f src/dict_unit.c
219 COMMAND rm -f src/dynar_unit.c
220 COMMAND rm -f src/ex_unit.c
221 COMMAND rm -f src/set_unit.c
222 COMMAND rm -f src/simgrid_units_main.c
223 COMMAND rm -f src/swag_unit.c
224 COMMAND rm -f src/xbt_sha_unit.c
225 COMMAND rm -f src/xbt_str_unit.c
226 COMMAND rm -f src/xbt_strbuff_unit.c
227 COMMAND rm -f src/xbt_synchro_unit.c
228 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
229 )
230
231 add_custom_target(supernovae-clean
232 COMMAND rm -f src/supernovae_gras.c
233 COMMAND rm -f src/supernovae_sg.c
234 COMMAND rm -f src/supernovae_smpi.c
235 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
236 )
237
238 add_custom_target(doc-clean
239 COMMAND rm -f doc/all_bib.html
240 COMMAND rm -f doc/all_bib.latin1.html
241 COMMAND rm -f doc/all_bib.latin1.html.tmp
242 COMMAND rm -f doc/logcategories.sh
243 COMMAND rm -f doc/publis_core.bib
244 COMMAND rm -f doc/publis_core_bib.html
245 COMMAND rm -f doc/publis_core_bib.latin1.html
246 COMMAND rm -f doc/publis_core_bib.latin1.html.tmp
247 COMMAND rm -f doc/publis_count.html
248 COMMAND rm -f doc/publis_extern.bib
249 COMMAND rm -f doc/publis_extern_bib.html
250 COMMAND rm -f doc/publis_extern_bib.latin1.html
251 COMMAND rm -f doc/publis_extern_bib.latin1.html.tmp
252 COMMAND rm -f doc/publis_intra.bib
253 COMMAND rm -f doc/publis_intra_bib.html
254 COMMAND rm -f doc/publis_intra_bib.latin1.html
255 COMMAND rm -f doc/publis_intra_bib.latin1.html.tmp
256 COMMAND rm -f doc/tmp.realtoc
257 COMMAND rm -f doc/using_bib.html
258 COMMAND rm -f doc/using_bib.latin1.html
259 COMMAND rm -f doc/using_bib.latin1.html.tmp
260 COMMAND rm -f doc/realtoc.sh
261 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
262 )
263
264 add_custom_target(java-clean
265 COMMAND rm -f src/simgrid.jar
266 COMMAND rm -rf src/.classes
267 COMMAND rm -f examples/java/basic/BasicTest.class
268 COMMAND rm -f examples/java/basic/FinalizeTask.class
269 COMMAND rm -f examples/java/basic/Forwarder.class
270 COMMAND rm -f examples/java/basic/Master.class
271 COMMAND rm -f examples/java/basic/Slave.class
272 COMMAND rm -f examples/java/comm_time/CommTimeTest.class
273 COMMAND rm -f examples/java/comm_time/FinalizeTask.class
274 COMMAND rm -f examples/java/comm_time/Master.class
275 COMMAND rm -f examples/java/comm_time/Slave.class
276 COMMAND rm -f examples/java/ping_pong/PingPongTask.class
277 COMMAND rm -f examples/java/ping_pong/PingPongTest.class
278 COMMAND rm -f examples/java/ping_pong/Receiver.class
279 COMMAND rm -f examples/java/ping_pong/Sender.class
280 COMMAND rm -f examples/java/suspend/DreamMaster.class
281 COMMAND rm -f examples/java/suspend/LazyGuy.class
282 COMMAND rm -f examples/java/suspend/SuspendTest.class
283 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
284 )
285
286 add_custom_target(all-clean
287 COMMAND make clean
288 COMMAND make java-clean
289 COMMAND make doc-clean
290 COMMAND make supernovae-clean
291 )
292 if(enable_maintainer_mode)
293         add_custom_command(TARGET all-clean
294         COMMAND make maintainer-clean
295         )
296 endif(enable_maintainer_mode)
297
298 add_custom_target(sync-gforge
299 COMMAND chmod g+rw -R doc/
300 COMMAND chmod a+rX -R doc/
301 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
302 COMMAND scp doc/index.php doc/webcruft/robots.txt scm.gforge.inria.fr:/home/groups/simgrid/htdocs/
303 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/
304 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
305 )
306
307 include(CPack)