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