BuildPackages.cmake 6.6 KB

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