Logo AND Algorithmique Numérique Distribuée

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