1 # This file is included from the top-level CMakeLists.txt. We just store it
2 # here to avoid cluttering up that file.
4 set(PKGNAME ${CMAKE_PROJECT_NAME} CACHE STRING
5 "Distribution package name (default: ${CMAKE_PROJECT_NAME})")
6 set(PKGVENDOR "The ${CMAKE_PROJECT_NAME} Project" CACHE STRING
7 "Vendor name to be included in distribution package descriptions (default: The ${CMAKE_PROJECT_NAME} Project)")
8 set(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)")
10 set(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")
12 set(PKGID "com.${CMAKE_PROJECT_NAME}.${PKGNAME}" CACHE STRING
13 "Globally unique package identifier (reverse DNS notation) (default: com.${CMAKE_PROJECT_NAME}.${PKGNAME})")
16 ###############################################################################
18 ###############################################################################
20 if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
22 set(RPMARCH ${CMAKE_SYSTEM_PROCESSOR})
23 if(CPU_TYPE STREQUAL "x86_64")
25 elseif(CPU_TYPE STREQUAL "arm64")
26 set(DEBARCH ${CPU_TYPE})
27 elseif(CPU_TYPE STREQUAL "arm")
28 check_c_source_compiles("
29 #if __ARM_PCS_VFP != 1
30 #error \"float ABI != hard\"
32 int main(void) { return 0; }" HAVE_HARD_FLOAT)
40 elseif(CMAKE_SYSTEM_PROCESSOR_LC STREQUAL "ppc64le")
42 elseif(CPU_TYPE STREQUAL "powerpc" AND BITS EQUAL 32)
46 set(DEBARCH ${CMAKE_SYSTEM_PROCESSOR})
48 message(STATUS "RPM architecture = ${RPMARCH}, DEB architecture = ${DEBARCH}")
50 # Re-set CMAKE_POSITION_INDEPENDENT_CODE so that the RPM spec file works
52 boolean_number(CMAKE_POSITION_INDEPENDENT_CODE)
54 configure_file(release/makerpm.in pkgscripts/makerpm)
55 configure_file(release/rpm.spec.in pkgscripts/rpm.spec @ONLY)
57 add_custom_target(rpm pkgscripts/makerpm
58 SOURCES pkgscripts/makerpm)
60 configure_file(release/makesrpm.in pkgscripts/makesrpm)
62 add_custom_target(srpm pkgscripts/makesrpm
63 SOURCES pkgscripts/makesrpm
66 configure_file(release/makedpkg.in pkgscripts/makedpkg)
67 configure_file(release/deb-control.in pkgscripts/deb-control)
69 add_custom_target(deb pkgscripts/makedpkg
70 SOURCES pkgscripts/makedpkg)
75 ###############################################################################
76 # Windows installer (NullSoft Installer)
77 ###############################################################################
82 set(INST_PLATFORM "Visual C++")
84 set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-${INST_ID})
85 set(INST_REG_NAME ${CMAKE_PROJECT_NAME})
87 set(INST_PLATFORM GCC)
89 set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-${INST_ID})
90 set(INST_REG_NAME ${CMAKE_PROJECT_NAME}-${INST_ID})
95 set(INST_PLATFORM "${INST_PLATFORM} 64-bit")
96 set(INST_NAME ${INST_NAME}64)
97 set(INST_REG_NAME ${INST_REG_NAME}64)
98 set(INST_DEFS ${INST_DEFS} -DWIN64)
102 set(INST_DEFS ${INST_DEFS} -DJAVA)
106 set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=${CMAKE_CFG_INTDIR}\\")
108 set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=")
111 string(REGEX REPLACE "/" "\\\\" INST_DIR ${CMAKE_INSTALL_PREFIX})
113 configure_file(release/installer.nsi.in installer.nsi @ONLY)
114 # TODO: It would be nice to eventually switch to CPack and eliminate this mess,
116 configure_file(win/projectTargets.cmake.in
117 win/${CMAKE_PROJECT_NAME}Targets.cmake @ONLY)
118 configure_file(win/${INST_ID}/projectTargets-release.cmake.in
119 win/${CMAKE_PROJECT_NAME}Targets-release.cmake @ONLY)
122 set(JAVA_DEPEND turbojpeg-java)
124 add_custom_target(installer
125 makensis -nocd ${INST_DEFS} installer.nsi
126 DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom
127 cjpeg djpeg jpegtran tjbench ${JAVA_DEPEND}
128 SOURCES installer.nsi)
133 ###############################################################################
135 ###############################################################################
139 set(ARMV8_BUILD "" CACHE PATH
140 "Directory containing Armv8 iOS or macOS build to include in universal binaries")
142 set(MACOS_APP_CERT_NAME "" CACHE STRING
143 "Name of the Developer ID Application certificate (in the macOS keychain) that should be used to sign the libjpeg-turbo DMG. Leave this blank to generate an unsigned DMG.")
144 set(MACOS_INST_CERT_NAME "" CACHE STRING
145 "Name of the Developer ID Installer certificate (in the macOS keychain) that should be used to sign the libjpeg-turbo installer package. Leave this blank to generate an unsigned package.")
147 configure_file(release/makemacpkg.in pkgscripts/makemacpkg)
148 configure_file(release/Distribution.xml.in pkgscripts/Distribution.xml)
149 configure_file(release/Welcome.rtf.in pkgscripts/Welcome.rtf)
150 configure_file(release/uninstall.in pkgscripts/uninstall)
152 add_custom_target(dmg pkgscripts/makemacpkg
153 SOURCES pkgscripts/makemacpkg)
158 ###############################################################################
160 ###############################################################################
162 add_custom_target(dist
163 COMMAND git archive --prefix=${CMAKE_PROJECT_NAME}-${VERSION}/ HEAD |
164 gzip > ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}-${VERSION}.tar.gz
165 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
167 configure_file(release/maketarball.in pkgscripts/maketarball)
169 add_custom_target(tarball pkgscripts/maketarball
170 SOURCES pkgscripts/maketarball)
172 configure_file(release/libjpeg.pc.in pkgscripts/libjpeg.pc @ONLY)
174 configure_file(release/libturbojpeg.pc.in pkgscripts/libturbojpeg.pc @ONLY)
176 include(CMakePackageConfigHelpers)
177 write_basic_package_version_file(
178 pkgscripts/${CMAKE_PROJECT_NAME}ConfigVersion.cmake
179 VERSION ${VERSION} COMPATIBILITY AnyNewerVersion)
181 configure_package_config_file(release/Config.cmake.in
182 pkgscripts/${CMAKE_PROJECT_NAME}Config.cmake
183 INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME})