1# determine the version number from the #define in libyuv/version.h 2EXECUTE_PROCESS ( 3 COMMAND grep --perl-regex --only-matching "(?<=LIBYUV_VERSION )[0-9]+" include/libyuv/version.h 4 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} 5 OUTPUT_VARIABLE YUV_VERSION_NUMBER 6 OUTPUT_STRIP_TRAILING_WHITESPACE ) 7SET ( YUV_VER_MAJOR 0 ) 8SET ( YUV_VER_MINOR 0 ) 9SET ( YUV_VER_PATCH ${YUV_VERSION_NUMBER} ) 10SET ( YUV_VERSION ${YUV_VER_MAJOR}.${YUV_VER_MINOR}.${YUV_VER_PATCH} ) 11MESSAGE ( "Building ver.: ${YUV_VERSION}" ) 12 13# is this a 32-bit or 64-bit build? 14IF ( CMAKE_SIZEOF_VOID_P EQUAL 8 ) 15 SET ( YUV_BIT_SIZE 64 ) 16ELSEIF ( CMAKE_SIZEOF_VOID_P EQUAL 4 ) 17 SET ( YUV_BIT_SIZE 32 ) 18ELSE () 19 MESSAGE ( FATAL_ERROR "CMAKE_SIZEOF_VOID_P=${CMAKE_SIZEOF_VOID_P}" ) 20ENDIF () 21 22# detect if this is a ARM build 23STRING (FIND "${CMAKE_CXX_COMPILER}" "arm-linux-gnueabihf-g++" pos) 24IF ( ${pos} EQUAL -1 ) 25 SET ( YUV_CROSS_COMPILE_FOR_ARM7 FALSE ) 26ELSE () 27 MESSAGE ( "Cross compiling for ARM7" ) 28 SET ( YUV_CROSS_COMPILE_FOR_ARM7 TRUE ) 29ENDIF () 30STRING (FIND "${CMAKE_SYSTEM_PROCESSOR}" "arm" pos) 31IF ( ${pos} EQUAL -1 ) 32 SET ( YUV_COMPILE_FOR_ARM7 FALSE ) 33ELSE () 34 MESSAGE ( "Compiling for ARM" ) 35 SET ( YUV_COMPILE_FOR_ARM7 TRUE ) 36ENDIF () 37 38# setup the sytem name, such as "x86-32", "amd-64", and "arm-32 39IF ( ${YUV_CROSS_COMPILE_FOR_ARM7} OR ${YUV_COMPILE_FOR_ARM7} ) 40 SET ( YUV_SYSTEM_NAME "armhf-${YUV_BIT_SIZE}" ) 41ELSE () 42 IF ( YUV_BIT_SIZE EQUAL 32 ) 43 SET ( YUV_SYSTEM_NAME "x86-${YUV_BIT_SIZE}" ) 44 ELSE () 45 SET ( YUV_SYSTEM_NAME "amd-${YUV_BIT_SIZE}" ) 46 ENDIF () 47ENDIF () 48MESSAGE ( "Packaging for: ${YUV_SYSTEM_NAME}" ) 49 50# define all the variables needed by CPack to create .deb and .rpm packages 51SET ( CPACK_PACKAGE_VENDOR "Frank Barchard" ) 52SET ( CPACK_PACKAGE_CONTACT "fbarchard@chromium.org" ) 53SET ( CPACK_PACKAGE_VERSION ${YUV_VERSION} ) 54SET ( CPACK_PACKAGE_VERSION_MAJOR ${YUV_VER_MAJOR} ) 55SET ( CPACK_PACKAGE_VERSION_MINOR ${YUV_VER_MINOR} ) 56SET ( CPACK_PACKAGE_VERSION_PATCH ${YUV_VER_PATCH} ) 57SET ( CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE ) 58SET ( CPACK_SYSTEM_NAME "linux-${YUV_SYSTEM_NAME}" ) 59SET ( CPACK_PACKAGE_NAME "libyuv" ) 60SET ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "YUV library" ) 61SET ( CPACK_PACKAGE_DESCRIPTION "YUV library and YUV conversion tool" ) 62SET ( CPACK_DEBIAN_PACKAGE_SECTION "other" ) 63SET ( CPACK_DEBIAN_PACKAGE_PRIORITY "optional" ) 64SET ( CPACK_DEBIAN_PACKAGE_MAINTAINER "Frank Barchard <fbarchard@chromium.org>" ) 65SET ( CPACK_GENERATOR "DEB;RPM" ) 66 67# create the .deb and .rpm files (you'll need build-essential and rpm tools) 68INCLUDE( CPack ) 69 70