Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cf416d2ca37842978b63c04220ebcf71235905ea
[simgrid.git] / buildtools / Cmake / src / CMakeDistrib.txt
1 set(simgrid_version "3.3.5")
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 set(to_svg      
10         ${XBT_RL_SRC}
11         ${EXTRA_DIST}
12         ${SMPI_SRC}
13         ${JMSG_C_SRC}
14         ${JMSG_JAVA_SRC}
15         ${GRAS_RL_SRC}
16         ${XBT_SRC}
17         ${GTNETS_SRC}
18         ${SURF_SRC}
19         ${SIMIX_SRC}
20         ${TRACING_SRC}
21         ${MSG_SRC}
22         ${SIMDAG_SRC}
23         ${GRAS_COMMON_SRC}
24         ${GRAS_SG_SRC}
25         ${AMOK_SRC}
26         ${LUA_SRC}
27         ${RUBY_SRC}
28         ${add_src_files}
29         ${include_files}
30         ${xml_files}
31         ${tesh_files}
32         ${txt_files}
33         ${PROJECT_DIRECTORY}/./CMakeLists.txt
34         ${PROJECT_DIRECTORY}/./AUTHORS
35         ${PROJECT_DIRECTORY}/./ChangeLog
36         ${PROJECT_DIRECTORY}/./COPYING
37         ${PROJECT_DIRECTORY}/./missing
38         ${PROJECT_DIRECTORY}/./NEWS
39         ${PROJECT_DIRECTORY}/./README
40         ${PROJECT_DIRECTORY}/./README.IEEE
41         ${PROJECT_DIRECTORY}/./TODO
42         ${PROJECT_DIRECTORY}/./src/smpi/smpicc.in
43         ${PROJECT_DIRECTORY}/./src/smpi/smpicc
44         ${PROJECT_DIRECTORY}/./src/smpi/smpirun.in
45         ${PROJECT_DIRECTORY}/./src/smpi/smpirun
46         ${PROJECT_DIRECTORY}/./src/bindings/ruby/simgrid_ruby.c
47         ${PROJECT_DIRECTORY}/./src/bindings/ruby_bindings.h
48         ${PROJECT_DIRECTORY}/./src/simix/smx_context_sysv_private.h
49 )
50         
51 foreach(file ${to_svg})
52         get_filename_component(file_location ${file} PATH)
53         string(REPLACE "${PROJECT_DIRECTORY}/" "/" file_location ${file_location})
54         #message("install: ${file}\nDESTINATION: ${file_location}")
55         install(FILES ${file} DESTINATION "${file_location}")
56 endforeach(file ${EXTRA_DIST})
57
58 ###copy doc
59 install(DIRECTORY "${PROJECT_DIRECTORY}/doc/"
60 DESTINATION "/doc/"
61 PATTERN ".svn" EXCLUDE 
62 PATTERN ".git" EXCLUDE 
63 PATTERN "*.o" EXCLUDE
64 PATTERN "*~" EXCLUDE
65 )
66
67 ###buildtools 
68 install(DIRECTORY "${PROJECT_DIRECTORY}/buildtools/Cmake/"
69 DESTINATION "/buildtools/Cmake/"
70 PATTERN ".svn" EXCLUDE 
71 PATTERN ".git" EXCLUDE
72 PATTERN "*.o" EXCLUDE
73 PATTERN "*~" EXCLUDE
74 )
75
76 set(CPACK_SET_DESTDIR on)
77 set(CMAKE_INSTALL_PREFIX ${prefix} CACHE TYPE INTERNAL FORCE)
78
79 string(REPLACE ";" "\t" install_HEADERS "${install_HEADERS}")
80 string(REPLACE ";" "\t" install_libs "${install_libs}")
81 string(REPLACE "${PROJECT_DIRECTORY}/src/.libs" "${prefix}/lib" uninstall_libs "${install_libs}")
82 string(REPLACE "./" "${prefix}/" uninstall_HEADERS "${install_HEADERS}")
83
84 add_custom_target(install-simgrid
85 COMMAND mkdir -p ${prefix}
86 COMMAND mkdir -p ${prefix}/lib
87 COMMAND mkdir -p ${prefix}/include
88 COMMAND mkdir -p ${prefix}/doc
89 COMMAND mkdir -p ${prefix}/doc/simgrid
90 COMMAND mkdir -p ${prefix}/doc/simgrid/html
91 COMMAND cp ${install_libs} ${prefix}/lib
92 COMMAND echo "install lib ok"
93 COMMAND cp -rf ${PROJECT_DIRECTORY}/doc/html/ ${prefix}/doc/simgrid
94 COMMAND echo "install doc ok"
95 COMMAND cp --parent ${install_HEADERS} ${prefix}
96 COMMAND echo "install include ok"
97 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
98 )
99
100 add_custom_target(uninstall
101 COMMAND echo "uninstall simgrid"
102 COMMAND rm -rf ${prefix}/doc/simgrid
103 COMMAND echo "uninstall doc ok"
104 COMMAND rm ${uninstall_libs}
105 COMMAND echo "uninstall lib ok"
106 COMMAND rm ${uninstall_HEADERS}
107 COMMAND echo "uninstal include ok"
108 COMMAND rm -R ${prefix}/include/amok ${prefix}/include/gras ${prefix}/include/instr ${prefix}/include/msg 
109 COMMAND rm -R ${prefix}/include/simdag ${prefix}/include/smpi ${prefix}/include/surf ${prefix}/include/xbt
110 WORKING_DIRECTORY "${prefix}"
111 )
112
113 add_custom_target(html
114 COMMAND echo "Make the html doc"
115 COMMAND echo "cmake -DBIBTEX2HTML=${BIBTEX2HTML} ./"
116 COMMAND cmake -DBIBTEX2HTML=${BIBTEX2HTML} ./
117 COMMAND rm -rf ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/CMakeFiles
118 COMMAND rm ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/CMakeCache.txt
119 COMMAND rm ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/cmake_install.cmake
120 COMMAND rm ${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc/Makefile
121 WORKING_DIRECTORY "${PROJECT_DIRECTORY}/buildtools/Cmake/src/doc"
122 )
123
124 add_custom_target(dist
125 COMMAND make package
126 COMMAND rm -rf ${PROJECT_DIRECTORY}/_CPack_Packages
127 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
128 )
129 add_custom_target(distcheck
130 COMMAND make package
131 COMMAND rm -rf ${PROJECT_DIRECTORY}/_CPack_Packages
132 COMMAND tar xvf ${CPACK_PACKAGE_FILE_NAME}.tar.bz2
133 COMMAND cd ${PROJECT_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} && cmake .
134 COMMAND cd ${PROJECT_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} && make
135 COMMAND cd ${PROJECT_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} && make test
136 COMMAND rm -rf ${PROJECT_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}
137 WORKING_DIRECTORY "${PROJECT_DIRECTORY}"
138 )
139
140 include(CPack)