Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Cosmetics and remove bindings if there are enabled.
[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 ${prefix}
60 COMMAND mkdir -p ${prefix}/bin
61 COMMAND mkdir -p ${prefix}/lib
62 COMMAND mkdir -p ${prefix}/include
63 COMMAND mkdir -p ${prefix}/doc
64 COMMAND mkdir -p ${prefix}/doc/simgrid
65 COMMAND mkdir -p ${prefix}/doc/simgrid/html
66 COMMAND cp ${install_bins} ${prefix}/bin
67 COMMAND cp ${PROJECT_DIRECTORY}/tools/MSG_visualization/colorize.pl ${prefix}/bin/simgrid_colorizer.pl
68 COMMAND echo "install bin ok"
69 COMMAND cp ${install_libs} ${prefix}/lib
70 COMMAND echo "install lib ok"
71 COMMAND cp --parent ${install_HEADERS} ${prefix}
72 COMMAND echo "install include ok"
73 COMMAND cp -rf ${PROJECT_DIRECTORY}/doc/html/ ${prefix}/doc/simgrid
74 COMMAND echo "install doc ok"
75 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
76 )
77
78 add_custom_target(uninstall
79 COMMAND rm -rf ${prefix}/doc/simgrid
80 COMMAND echo "uninstall doc ok"
81 COMMAND rm ${uninstall_libs}
82 COMMAND echo "uninstall lib ok"
83 COMMAND rm ${uninstall_bins}
84 COMMAND rm ${prefix}/bin/simgrid_colorizer.pl
85 COMMAND echo "uninstall bin ok"
86 COMMAND rm ${uninstall_HEADERS}
87 COMMAND echo "uninstal include ok"
88 COMMAND rm -R ${prefix}/include/amok ${prefix}/include/gras ${prefix}/include/instr ${prefix}/include/msg 
89 COMMAND rm -R ${prefix}/include/simdag ${prefix}/include/smpi ${prefix}/include/surf ${prefix}/include/xbt
90 WORKING_DIRECTORY "${prefix}"
91 )
92
93 if(HAVE_JAVA)
94         add_custom_command(TARGET install-simgrid
95         COMMAND echo "install binding java"
96         COMMAND mkdir --parent ${prefix}/share/
97         COMMAND cp ${PROJECT_DIRECTORY}/src/simgrid.jar ${prefix}/share/simgrid.jar
98         WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
99         )
100         add_custom_command(TARGET uninstall
101         COMMAND rm ${prefix}/share/simgrid.jar
102         COMMAND echo "uninstall binding java"
103         WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
104         )       
105 endif(HAVE_JAVA)
106
107 if(HAVE_LUA)
108         add_custom_command(TARGET install-simgrid
109         COMMAND echo "install binding lua"
110         COMMAND mkdir --parent ${prefix}/lib/lua/5.1/
111         COMMAND ln -sf ${prefix}/lib/libsimgrid.so ${prefix}/lib/lua/5.1/simgrid.so
112         WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
113         )
114         add_custom_command(TARGET uninstall
115         COMMAND echo "uninstall binding lua"
116         COMMAND rm ${prefix}/lib/lua/5.1/simgrid.so     
117         WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
118         )
119 endif(HAVE_LUA)
120
121 if(HAVE_RUBY)
122         add_custom_command(TARGET install-simgrid
123         COMMAND echo "install binding ruby"
124         COMMAND mkdir --parent ${prefix}/lib/site_ruby${install_link_ruby}/
125         COMMAND ln -sf ${prefix}/lib/libsimgrid.so ${prefix}/lib/site_ruby${install_link_ruby}/libsimgrid.so
126         COMMAND cp ${PROJECT_DIRECTORY}/src/bindings/ruby/simgrid.rb ${prefix}/lib/site_ruby${install_link_ruby}/simgrid.rb
127         WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
128         )
129         add_custom_command(TARGET uninstall
130         COMMAND echo "uninstall binding ruby"
131         COMMAND rm ${prefix}/lib/site_ruby${install_link_ruby}/libsimgrid.so
132         COMMAND rm ${prefix}/lib/site_ruby${install_link_ruby}/simgrid.rb
133         WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
134         )
135 endif(HAVE_RUBY)
136
137 add_custom_target(html
138 COMMAND echo "Make the html doc"
139 COMMAND echo "cmake -DBIBTEX2HTML=${BIBTEX2HTML} ./"
140 COMMAND cmake -DBIBTEX2HTML=${BIBTEX2HTML} ./
141 COMMAND rm -rf ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/CMakeFiles
142 COMMAND rm ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/CMakeCache.txt
143 COMMAND rm ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/cmake_install.cmake
144 COMMAND rm ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/Makefile
145 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc"
146 )
147
148 add_custom_target(dist
149 COMMAND make package
150 COMMAND rm -rf ${PROJECT_DIRECTORY}/_CPack_Packages
151 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
152 )
153 add_custom_target(distcheck
154 COMMAND make package
155 COMMAND rm -rf ${PROJECT_DIRECTORY}/_CPack_Packages
156 COMMAND tar xvf ${CPACK_PACKAGE_FILE_NAME}.tar.bz2
157 COMMAND cd ${PROJECT_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} && cmake .
158 COMMAND cd ${PROJECT_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} && make
159 COMMAND cd ${PROJECT_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} && make test
160 COMMAND rm -rf ${PROJECT_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}
161 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
162 )
163
164 add_custom_target(maintainer-clean
165 COMMAND rm -f src/config_unit.c
166 COMMAND rm -f src/cunit_unit.c
167 COMMAND rm -f src/dict_unit.c
168 COMMAND rm -f src/dynar_unit.c
169 COMMAND rm -f src/ex_unit.c
170 COMMAND rm -f src/set_unit.c
171 COMMAND rm -f src/simgrid_units_main.c
172 COMMAND rm -f src/swag_unit.c
173 COMMAND rm -f src/xbt_sha_unit.c
174 COMMAND rm -f src/xbt_str_unit.c
175 COMMAND rm -f src/xbt_strbuff_unit.c
176 COMMAND rm -f src/xbt_synchro_unit.c
177 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
178 )
179
180 add_custom_target(supernovae-clean
181 COMMAND rm -f src/supernovae_gras.c
182 COMMAND rm -f src/supernovae_sg.c
183 COMMAND rm -f src/supernovae_smpi.c
184 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
185 )
186
187 add_custom_target(doc-clean
188 COMMAND rm -f doc/all_bib.html
189 COMMAND rm -f doc/all_bib.latin1.html
190 COMMAND rm -f doc/all_bib.latin1.html.tmp
191 COMMAND rm -f doc/logcategories.sh
192 COMMAND rm -f doc/publis_core.bib
193 COMMAND rm -f doc/publis_core_bib.html
194 COMMAND rm -f doc/publis_core_bib.latin1.html
195 COMMAND rm -f doc/publis_core_bib.latin1.html.tmp
196 COMMAND rm -f doc/publis_count.html
197 COMMAND rm -f doc/publis_extern.bib
198 COMMAND rm -f doc/publis_extern_bib.html
199 COMMAND rm -f doc/publis_extern_bib.latin1.html
200 COMMAND rm -f doc/publis_extern_bib.latin1.html.tmp
201 COMMAND rm -f doc/publis_intra.bib
202 COMMAND rm -f doc/publis_intra_bib.html
203 COMMAND rm -f doc/publis_intra_bib.latin1.html
204 COMMAND rm -f doc/publis_intra_bib.latin1.html.tmp
205 COMMAND rm -f doc/tmp.realtoc
206 COMMAND rm -f doc/using_bib.html
207 COMMAND rm -f doc/using_bib.latin1.html
208 COMMAND rm -f doc/using_bib.latin1.html.tmp
209 COMMAND rm -f doc/realtoc.sh
210 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
211 )
212
213 add_custom_target(java-clean
214 COMMAND rm -f src/simgrid.jar
215 COMMAND rm -rf src/.classes
216 COMMAND rm -f examples/java/basic/BasicTest.class
217 COMMAND rm -f examples/java/basic/FinalizeTask.class
218 COMMAND rm -f examples/java/basic/Forwarder.class
219 COMMAND rm -f examples/java/basic/Master.class
220 COMMAND rm -f examples/java/basic/Slave.class
221 COMMAND rm -f examples/java/comm_time/CommTimeTest.class
222 COMMAND rm -f examples/java/comm_time/FinalizeTask.class
223 COMMAND rm -f examples/java/comm_time/Master.class
224 COMMAND rm -f examples/java/comm_time/Slave.class
225 COMMAND rm -f examples/java/ping_pong/PingPongTask.class
226 COMMAND rm -f examples/java/ping_pong/PingPongTest.class
227 COMMAND rm -f examples/java/ping_pong/Receiver.class
228 COMMAND rm -f examples/java/ping_pong/Sender.class
229 COMMAND rm -f examples/java/suspend/DreamMaster.class
230 COMMAND rm -f examples/java/suspend/LazyGuy.class
231 COMMAND rm -f examples/java/suspend/SuspendTest.class
232 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
233 )
234
235 add_custom_target(all-clean
236 COMMAND make clean
237 COMMAND make java-clean
238 COMMAND make doc-clean
239 COMMAND make supernovae-clean
240 COMMAND make maintainer-clean
241 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
242 )
243 include(CPack)