Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
2d690a68c15d26b822b77ac40f953e749f735f06
[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
173 add_custom_command(TARGET install-simgrid
174         COMMAND cp ${PROJECT_DIRECTORY}/doc/html/* $ENV{DESTDIR}${prefix}/doc/simgrid/html/ || true
175         COMMAND echo "install doc/html      OK"
176         WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
177 )
178
179 add_custom_target(html
180 COMMAND echo "Make the html doc"
181 COMMAND echo "cmake -DBIBTEX2HTML=${BIBTEX2HTML} ./"
182 COMMAND cmake -DBIBTEX2HTML=${BIBTEX2HTML} ./
183 COMMAND rm -rf ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/CMakeFiles
184 COMMAND rm -f ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/CMakeCache.txt
185 COMMAND rm -f ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/cmake_install.cmake
186 COMMAND rm -f ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/Makefile
187 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc"
188 )
189
190 add_custom_target(dist
191 COMMAND make package
192 COMMAND rm -rf _CPack_Packages
193 #WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
194 )
195
196 add_custom_target(check
197 COMMAND make test
198 #WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
199 )
200
201 add_custom_target(distcheck
202 COMMAND make package
203 COMMAND rm -rf _CPack_Packages
204 COMMAND tar xvf ${CPACK_PACKAGE_FILE_NAME}.tar.bz2
205 COMMAND cd ${CPACK_PACKAGE_FILE_NAME} && cmake .
206 COMMAND cd ${CPACK_PACKAGE_FILE_NAME} && make
207 COMMAND cd ${CPACK_PACKAGE_FILE_NAME} && make test
208 COMMAND rm -rf ${CPACK_PACKAGE_FILE_NAME}
209 #WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
210 )
211
212 add_custom_target(maintainer-clean
213 COMMAND rm -f src/config_unit.c
214 COMMAND rm -f src/cunit_unit.c
215 COMMAND rm -f src/dict_unit.c
216 COMMAND rm -f src/dynar_unit.c
217 COMMAND rm -f src/ex_unit.c
218 COMMAND rm -f src/set_unit.c
219 COMMAND rm -f src/simgrid_units_main.c
220 COMMAND rm -f src/swag_unit.c
221 COMMAND rm -f src/xbt_sha_unit.c
222 COMMAND rm -f src/xbt_str_unit.c
223 COMMAND rm -f src/xbt_strbuff_unit.c
224 COMMAND rm -f src/xbt_synchro_unit.c
225 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
226 )
227
228 add_custom_target(supernovae-clean
229 COMMAND rm -f src/supernovae_gras.c
230 COMMAND rm -f src/supernovae_sg.c
231 COMMAND rm -f src/supernovae_smpi.c
232 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
233 )
234
235 add_custom_target(doc-clean
236 COMMAND rm -f doc/all_bib.html
237 COMMAND rm -f doc/all_bib.latin1.html
238 COMMAND rm -f doc/all_bib.latin1.html.tmp
239 COMMAND rm -f doc/logcategories.sh
240 COMMAND rm -f doc/publis_core.bib
241 COMMAND rm -f doc/publis_core_bib.html
242 COMMAND rm -f doc/publis_core_bib.latin1.html
243 COMMAND rm -f doc/publis_core_bib.latin1.html.tmp
244 COMMAND rm -f doc/publis_count.html
245 COMMAND rm -f doc/publis_extern.bib
246 COMMAND rm -f doc/publis_extern_bib.html
247 COMMAND rm -f doc/publis_extern_bib.latin1.html
248 COMMAND rm -f doc/publis_extern_bib.latin1.html.tmp
249 COMMAND rm -f doc/publis_intra.bib
250 COMMAND rm -f doc/publis_intra_bib.html
251 COMMAND rm -f doc/publis_intra_bib.latin1.html
252 COMMAND rm -f doc/publis_intra_bib.latin1.html.tmp
253 COMMAND rm -f doc/tmp.realtoc
254 COMMAND rm -f doc/using_bib.html
255 COMMAND rm -f doc/using_bib.latin1.html
256 COMMAND rm -f doc/using_bib.latin1.html.tmp
257 COMMAND rm -f doc/realtoc.sh
258 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
259 )
260
261 add_custom_target(java-clean
262 COMMAND rm -f src/simgrid.jar
263 COMMAND rm -rf src/.classes
264 COMMAND rm -f examples/java/basic/BasicTest.class
265 COMMAND rm -f examples/java/basic/FinalizeTask.class
266 COMMAND rm -f examples/java/basic/Forwarder.class
267 COMMAND rm -f examples/java/basic/Master.class
268 COMMAND rm -f examples/java/basic/Slave.class
269 COMMAND rm -f examples/java/comm_time/CommTimeTest.class
270 COMMAND rm -f examples/java/comm_time/FinalizeTask.class
271 COMMAND rm -f examples/java/comm_time/Master.class
272 COMMAND rm -f examples/java/comm_time/Slave.class
273 COMMAND rm -f examples/java/ping_pong/PingPongTask.class
274 COMMAND rm -f examples/java/ping_pong/PingPongTest.class
275 COMMAND rm -f examples/java/ping_pong/Receiver.class
276 COMMAND rm -f examples/java/ping_pong/Sender.class
277 COMMAND rm -f examples/java/suspend/DreamMaster.class
278 COMMAND rm -f examples/java/suspend/LazyGuy.class
279 COMMAND rm -f examples/java/suspend/SuspendTest.class
280 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
281 )
282
283 add_custom_target(all-clean
284 COMMAND make clean
285 COMMAND make java-clean
286 COMMAND make doc-clean
287 COMMAND make supernovae-clean
288 )
289 if(enable_maintainer_mode)
290         add_custom_command(TARGET all-clean
291         COMMAND make maintainer-clean
292         )
293 endif(enable_maintainer_mode)
294
295 add_custom_target(sync-gforge
296 COMMAND chmod g+rw -R doc/
297 COMMAND chmod a+rX -R doc/
298 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
299 COMMAND scp doc/index.php doc/webcruft/robots.txt scm.gforge.inria.fr:/home/groups/simgrid/htdocs/
300 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/
301 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
302 )
303
304 include(CPack)