]> git.lyx.org Git - lyx.git/blob - development/cmake/LyxPackaging.cmake
Update translation of Listings by Jari-Matti Mäkelä
[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         set(runtime)
45         if(LYX_XMINGW)
46             execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-libgcc-file-name OUTPUT_VARIABLE GCC_LIBGCC OUTPUT_STRIP_TRAILING_WHITESPACE)
47             list(APPEND runtime /usr/${LYX_XMINGW}/lib/libwinpthread-1.dll)
48         else()
49             set(GCC_LIBGCC ${CMAKE_CXX_COMPILER})
50         endif()
51         get_filename_component(MINGW_RUNTIME_PATH ${GCC_LIBGCC} PATH)        
52         macro(add_runtime_dll _DLL)
53             file(GLOB GCC_RUNTIME ${MINGW_RUNTIME_PATH}/${_DLL})
54             list(APPEND runtime ${GCC_RUNTIME})
55         endmacro()
56         add_runtime_dll(libgcc*.dll)
57         add_runtime_dll(libstd*.dll)
58         add_runtime_dll(libwin*.dll)
59         if(NOT runtime)
60             message(FATAL_ERROR "No mingw runtime found in ${MINGW_RUNTIME_PATH}")
61         endif()
62
63         if(LYX_USE_QT MATCHES "QT5")
64             get_target_property(qmakebin Qt5::qmake IMPORTED_LOCATION)
65             get_filename_component(QT_BINARY_DIR ${qmakebin} PATH)
66             install(FILES
67                 ${runtime}
68                 ${QT_BINARY_DIR}/Qt5Core.dll
69                 ${QT_BINARY_DIR}/Qt5Network.dll
70                 ${QT_BINARY_DIR}/Qt5Gui.dll
71                 ${QT_BINARY_DIR}/Qt5Widgets.dll
72                 ${QT_BINARY_DIR}/Qt5Concurrent.dll
73                 ${QT_BINARY_DIR}/Qt5OpenGL.dll
74                 ${QT_BINARY_DIR}/Qt5PrintSupport.dll
75                 ${QT_BINARY_DIR}/Qt5Svg.dll
76                 ${QT_BINARY_DIR}/Qt5WinExtras.dll
77                 DESTINATION bin
78                 CONFIGURATIONS Release)
79             install(FILES
80                 ${QT_BINARY_DIR}/../plugins/platforms/qminimal.dll
81                 ${QT_BINARY_DIR}/../plugins/platforms/qwindows.dll
82                 DESTINATION bin/platforms
83                 CONFIGURATIONS Release)
84             install(FILES
85                 ${QT_BINARY_DIR}/../plugins/printsupport/windowsprintersupport.dll
86                 DESTINATION bin/printsupport
87                 CONFIGURATIONS Release)
88             install(FILES
89                 ${QT_BINARY_DIR}/../plugins/imageformats/qgif.dll
90                 ${QT_BINARY_DIR}/../plugins/imageformats/qjpeg.dll
91                 ${QT_BINARY_DIR}/../plugins/imageformats/qsvg.dll
92                 ${QT_BINARY_DIR}/../plugins/imageformats/qico.dll
93                 DESTINATION bin/imageformats
94                 CONFIGURATIONS Release)
95             install(FILES
96                 ${QT_BINARY_DIR}/../plugins/iconengines/qsvgicon.dll
97                 DESTINATION bin/iconengines
98                 CONFIGURATIONS Release)
99         else()
100             install(FILES
101                 ${runtime}
102                 ${QT_BINARY_DIR}/QtCore4.dll
103                 ${QT_BINARY_DIR}/QtGui4.dll
104                 ${QT_BINARY_DIR}/QtNetwork4.dll
105                 ${QT_PLUGINS_DIR}/imageformats/qgif4.dll
106                 ${QT_PLUGINS_DIR}/imageformats/qico4.dll
107                 ${QT_PLUGINS_DIR}/imageformats/qmng4.dll
108                 ${QT_PLUGINS_DIR}/imageformats/qsvg4.dll
109                 ${QT_PLUGINS_DIR}/imageformats/qtga4.dll
110                 ${QT_PLUGINS_DIR}/imageformats/qtiff4.dll
111                 DESTINATION bin CONFIGURATIONS Release)
112         endif()
113     endif()
114 else()
115         # needed by rpm
116         set(CPACK_SET_DESTDIR "ON")
117 endif()
118
119 FILE(READ "${TOP_CMAKE_PATH}/LyX_license.txt" CPACK_RPM_PACKAGE_LICENSE)
120 set(CPACK_RPM_PACKAGE_GROUP "Applications/Publishing")
121 set(CPACK_RPM_PACKAGE_VENDOR "The LyX team")
122 #
123 # the next ones are needed by deb
124 set(CPACK_PACKAGE_CONTACT "${PACKAGE_BUGREPORT}")
125 set(CPACK_SOURCE_PACKAGE_FILE_NAME "${LYX_PROJECT}-${LYX_INSTALL_SUFFIX}")
126
127 # We depend on python scripting
128 set(CPACK_DEBIAN_PACKAGE_DEPENDS "python (>= 2.6)")
129
130 # use dpkg-shlibdeps to generate additional info for package dependency list.
131 set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
132 set(CPACK_DEBIAN_PACKAGE_DEBUG ON)
133
134 #
135 # for the next ones, cpack insists on data with values in some file
136 set(CPACK_PACKAGE_DESCRIPTION_FILE "${TOP_CMAKE_PATH}/LyX_description.txt")
137 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
138
139 # Use the revision number saved in ${LYX_PACKAGE_RELEASE}
140 # as the release in rpm-package-build.
141 # This way we maycan omit the otherwise needed "--force" parameter when
142 # installing from that rpm package.
143 set(CPACK_RPM_PACKAGE_RELEASE ${LYX_PACKAGE_RELEASE})
144 set(CPACK_PACKAGE_VERSION_PATCH ${LYX_REVISION_VERSION})
145
146 # we do not have a readme or welcome data,
147 # so we do not provide infofiles for
148 # CPACK_RESOURCE_FILE_README and CPACK_RESOURCE_FILE_WELCOME
149
150 # sources
151 set(CPACK_SOURCE_INSTALLED_DIRECTORIES "${TOP_SRC_DIR};/") # http://www.mail-archive.com/cmake@cmake.org/msg33720.html
152
153
154 set(CPACK_STRIP_FILES 1)
155
156 # Finaly give some hints about files not to be included in source package
157 SET(CPACK_SOURCE_IGNORE_FILES
158 "/CVS/"
159 "/\\\\.svn/"
160 "/\\\\.bzr/"
161 "/\\\\.hg/"
162 "/\\\\.git/"
163 "/\\\\.project$"
164 "/\\\\.cproject$"
165 "/\\\\.history$"
166 "/\\\\.gitignore$"
167 "/\\\\.gitattributes$"
168 "\\\\.#"
169 "\\\\.swp$"
170 "\\\\.my$"
171 "\\\\.pyc$"
172 "\\\\.patch$"
173 "~$"
174 "/#"
175 "/_CPack_Packages/"
176 "/CMakeCache.txt$"
177 "/CPackSourceConfig\\\\.cmake$"
178 "/configCompiler\\\\.h$"
179 "/install_manifest\\\\.txt$"
180 "/cmake_install\\\\.cmake$"
181 "/POTFILES"
182 "\\\\.tar\\\\.gz$"
183 "\\\\.tar\\\\.bz2$"
184 "\\\\.tar\\\\.Z$"
185 "\\\\.deb$"
186 "\\\\.rpm$"
187 "\\\\.rej$"
188 "\\\\.orig$"
189 "/core$"
190 "/CMakeFiles/"
191 "/Makefile\\\\.in$"
192 "/Makefile$"
193 "/autom4te\\\\.cache/"
194 "/\\\\.deps/"
195 "/build/"
196 "/attic/"
197 "/HTML/"
198 "/lyx-2\\\\."
199 "/expectedTestFailures$"
200 "/MergedManuals.lyx$"
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