1# 2# Copyright (C) 2024 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); you may not 5# use this file except in compliance with the License. You may obtain a copy of 6# the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13# License for the specific language governing permissions and limitations under 14# the License. 15# 16 17# common package configuration 18set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME}) 19set(CPACK_PACKAGE_VENDOR "Google, Inc.") 20set(CPACK_PACKAGE_CONTACT "Dichen Zhang <[email protected]>") 21set(CPACK_PACKAGE_VERSION_MAJOR ${UHDR_MAJOR_VERSION}) 22set(CPACK_PACKAGE_VERSION_MINOR ${UHDR_MINOR_VERSION}) 23set(CPACK_PACKAGE_VERSION_PATCH ${UHDR_PATCH_VERSION}) 24set(CPACK_PACKAGE_VERSION "${UHDR_MAJOR_VERSION}.${UHDR_MINOR_VERSION}.${UHDR_PATCH_VERSION}") 25set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/DESCRIPTION) 26set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${CMAKE_PROJECT_DESCRIPTION}) 27set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/google/libultrahdr") 28if("${CMAKE_SYSTEM_NAME}" STREQUAL "") 29 message(FATAL_ERROR "Failed to determine CPACK_SYSTEM_NAME. Is CMAKE_SYSTEM_NAME set?" ) 30endif() 31string(TOLOWER "${CMAKE_SYSTEM_NAME}" CPACK_SYSTEM_NAME) 32set(CPACK_PACKAGE_ARCHITECTURE ${ARCH}) 33set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}") 34set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${CPACK_PACKAGE_ARCHITECTURE}") 35set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE) 36set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) 37 38# platform specific configuration 39if(APPLE) 40 set(CPACK_GENERATOR "DragNDrop") 41elseif(UNIX) 42 if(EXISTS "/etc/debian_version") 43 set(CPACK_GENERATOR "DEB") 44 set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) 45 set(CPACK_DEBIAN_PACKAGE_RELEASE 1) 46 set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${CPACK_PACKAGE_HOMEPAGE_URL}) 47 elseif(EXISTS "/etc/redhat-release") 48 set(CPACK_GENERATOR "RPM") 49 set(CPACK_RPM_PACKAGE_ARCHITECTURE ${CPACK_PACKAGE_ARCHITECTURE}) 50 set(CPACK_RPM_PACKAGE_RELEASE 1) 51 set(CPACK_RPM_PACKAGE_LICENSE "Apache 2.0") 52 set(CPACK_RPM_PACKAGE_URL ${CPACK_PACKAGE_HOMEPAGE_URL}) 53 else() 54 set(CPACK_GENERATOR "TGZ") 55 endif() 56else() 57 set(CPACK_GENERATOR "ZIP") 58endif() 59