-
Notifications
You must be signed in to change notification settings - Fork 0
/
packaging.cmake
82 lines (64 loc) · 2.01 KB
/
packaging.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# ===========
# == CPACK ==
# ===========
# DISCLAIMER :
# The intent of this usage of CPack is
# not to create fancy or complicated
# package. It's simply to create an
# archive (.e.g. tar.gz) that will contain
# the relocatable runtime to deploy on a
# machine and executes
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_VENDOR "EVS Broadcast Equipment")
set(CPACK_PACKAGE_DESCRIPTION "The installer package of ${PROJECT_NAME}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${CPACK_PACKAGE_DESCRIPTION})
# if(UNIX)
# set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/evs/AppFs/${CPACK_PACKAGE_NAME}")
# endif()
# Add an indication about the nature of binaries
if(BUILD_SHARED_LIBS)
set(LINK_TYPE "dynamic")
else()
set(LINK_TYPE "static")
endif()
if(DEFINED OS_DISTRO AND DEFINED OS_VERSION)
set(OS_FLAVOUR "-${OS_DISTRO}.${OS_VERSION}")
endif()
if(DEFINED CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE STREQUAL "")
set(BUILD_TYPE "-${CMAKE_BUILD_TYPE}")
endif()
# Create output file name in the given directory
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${PROJECT_VERSION}-${LINK_TYPE}${BUILD_TYPE}${OS_FLAVOUR}")
if (${CMAKE_INSTALL_PREFIX} STREQUAL "")
set(CPACK_OUTPUT_FILE_PREFIX ${CMAKE_BINARY_DIR}/package)
else()
set(CPACK_OUTPUT_FILE_PREFIX ${CMAKE_INSTALL_PREFIX}/package)
endif()
# Only support tar.gz
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
if(UNIX)
set(CPACK_GENERATOR "TGZ")
else()
set(CPACK_GENERATOR "ZIP")
endif()
# Allow archive to do component based install
set(CPACK_ARCHIVE_COMPONENT_INSTALL 1)
# Install only those components in this archive
set(CPACK_COMPONENTS_ALL
evs-gbio-runtime
AppBofStd-app
bofstd-runtime
dis-runtime
webrpc-runtime
)
set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE)
# Allow compression in //
set(CPACK_THREADS 0)
# Try to build relocatable packages
set(CPACK_PACKAGE_RELOCATABLE TRUE)
if(DEFINED OS_DISTRO AND OS_DISTRO STREQUAL "centos")
list(APPEND CPACK_GENERATOR "RPM")
include(rpm.cmake)
endif()
# Always the last directive
include(CPack)