Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Correct command for examples in the install command.
[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/html      OK"
75 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
76 )
77
78 foreach(file ${ex_to_svg})
79         string(REPLACE "${PROJECT_DIRECTORY}" "." file "${file}")
80         add_custom_command(TARGET install-simgrid
81                 COMMAND cp --parents -f ${file} $ENV{DESTDIR}${prefix}/doc/simgrid/
82                 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
83         )
84 endforeach(file ${ex_to_svg})
85 add_custom_command(TARGET install-simgrid
86         COMMAND echo "install doc/examples  OK"
87         WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
88 )
89
90 add_custom_target(uninstall
91 COMMAND rm -rf ${prefix}/doc/simgrid
92 COMMAND echo "uninstall doc ok"
93 COMMAND rm ${uninstall_libs}
94 COMMAND echo "uninstall lib ok"
95 COMMAND rm ${uninstall_bins}
96 COMMAND rm ${prefix}/bin/simgrid_colorizer.pl
97 COMMAND echo "uninstall bin ok"
98 COMMAND rm ${uninstall_HEADERS}
99 COMMAND echo "uninstal include ok"
100 COMMAND rm -R ${prefix}/include/amok ${prefix}/include/gras ${prefix}/include/instr ${prefix}/include/msg 
101 COMMAND rm -R ${prefix}/include/simdag ${prefix}/include/smpi ${prefix}/include/surf ${prefix}/include/xbt
102 WORKING_DIRECTORY "${prefix}"
103 )
104
105 if(HAVE_JAVA)
106         add_custom_command(TARGET install-simgrid
107         COMMAND echo "install binding java  OK"
108         COMMAND mkdir --parent $ENV{DESTDIR}${prefix}/share/
109         COMMAND cp ${PROJECT_DIRECTORY}/src/simgrid.jar $ENV{DESTDIR}${prefix}/share/simgrid.jar
110         WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
111         )
112         add_custom_command(TARGET uninstall
113         COMMAND rm ${prefix}/share/simgrid.jar
114         COMMAND echo "uninstall binding java"
115         WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
116         )       
117 endif(HAVE_JAVA)
118
119 if(HAVE_LUA)
120         add_custom_command(TARGET install-simgrid
121         COMMAND echo "install binding lua   OK"
122         COMMAND mkdir --parent $ENV{DESTDIR}${prefix}/lib/lua/5.1/
123         COMMAND ln -sf ${prefix}/lib/libsimgrid.so $ENV{DESTDIR}${prefix}/lib/lua/5.1/simgrid.so
124         WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
125         )
126         add_custom_command(TARGET uninstall
127         COMMAND echo "uninstall binding lua"
128         COMMAND rm ${prefix}/lib/lua/5.1/simgrid.so     
129         WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
130         )
131 endif(HAVE_LUA)
132
133 if(HAVE_RUBY)
134         add_custom_command(TARGET install-simgrid
135         COMMAND echo "install binding ruby  OK"
136         COMMAND mkdir --parent $ENV{DESTDIR}${prefix}/lib/ruby${install_link_ruby}/
137         COMMAND ln -sf ${prefix}/lib/libsimgrid.so $ENV{DESTDIR}${prefix}/lib/ruby${install_link_ruby}/libsimgrid.so
138         COMMAND cp ${PROJECT_DIRECTORY}/src/bindings/ruby/simgrid.rb $ENV{DESTDIR}${prefix}/lib/ruby${install_link_ruby}/simgrid.rb
139         WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
140         )
141         add_custom_command(TARGET uninstall
142         COMMAND echo "uninstall binding ruby"
143         COMMAND rm ${prefix}/lib/ruby${install_link_ruby}/libsimgrid.so
144         COMMAND rm ${prefix}/lib/ruby${install_link_ruby}/simgrid.rb
145         WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
146         )
147 endif(HAVE_RUBY)
148
149 add_custom_target(html
150 COMMAND echo "Make the html doc"
151 COMMAND echo "cmake -DBIBTEX2HTML=${BIBTEX2HTML} ./"
152 COMMAND cmake -DBIBTEX2HTML=${BIBTEX2HTML} ./
153 COMMAND rm -rf ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/CMakeFiles
154 COMMAND rm ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/CMakeCache.txt
155 COMMAND rm ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/cmake_install.cmake
156 COMMAND rm ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/Makefile
157 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc"
158 )
159
160 add_custom_target(dist
161 COMMAND make package
162 COMMAND rm -rf _CPack_Packages
163 #WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
164 )
165 add_custom_target(distcheck
166 COMMAND make package
167 COMMAND rm -rf _CPack_Packages
168 COMMAND tar xvf ${CPACK_PACKAGE_FILE_NAME}.tar.bz2
169 COMMAND cd ${CPACK_PACKAGE_FILE_NAME} && cmake .
170 COMMAND cd ${CPACK_PACKAGE_FILE_NAME} && make
171 COMMAND cd ${CPACK_PACKAGE_FILE_NAME} && make test
172 COMMAND rm -rf ${CPACK_PACKAGE_FILE_NAME}
173 #WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
174 )
175
176 add_custom_target(maintainer-clean
177 COMMAND rm -f src/config_unit.c
178 COMMAND rm -f src/cunit_unit.c
179 COMMAND rm -f src/dict_unit.c
180 COMMAND rm -f src/dynar_unit.c
181 COMMAND rm -f src/ex_unit.c
182 COMMAND rm -f src/set_unit.c
183 COMMAND rm -f src/simgrid_units_main.c
184 COMMAND rm -f src/swag_unit.c
185 COMMAND rm -f src/xbt_sha_unit.c
186 COMMAND rm -f src/xbt_str_unit.c
187 COMMAND rm -f src/xbt_strbuff_unit.c
188 COMMAND rm -f src/xbt_synchro_unit.c
189 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
190 )
191
192 add_custom_target(supernovae-clean
193 COMMAND rm -f src/supernovae_gras.c
194 COMMAND rm -f src/supernovae_sg.c
195 COMMAND rm -f src/supernovae_smpi.c
196 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
197 )
198
199 add_custom_target(doc-clean
200 COMMAND rm -f doc/all_bib.html
201 COMMAND rm -f doc/all_bib.latin1.html
202 COMMAND rm -f doc/all_bib.latin1.html.tmp
203 COMMAND rm -f doc/logcategories.sh
204 COMMAND rm -f doc/publis_core.bib
205 COMMAND rm -f doc/publis_core_bib.html
206 COMMAND rm -f doc/publis_core_bib.latin1.html
207 COMMAND rm -f doc/publis_core_bib.latin1.html.tmp
208 COMMAND rm -f doc/publis_count.html
209 COMMAND rm -f doc/publis_extern.bib
210 COMMAND rm -f doc/publis_extern_bib.html
211 COMMAND rm -f doc/publis_extern_bib.latin1.html
212 COMMAND rm -f doc/publis_extern_bib.latin1.html.tmp
213 COMMAND rm -f doc/publis_intra.bib
214 COMMAND rm -f doc/publis_intra_bib.html
215 COMMAND rm -f doc/publis_intra_bib.latin1.html
216 COMMAND rm -f doc/publis_intra_bib.latin1.html.tmp
217 COMMAND rm -f doc/tmp.realtoc
218 COMMAND rm -f doc/using_bib.html
219 COMMAND rm -f doc/using_bib.latin1.html
220 COMMAND rm -f doc/using_bib.latin1.html.tmp
221 COMMAND rm -f doc/realtoc.sh
222 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
223 )
224
225 add_custom_target(java-clean
226 COMMAND rm -f src/simgrid.jar
227 COMMAND rm -rf src/.classes
228 COMMAND rm -f examples/java/basic/BasicTest.class
229 COMMAND rm -f examples/java/basic/FinalizeTask.class
230 COMMAND rm -f examples/java/basic/Forwarder.class
231 COMMAND rm -f examples/java/basic/Master.class
232 COMMAND rm -f examples/java/basic/Slave.class
233 COMMAND rm -f examples/java/comm_time/CommTimeTest.class
234 COMMAND rm -f examples/java/comm_time/FinalizeTask.class
235 COMMAND rm -f examples/java/comm_time/Master.class
236 COMMAND rm -f examples/java/comm_time/Slave.class
237 COMMAND rm -f examples/java/ping_pong/PingPongTask.class
238 COMMAND rm -f examples/java/ping_pong/PingPongTest.class
239 COMMAND rm -f examples/java/ping_pong/Receiver.class
240 COMMAND rm -f examples/java/ping_pong/Sender.class
241 COMMAND rm -f examples/java/suspend/DreamMaster.class
242 COMMAND rm -f examples/java/suspend/LazyGuy.class
243 COMMAND rm -f examples/java/suspend/SuspendTest.class
244 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
245 )
246
247 add_custom_target(all-clean
248 COMMAND make clean
249 COMMAND make java-clean
250 COMMAND make doc-clean
251 COMMAND make supernovae-clean
252 COMMAND make maintainer-clean
253 )
254
255 add_custom_target(sync-gforge
256 COMMAND chmod g+rw -R doc/
257 COMMAND chmod a+rX -R doc/
258 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
259 COMMAND scp doc/index.php doc/webcruft/robots.txt scm.gforge.inria.fr:/home/groups/simgrid/htdocs/
260 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/
261 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
262 )
263
264 include(CPack)