]> git.lyx.org Git - lyx.git/blob - development/cmake/LyxPackaging.cmake
Some casing fixes
[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                 get_filename_component(mingw_name ${LYX_XMINGW} NAME)
47                 set(MINGW_BIN_PATH ${MINGW_BIN_PATH}/../${mingw_name}/lib)
48         endif()
49         if(EXISTS ${MINGW_BIN_PATH}/libgcc_s_sjlj-1.dll)
50             list(APPEND runtime ${MINGW_BIN_PATH}/libgcc_s_sjlj-1.dll)
51         elseif(EXISTS ${MINGW_BIN_PATH}/libgcc_s_seh-1.dll)
52             list(APPEND runtime ${MINGW_BIN_PATH}/libgcc_s_seh-1.dll)
53         elseif(EXISTS ${MINGW_BIN_PATH}/libgcc_s_dw2-1.dll)
54             list(APPEND runtime ${MINGW_BIN_PATH}/libgcc_s_dw2-1.dll)
55         endif()
56         if(EXISTS ${MINGW_BIN_PATH}/libstdc++-6.dll)
57             list(APPEND runtime ${MINGW_BIN_PATH}/libstdc++-6.dll)
58         endif()
59         if(EXISTS ${MINGW_BIN_PATH}/libwinpthread-1.dll)
60             list(APPEND runtime ${MINGW_BIN_PATH}/libwinpthread-1.dll)
61         endif()
62         if(NOT runtime)
63                 message(FATAL_ERROR "No mingw runtime found in ${MINGW_BIN_PATH}")
64         endif()
65
66         install(FILES
67                     ${runtime}
68                     ${QT_BINARY_DIR}/QtCore4.dll
69                     ${QT_BINARY_DIR}/QtGui4.dll
70                     ${QT_BINARY_DIR}/QtNetwork4.dll
71                     ${QT_PLUGINS_DIR}/imageformats/qgif4.dll
72                     ${QT_PLUGINS_DIR}/imageformats/qico4.dll
73                     ${QT_PLUGINS_DIR}/imageformats/qmng4.dll
74                     ${QT_PLUGINS_DIR}/imageformats/qsvg4.dll
75                     ${QT_PLUGINS_DIR}/imageformats/qtga4.dll
76                     ${QT_PLUGINS_DIR}/imageformats/qtiff4.dll
77                 DESTINATION bin CONFIGURATIONS Release)
78     endif()
79 else()
80         # needed by rpm
81         set(CPACK_SET_DESTDIR "ON")
82 endif()
83
84 FILE(READ "${TOP_CMAKE_PATH}/LyX_license.txt" CPACK_RPM_PACKAGE_LICENSE)
85 set(CPACK_RPM_PACKAGE_GROUP "Applications/Publishing")
86 set(CPACK_RPM_PACKAGE_VENDOR "The LyX team")
87 #
88 # the next ones are needed by deb
89 set(CPACK_PACKAGE_CONTACT "${PACKAGE_BUGREPORT}")
90 set(CPACK_SOURCE_PACKAGE_FILE_NAME "${LYX_PROJECT}-${LYX_INSTALL_SUFFIX}")
91
92 # We depend on python scripting
93 set(CPACK_DEBIAN_PACKAGE_DEPENDS "python (>= 2.6)")
94
95 # use dpkg-shlibdeps to generate additional info for package dependency list.
96 set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
97
98 #
99 # for the next ones, cpack insists on data with values in some file
100 set(CPACK_PACKAGE_DESCRIPTION_FILE "${TOP_CMAKE_PATH}/LyX_description.txt")
101 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
102
103 # Use the revision number saved in ${LYX_PACKAGE_RELEASE}
104 # as the release in rpm-package-build.
105 # This way we maycan omit the otherwise needed "--force" parameter when
106 # installing from that rpm package.
107 set(CPACK_RPM_PACKAGE_RELEASE ${LYX_PACKAGE_RELEASE})
108 set(CPACK_PACKAGE_VERSION_PATCH ${LYX_REVISION_VERSION})
109
110 # we do not have a readme or welcome data,
111 # so we do not provide infofiles for
112 # CPACK_RESOURCE_FILE_README and CPACK_RESOURCE_FILE_WELCOME
113
114 # sources
115 set(CPACK_SOURCE_INSTALLED_DIRECTORIES "${TOP_SRC_DIR};/") # http://www.mail-archive.com/cmake@cmake.org/msg33720.html
116
117
118 set(CPACK_STRIP_FILES 1)
119
120 # Finaly give some hints about files not to be included in source package
121 SET(CPACK_SOURCE_IGNORE_FILES
122 "/CVS/"
123 "/\\\\.svn/"
124 "/\\\\.bzr/"
125 "/\\\\.hg/"
126 "/\\\\.git/"
127 "/\\\\.project$"
128 "/\\\\.cproject$"
129 "/\\\\.history$"
130 "\\\\.#"
131 "\\\\.swp$"
132 "~$"
133 "/#"
134 "/_CPack_Packages/"
135 "/CMakeCache.txt$"
136 "/CPackSourceConfig\\\\.cmake$"
137 "/configCompiler\\\\.h$"
138 "/install_manifest\\\\.txt$"
139 "/cmake_install\\\\.cmake$"
140 "/POTFILES"
141 "\\\\.tar\\\\.gz$"
142 "\\\\.tar\\\\.bz2$"
143 "\\\\.tar\\\\.Z$"
144 "\\\\.deb$"
145 "\\\\.rpm$"
146 "\\\\.rej$"
147 "\\\\.orig$"
148 "/core$"
149 "/CMakeFiles/"
150 "/Makefile\\\\.in$"
151 "/Makefile$"
152 "/autom4te\\\\.cache/"
153 "/\\\\.deps/"
154 "/build/"
155 "/lyx-2\\\\."
156 )
157
158 if(LYX_CPACK)
159         include(CPack)
160 endif()
161
162
163 #Now it is possible to create some packages
164 # cd <BuildDir>
165 # make package
166 #############################################################################################
167 # So, e.g. for variables
168 #    CMAKE_PROJECT_NAME                     : lyx
169 #    CPACK_PACKAGE_VERSION_MAJOR            : 2
170 #    CPACK_PACKAGE_VERSION_MINOR            : 0
171 #    CPACK_PACKAGE_VERSION_PATCH            : 1
172 #    CMAKE_SYSTEM_NAME                      : Linux
173 #    CPACK_BINARY_DEB:BOOL                  : ON
174 #
175 # the package name builds as "lyx-2.0.1-Linux.deb"
176 #
177 ############################## rpm ################################### deb ##################
178 # create    # cpack -G RPM --config CPackConfig.cmake   # cpack -G DEB --config CPackConfig.cmake
179 # creates =># lyx-2.0.1-Linux.rpm                       # lyx-2.0.1-Linux.deb
180 # list      # rpm -qlp lyx-2.0.1-Linux.rpm              # dpkg-deb -c lyx-2.0.1-Linux.deb
181 # install   # rpm -U lyx-2.0.1-Linux.rpm                # dpkg -i lyx-2.0.1-Linux.deb
182 #
183