• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# This file is included from the top-level CMakeLists.txt.  We just store it
2# here to avoid cluttering up that file.
3
4set(PKGNAME ${CMAKE_PROJECT_NAME} CACHE STRING
5  "Distribution package name (default: ${CMAKE_PROJECT_NAME})")
6set(PKGVENDOR "The ${CMAKE_PROJECT_NAME} Project" CACHE STRING
7  "Vendor name to be included in distribution package descriptions (default: The ${CMAKE_PROJECT_NAME} Project)")
8set(PKGURL "http://www.${CMAKE_PROJECT_NAME}.org" CACHE STRING
9  "URL of project web site to be included in distribution package descriptions (default: http://www.${CMAKE_PROJECT_NAME}.org)")
10set(PKGEMAIL "information@${CMAKE_PROJECT_NAME}.org" CACHE STRING
11  "E-mail of project maintainer to be included in distribution package descriptions (default: information@${CMAKE_PROJECT_NAME}.org")
12set(PKGID "com.${CMAKE_PROJECT_NAME}.${PKGNAME}" CACHE STRING
13  "Globally unique package identifier (reverse DNS notation) (default: com.${CMAKE_PROJECT_NAME}.${PKGNAME})")
14
15
16###############################################################################
17# Linux RPM and DEB
18###############################################################################
19
20if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
21
22set(RPMARCH ${CMAKE_SYSTEM_PROCESSOR})
23if(CPU_TYPE STREQUAL "x86_64")
24  set(DEBARCH amd64)
25elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv7*")
26  set(DEBARCH armhf)
27elseif(CPU_TYPE STREQUAL "arm64")
28  set(DEBARCH ${CPU_TYPE})
29elseif(CPU_TYPE STREQUAL "arm")
30  set(DEBARCH armel)
31elseif(CMAKE_SYSTEM_PROCESSOR_LC STREQUAL "ppc64le")
32  set(DEBARCH ppc64el)
33elseif(CPU_TYPE STREQUAL "powerpc" AND BITS EQUAL 32)
34  set(RPMARCH ppc)
35  set(DEBARCH ppc)
36else()
37  set(DEBARCH ${CMAKE_SYSTEM_PROCESSOR})
38endif()
39message(STATUS "RPM architecture = ${RPMARCH}, DEB architecture = ${DEBARCH}")
40
41# Re-set CMAKE_POSITION_INDEPENDENT_CODE so that the RPM spec file works
42# properly
43boolean_number(CMAKE_POSITION_INDEPENDENT_CODE)
44
45configure_file(release/makerpm.in pkgscripts/makerpm)
46configure_file(release/rpm.spec.in pkgscripts/rpm.spec @ONLY)
47
48add_custom_target(rpm sh pkgscripts/makerpm
49  SOURCES pkgscripts/makerpm)
50
51configure_file(release/makesrpm.in pkgscripts/makesrpm)
52
53add_custom_target(srpm sh pkgscripts/makesrpm
54  SOURCES pkgscripts/makesrpm
55  DEPENDS dist)
56
57configure_file(release/makedpkg.in pkgscripts/makedpkg)
58configure_file(release/deb-control.in pkgscripts/deb-control)
59
60add_custom_target(deb sh pkgscripts/makedpkg
61  SOURCES pkgscripts/makedpkg)
62
63endif() # Linux
64
65
66###############################################################################
67# Windows installer (NullSoft Installer)
68###############################################################################
69
70if(WIN32)
71
72if(MSVC)
73  set(INST_PLATFORM "Visual C++")
74  set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-vc)
75  set(INST_REG_NAME ${CMAKE_PROJECT_NAME})
76elseif(MINGW)
77  set(INST_PLATFORM GCC)
78  set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-gcc)
79  set(INST_REG_NAME ${CMAKE_PROJECT_NAME}-gcc)
80  set(INST_DEFS -DGCC)
81endif()
82
83if(BITS EQUAL 64)
84  set(INST_PLATFORM "${INST_PLATFORM} 64-bit")
85  set(INST_NAME ${INST_NAME}64)
86  set(INST_REG_NAME ${INST_DIR}64)
87  set(INST_DEFS ${INST_DEFS} -DWIN64)
88endif()
89
90if(WITH_JAVA)
91  set(INST_DEFS ${INST_DEFS} -DJAVA)
92endif()
93
94if(MSVC_IDE)
95  set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=${CMAKE_CFG_INTDIR}\\")
96else()
97  set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=")
98endif()
99
100string(REGEX REPLACE "/" "\\\\" INST_DIR ${CMAKE_INSTALL_PREFIX})
101
102configure_file(release/installer.nsi.in installer.nsi @ONLY)
103
104if(WITH_JAVA)
105  set(JAVA_DEPEND turbojpeg-java)
106endif()
107add_custom_target(installer
108  makensis -nocd ${INST_DEFS} installer.nsi
109  DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom
110    cjpeg djpeg jpegtran tjbench ${JAVA_DEPEND}
111  SOURCES installer.nsi)
112
113endif() # WIN32
114
115
116###############################################################################
117# Cygwin Package
118###############################################################################
119
120if(CYGWIN)
121
122configure_file(release/makecygwinpkg.in pkgscripts/makecygwinpkg)
123
124add_custom_target(cygwinpkg sh pkgscripts/makecygwinpkg)
125
126endif() # CYGWIN
127
128
129###############################################################################
130# Mac DMG
131###############################################################################
132
133if(APPLE)
134
135set(DEFAULT_OSX_32BIT_BUILD ${CMAKE_SOURCE_DIR}/osxx86)
136set(OSX_32BIT_BUILD ${DEFAULT_OSX_32BIT_BUILD} CACHE PATH
137  "Directory containing 32-bit (i386) Mac build to include in universal binaries (default: ${DEFAULT_OSX_32BIT_BUILD})")
138set(DEFAULT_IOS_ARMV7_BUILD ${CMAKE_SOURCE_DIR}/iosarmv7)
139set(IOS_ARMV7_BUILD ${DEFAULT_IOS_ARMV7_BUILD} CACHE PATH
140  "Directory containing ARMv7 iOS build to include in universal binaries (default: ${DEFAULT_IOS_ARMV7_BUILD})")
141set(DEFAULT_IOS_ARMV7S_BUILD ${CMAKE_SOURCE_DIR}/iosarmv7s)
142set(IOS_ARMV7S_BUILD ${DEFAULT_IOS_ARMV7S_BUILD} CACHE PATH
143  "Directory containing ARMv7s iOS build to include in universal binaries (default: ${DEFAULT_IOS_ARMV7S_BUILD})")
144set(DEFAULT_IOS_ARMV8_BUILD ${CMAKE_SOURCE_DIR}/iosarmv8)
145set(IOS_ARMV8_BUILD ${DEFAULT_IOS_ARMV8_BUILD} CACHE PATH
146  "Directory containing ARMv8 iOS build to include in universal binaries (default: ${DEFAULT_IOS_ARMV8_BUILD})")
147
148configure_file(release/makemacpkg.in pkgscripts/makemacpkg)
149configure_file(release/Distribution.xml.in pkgscripts/Distribution.xml)
150configure_file(release/uninstall.in pkgscripts/uninstall)
151
152add_custom_target(dmg sh pkgscripts/makemacpkg
153  SOURCES pkgscripts/makemacpkg)
154
155add_custom_target(udmg sh pkgscripts/makemacpkg universal
156  SOURCES pkgscripts/makemacpkg)
157
158endif() # APPLE
159
160
161###############################################################################
162# Generic
163###############################################################################
164
165add_custom_target(dist
166  COMMAND git archive --prefix=${CMAKE_PROJECT_NAME}-${VERSION}/ HEAD |
167    gzip > ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}-${VERSION}.tar.gz
168    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
169
170configure_file(release/maketarball.in pkgscripts/maketarball)
171
172add_custom_target(tarball sh pkgscripts/maketarball
173  SOURCES pkgscripts/maketarball)
174
175configure_file(release/libjpeg.pc.in pkgscripts/libjpeg.pc @ONLY)
176
177configure_file(release/libturbojpeg.pc.in pkgscripts/libturbojpeg.pc @ONLY)
178