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