]> git.lyx.org Git - lyx.git/blob - development/cmake/LyxPackaging.cmake
Use std::regex automatically in C++11 mode
[lyx.git] / development / cmake / LyxPackaging.cmake
1
2 # CPack packaging
3 #
4 # http://cmake.org/cmake/help/cmake-2-8-docs.html#module:CPack
5
6 if(LYX_BUNDLE)
7         if(APPLE)
8                 set(CPACK_GENERATOR DragNDrop)
9                 set(CPACK_DMG_BACKGROUND_IMAGE "${TOP_CMAKE_PATH}/../MacOSX/dmg-background.png")
10                 set(CPACK_DMG_DS_STORE "${CMAKE_BINARY_DIR}/ds_store/.DS_Store")
11         elseif(UNIX)
12                 set(CPACK_GENERATOR STGZ)
13         elseif(WIN32)
14                 set(CPACK_GENERATOR ZIP)
15         endif()
16 endif()
17
18 # Overwrite package name dependent on platform
19 # (Ignores the top project)
20 if(APPLE)
21         # true on all systems whre __APPLE__ is defined in header files
22         set(CPACK_PACKAGE_NAME "LyX${LYX_MAJOR_VERSION}${LYX_MINOR_VERSION}")
23 elseif(UNIX)
24         # True also for cygwin
25         set(CPACK_PACKAGE_NAME "lyx${LYX_MAJOR_VERSION}${LYX_MINOR_VERSION}")
26 else()
27         set(CPACK_PACKAGE_NAME "LyX${LYX_MAJOR_VERSION}${LYX_MINOR_VERSION}")
28 endif()
29
30 set(CPACK_PACKAGE_VERSION_MAJOR "${LYX_MAJOR_VERSION}")
31 set(CPACK_PACKAGE_VERSION_MINOR "${LYX_MINOR_VERSION}")
32 FILE(STRINGS "${TOP_CMAKE_PATH}/LyX_summary.txt" CPACK_PACKAGE_DESCRIPTION_SUMMARY)
33
34
35 set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${LYX_INSTALL_SUFFIX}")
36
37 if (APPLE)
38         # We don't need absolute paths
39         set(CPACK_SET_DESTDIR "OFF")
40 elseif(WIN32)
41     set(CPACK_GENERATOR ZIP)
42     set(CPACK_BINARY_ZIP 1)
43     if(MINGW)
44         get_filename_component(MINGW_BIN_PATH ${CMAKE_CXX_COMPILER} PATH)
45         if(LYX_XMINGW)
46             if(LYX_USE_QT MATCHES "QT4")
47                 get_filename_component(mingw_name ${LYX_XMINGW} NAME)
48                 set(MINGW_BIN_PATH ${MINGW_BIN_PATH}/../${mingw_name}/lib)
49                 set(MINGW_LIB_PATH ${MINGW_BIN_PATH})
50             else()
51                 set(MINGW_BIN_PATH /usr/lib/gcc/${LYX_XMINGW}/${GCC_VERSION})
52                 set(MINGW_LIB_PATH /usr/${LYX_XMINGW}/lib)
53             endif()
54         endif()
55         if(EXISTS ${MINGW_BIN_PATH}/libgcc_s_sjlj-1.dll)
56             list(APPEND runtime ${MINGW_BIN_PATH}/libgcc_s_sjlj-1.dll)
57         elseif(EXISTS ${MINGW_BIN_PATH}/libgcc_s_seh-1.dll)
58             list(APPEND runtime ${MINGW_BIN_PATH}/libgcc_s_seh-1.dll)
59         elseif(EXISTS ${MINGW_BIN_PATH}/libgcc_s_dw2-1.dll)
60             list(APPEND runtime ${MINGW_BIN_PATH}/libgcc_s_dw2-1.dll)
61         endif()
62         if(EXISTS ${MINGW_BIN_PATH}/libstdc++-6.dll)
63             list(APPEND runtime ${MINGW_BIN_PATH}/libstdc++-6.dll)
64         endif()
65         if(EXISTS ${MINGW_LIB_PATH}/libwinpthread-1.dll)
66             list(APPEND runtime ${MINGW_LIB_PATH}/libwinpthread-1.dll)
67         endif()
68         if(NOT runtime)
69             message(FATAL_ERROR "No mingw runtime found in ${MINGW_BIN_PATH}")
70         endif()
71
72         if(LYX_USE_QT MATCHES "QT5")
73             get_target_property(qmakebin Qt5::qmake IMPORTED_LOCATION)
74             get_filename_component(QT_BINARY_DIR ${qmakebin} PATH)
75             install(FILES
76                 ${runtime}
77                 ${QT_BINARY_DIR}/Qt5Core.dll
78                 ${QT_BINARY_DIR}/Qt5Network.dll
79                 ${QT_BINARY_DIR}/Qt5Gui.dll
80                 ${QT_BINARY_DIR}/Qt5Widgets.dll
81                 ${QT_BINARY_DIR}/Qt5Concurrent.dll
82                 ${QT_BINARY_DIR}/Qt5OpenGL.dll
83                 ${QT_BINARY_DIR}/Qt5PrintSupport.dll
84                 ${QT_BINARY_DIR}/Qt5Svg.dll
85                 ${QT_BINARY_DIR}/Qt5WinExtras.dll
86                 DESTINATION bin
87                 CONFIGURATIONS Release)
88             install(FILES
89                 ${QT_BINARY_DIR}/../plugins/platforms/qminimal.dll
90                 ${QT_BINARY_DIR}/../plugins/platforms/qwindows.dll
91                 DESTINATION bin/platforms
92                 CONFIGURATIONS Release)
93             install(FILES
94                 ${QT_BINARY_DIR}/../plugins/printsupport/windowsprintersupport.dll
95                 DESTINATION bin/printsupport
96                 CONFIGURATIONS Release)
97             install(FILES
98                 ${QT_BINARY_DIR}/../plugins/imageformats/qgif.dll
99                 ${QT_BINARY_DIR}/../plugins/imageformats/qjpeg.dll
100                 ${QT_BINARY_DIR}/../plugins/imageformats/qsvg.dll
101                 ${QT_BINARY_DIR}/../plugins/imageformats/qico.dll
102                 DESTINATION bin/imageformats
103                 CONFIGURATIONS Release)
104             install(FILES
105                 ${QT_BINARY_DIR}/../plugins/iconengines/qsvgicon.dll
106                 DESTINATION bin/iconengines
107                 CONFIGURATIONS Release)
108         else()
109             install(FILES
110                 ${runtime}
111                 ${QT_BINARY_DIR}/QtCore4.dll
112                 ${QT_BINARY_DIR}/QtGui4.dll
113                 ${QT_BINARY_DIR}/QtNetwork4.dll
114                 ${QT_PLUGINS_DIR}/imageformats/qgif4.dll
115                 ${QT_PLUGINS_DIR}/imageformats/qico4.dll
116                 ${QT_PLUGINS_DIR}/imageformats/qmng4.dll
117                 ${QT_PLUGINS_DIR}/imageformats/qsvg4.dll
118                 ${QT_PLUGINS_DIR}/imageformats/qtga4.dll
119                 ${QT_PLUGINS_DIR}/imageformats/qtiff4.dll
120                 DESTINATION bin CONFIGURATIONS Release)
121         endif()
122     endif()
123 else()
124         # needed by rpm
125         set(CPACK_SET_DESTDIR "ON")
126 endif()
127
128 FILE(READ "${TOP_CMAKE_PATH}/LyX_license.txt" CPACK_RPM_PACKAGE_LICENSE)
129 set(CPACK_RPM_PACKAGE_GROUP "Applications/Publishing")
130 set(CPACK_RPM_PACKAGE_VENDOR "The LyX team")
131 #
132 # the next ones are needed by deb
133 set(CPACK_PACKAGE_CONTACT "${PACKAGE_BUGREPORT}")
134 set(CPACK_SOURCE_PACKAGE_FILE_NAME "${LYX_PROJECT}-${LYX_INSTALL_SUFFIX}")
135
136 # We depend on python scripting
137 set(CPACK_DEBIAN_PACKAGE_DEPENDS "python (>= 2.6)")
138
139 # use dpkg-shlibdeps to generate additional info for package dependency list.
140 set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
141 set(CPACK_DEBIAN_PACKAGE_DEBUG ON)
142
143 #
144 # for the next ones, cpack insists on data with values in some file
145 set(CPACK_PACKAGE_DESCRIPTION_FILE "${TOP_CMAKE_PATH}/LyX_description.txt")
146 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
147
148 # Use the revision number saved in ${LYX_PACKAGE_RELEASE}
149 # as the release in rpm-package-build.
150 # This way we maycan omit the otherwise needed "--force" parameter when
151 # installing from that rpm package.
152 set(CPACK_RPM_PACKAGE_RELEASE ${LYX_PACKAGE_RELEASE})
153 set(CPACK_PACKAGE_VERSION_PATCH ${LYX_REVISION_VERSION})
154
155 # we do not have a readme or welcome data,
156 # so we do not provide infofiles for
157 # CPACK_RESOURCE_FILE_README and CPACK_RESOURCE_FILE_WELCOME
158
159 # sources
160 set(CPACK_SOURCE_INSTALLED_DIRECTORIES "${TOP_SRC_DIR};/") # http://www.mail-archive.com/cmake@cmake.org/msg33720.html
161
162
163 set(CPACK_STRIP_FILES 1)
164
165 # Finaly give some hints about files not to be included in source package
166 SET(CPACK_SOURCE_IGNORE_FILES
167 "/CVS/"
168 "/\\\\.svn/"
169 "/\\\\.bzr/"
170 "/\\\\.hg/"
171 "/\\\\.git/"
172 "/\\\\.project$"
173 "/\\\\.cproject$"
174 "/\\\\.history$"
175 "\\\\.#"
176 "\\\\.swp$"
177 "~$"
178 "/#"
179 "/_CPack_Packages/"
180 "/CMakeCache.txt$"
181 "/CPackSourceConfig\\\\.cmake$"
182 "/configCompiler\\\\.h$"
183 "/install_manifest\\\\.txt$"
184 "/cmake_install\\\\.cmake$"
185 "/POTFILES"
186 "\\\\.tar\\\\.gz$"
187 "\\\\.tar\\\\.bz2$"
188 "\\\\.tar\\\\.Z$"
189 "\\\\.deb$"
190 "\\\\.rpm$"
191 "\\\\.rej$"
192 "\\\\.orig$"
193 "/core$"
194 "/CMakeFiles/"
195 "/Makefile\\\\.in$"
196 "/Makefile$"
197 "/autom4te\\\\.cache/"
198 "/\\\\.deps/"
199 "/build/"
200 "/lyx-2\\\\."
201 )
202
203 if(LYX_CPACK)
204         include(CPack)
205 endif()
206
207
208 #Now it is possible to create some packages
209 # cd <BuildDir>
210 # make package
211 #############################################################################################
212 # So, e.g. for variables
213 #    CMAKE_PROJECT_NAME                     : lyx
214 #    CPACK_PACKAGE_VERSION_MAJOR            : 2
215 #    CPACK_PACKAGE_VERSION_MINOR            : 0
216 #    CPACK_PACKAGE_VERSION_PATCH            : 1
217 #    CMAKE_SYSTEM_NAME                      : Linux
218 #    CPACK_BINARY_DEB:BOOL                  : ON
219 #
220 # the package name builds as "lyx-2.0.1-Linux.deb"
221 #
222 ############################## rpm ################################### deb ##################
223 # create    # cpack -G RPM --config CPackConfig.cmake   # cpack -G DEB --config CPackConfig.cmake
224 # creates =># lyx-2.0.1-Linux.rpm                       # lyx-2.0.1-Linux.deb
225 # list      # rpm -qlp lyx-2.0.1-Linux.rpm              # dpkg-deb -c lyx-2.0.1-Linux.deb
226 # install   # rpm -U lyx-2.0.1-Linux.rpm                # dpkg -i lyx-2.0.1-Linux.deb
227 #
228