-
Notifications
You must be signed in to change notification settings - Fork 1
/
CM_linux_packages.cmake
69 lines (63 loc) · 2.55 KB
/
CM_linux_packages.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
# determine the version number from the #define in libyuv/version.h
EXECUTE_PROCESS (
COMMAND grep --perl-regex --only-matching "(?<=LIBYUV_VERSION )[0-9]+" include/libyuv/version.h
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE YUV_VERSION_NUMBER
OUTPUT_STRIP_TRAILING_WHITESPACE )
SET ( YUV_VER_MAJOR 0 )
SET ( YUV_VER_MINOR 0 )
SET ( YUV_VER_PATCH ${YUV_VERSION_NUMBER} )
SET ( YUV_VERSION ${YUV_VER_MAJOR}.${YUV_VER_MINOR}.${YUV_VER_PATCH} )
MESSAGE ( "Building ver.: ${YUV_VERSION}" )
# is this a 32-bit or 64-bit build?
IF ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
SET ( YUV_BIT_SIZE 64 )
ELSEIF ( CMAKE_SIZEOF_VOID_P EQUAL 4 )
SET ( YUV_BIT_SIZE 32 )
ELSE ()
MESSAGE ( FATAL_ERROR "CMAKE_SIZEOF_VOID_P=${CMAKE_SIZEOF_VOID_P}" )
ENDIF ()
# detect if this is a ARM build
STRING (FIND "${CMAKE_CXX_COMPILER}" "arm-linux-gnueabihf-g++" pos)
IF ( ${pos} EQUAL -1 )
SET ( YUV_CROSS_COMPILE_FOR_ARM7 FALSE )
ELSE ()
MESSAGE ( "Cross compiling for ARM7" )
SET ( YUV_CROSS_COMPILE_FOR_ARM7 TRUE )
ENDIF ()
STRING (FIND "${CMAKE_SYSTEM_PROCESSOR}" "arm" pos)
IF ( ${pos} EQUAL -1 )
SET ( YUV_COMPILE_FOR_ARM7 FALSE )
ELSE ()
MESSAGE ( "Compiling for ARM" )
SET ( YUV_COMPILE_FOR_ARM7 TRUE )
ENDIF ()
# setup the sytem name, such as "x86-32", "amd-64", and "arm-32
IF ( ${YUV_CROSS_COMPILE_FOR_ARM7} OR ${YUV_COMPILE_FOR_ARM7} )
SET ( YUV_SYSTEM_NAME "armhf-${YUV_BIT_SIZE}" )
ELSE ()
IF ( YUV_BIT_SIZE EQUAL 32 )
SET ( YUV_SYSTEM_NAME "x86-${YUV_BIT_SIZE}" )
ELSE ()
SET ( YUV_SYSTEM_NAME "amd-${YUV_BIT_SIZE}" )
ENDIF ()
ENDIF ()
MESSAGE ( "Packaging for: ${YUV_SYSTEM_NAME}" )
# define all the variables needed by CPack to create .deb and .rpm packages
SET ( CPACK_PACKAGE_VENDOR "Frank Barchard" )
SET ( CPACK_PACKAGE_CONTACT "[email protected]" )
SET ( CPACK_PACKAGE_VERSION ${YUV_VERSION} )
SET ( CPACK_PACKAGE_VERSION_MAJOR ${YUV_VER_MAJOR} )
SET ( CPACK_PACKAGE_VERSION_MINOR ${YUV_VER_MINOR} )
SET ( CPACK_PACKAGE_VERSION_PATCH ${YUV_VER_PATCH} )
SET ( CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE )
SET ( CPACK_SYSTEM_NAME "linux-${YUV_SYSTEM_NAME}" )
SET ( CPACK_PACKAGE_NAME "libyuv" )
SET ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "YUV library" )
SET ( CPACK_PACKAGE_DESCRIPTION "YUV library and YUV conversion tool" )
SET ( CPACK_DEBIAN_PACKAGE_SECTION "other" )
SET ( CPACK_DEBIAN_PACKAGE_PRIORITY "optional" )
SET ( CPACK_DEBIAN_PACKAGE_MAINTAINER "Frank Barchard <[email protected]>" )
SET ( CPACK_GENERATOR "DEB;RPM" )
# create the .deb and .rpm files (you'll need build-essential and rpm tools)
INCLUDE( CPack )