mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-06 16:56:55 +08:00
Add installer builds to cmake for linux
cd ~/my_projects/libyuv git pull mkdir cbuild # (for out-of-source builds) cd cbuild cmake -DCMAKE_BUILD_TYPE=Release .. make -j4 make package BUG=libyuv:673 TEST=make package Change-Id: Ia449cbfd0bc118cc90c8648f8199a0526b7ae2a2 Reviewed-on: https://chromium-review.googlesource.com/433440 Commit-Queue: Frank Barchard <fbarchard@google.com> Reviewed-by: Henrik Kjellander <kjellander@chromium.org>
This commit is contained in:
parent
6b058e094d
commit
33f52bdac9
69
CM_linux_packages.cmake
Normal file
69
CM_linux_packages.cmake
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
# 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 "fbarchard@chromium.org" )
|
||||||
|
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 <fbarchard@chromium.org>" )
|
||||||
|
SET ( CPACK_GENERATOR "DEB;RPM" )
|
||||||
|
|
||||||
|
# create the .deb and .rpm files (you'll need build-essential and rpm tools)
|
||||||
|
INCLUDE( CPack )
|
||||||
|
|
||||||
143
CMakeLists.txt
143
CMakeLists.txt
@ -1,114 +1,45 @@
|
|||||||
cmake_minimum_required(VERSION 2.8)
|
|
||||||
|
|
||||||
# CMakeLists for libyuv
|
# CMakeLists for libyuv
|
||||||
# Originally created for "roxlu build system" to compile libyuv on windows
|
# Originally created for "roxlu build system" to compile libyuv on windows
|
||||||
# Run with -DTEST=ON to build unit tests
|
# Run with -DTEST=ON to build unit tests
|
||||||
option(TEST "Built unit tests" OFF)
|
|
||||||
|
|
||||||
set(ly_base_dir ${CMAKE_CURRENT_LIST_DIR})
|
PROJECT ( YUV C CXX ) # "C" is required even for C++ projects
|
||||||
set(ly_src_dir ${ly_base_dir}/source/)
|
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
|
||||||
set(ly_inc_dir ${ly_base_dir}/include)
|
OPTION( TEST "Built unit tests" OFF )
|
||||||
set(ly_lib_name "yuv")
|
|
||||||
|
|
||||||
set(ly_source_files
|
SET ( ly_base_dir ${PROJECT_SOURCE_DIR} )
|
||||||
${ly_src_dir}/compare.cc
|
SET ( ly_src_dir ${ly_base_dir}/source )
|
||||||
${ly_src_dir}/compare_common.cc
|
SET ( ly_inc_dir ${ly_base_dir}/include )
|
||||||
${ly_src_dir}/compare_neon.cc
|
SET ( ly_tst_dir ${ly_base_dir}/unit_test )
|
||||||
${ly_src_dir}/compare_neon64.cc
|
SET ( ly_lib_name yuv )
|
||||||
${ly_src_dir}/compare_gcc.cc
|
SET ( ly_lib_static ${ly_lib_name} )
|
||||||
${ly_src_dir}/compare_win.cc
|
SET ( ly_lib_shared ${ly_lib_name}_shared )
|
||||||
${ly_src_dir}/convert.cc
|
|
||||||
${ly_src_dir}/convert_argb.cc
|
|
||||||
${ly_src_dir}/convert_from.cc
|
|
||||||
${ly_src_dir}/convert_from_argb.cc
|
|
||||||
${ly_src_dir}/convert_jpeg.cc
|
|
||||||
${ly_src_dir}/convert_to_argb.cc
|
|
||||||
${ly_src_dir}/convert_to_i420.cc
|
|
||||||
${ly_src_dir}/cpu_id.cc
|
|
||||||
${ly_src_dir}/mjpeg_decoder.cc
|
|
||||||
${ly_src_dir}/mjpeg_validate.cc
|
|
||||||
${ly_src_dir}/planar_functions.cc
|
|
||||||
${ly_src_dir}/rotate.cc
|
|
||||||
${ly_src_dir}/rotate_any.cc
|
|
||||||
${ly_src_dir}/rotate_argb.cc
|
|
||||||
${ly_src_dir}/rotate_common.cc
|
|
||||||
${ly_src_dir}/rotate_mips.cc
|
|
||||||
${ly_src_dir}/rotate_msa.cc
|
|
||||||
${ly_src_dir}/rotate_neon.cc
|
|
||||||
${ly_src_dir}/rotate_neon64.cc
|
|
||||||
${ly_src_dir}/rotate_gcc.cc
|
|
||||||
${ly_src_dir}/rotate_win.cc
|
|
||||||
${ly_src_dir}/row_any.cc
|
|
||||||
${ly_src_dir}/row_common.cc
|
|
||||||
${ly_src_dir}/row_mips.cc
|
|
||||||
${ly_src_dir}/row_msa.cc
|
|
||||||
${ly_src_dir}/row_neon.cc
|
|
||||||
${ly_src_dir}/row_neon64.cc
|
|
||||||
${ly_src_dir}/row_gcc.cc
|
|
||||||
${ly_src_dir}/row_win.cc
|
|
||||||
${ly_src_dir}/scale.cc
|
|
||||||
${ly_src_dir}/scale_any.cc
|
|
||||||
${ly_src_dir}/scale_argb.cc
|
|
||||||
${ly_src_dir}/scale_common.cc
|
|
||||||
${ly_src_dir}/scale_mips.cc
|
|
||||||
${ly_src_dir}/scale_msa.cc
|
|
||||||
${ly_src_dir}/scale_neon.cc
|
|
||||||
${ly_src_dir}/scale_neon64.cc
|
|
||||||
${ly_src_dir}/scale_gcc.cc
|
|
||||||
${ly_src_dir}/scale_win.cc
|
|
||||||
${ly_src_dir}/video_common.cc
|
|
||||||
)
|
|
||||||
|
|
||||||
set(ly_unittest_sources
|
FILE ( GLOB_RECURSE ly_source_files ${ly_src_dir}/*.cc )
|
||||||
${ly_base_dir}/unit_test/basictypes_test.cc
|
LIST ( SORT ly_source_files )
|
||||||
${ly_base_dir}/unit_test/color_test.cc
|
|
||||||
${ly_base_dir}/unit_test/compare_test.cc
|
|
||||||
${ly_base_dir}/unit_test/convert_test.cc
|
|
||||||
${ly_base_dir}/unit_test/cpu_test.cc
|
|
||||||
${ly_base_dir}/unit_test/math_test.cc
|
|
||||||
${ly_base_dir}/unit_test/planar_test.cc
|
|
||||||
${ly_base_dir}/unit_test/rotate_argb_test.cc
|
|
||||||
${ly_base_dir}/unit_test/rotate_test.cc
|
|
||||||
${ly_base_dir}/unit_test/scale_argb_test.cc
|
|
||||||
${ly_base_dir}/unit_test/scale_test.cc
|
|
||||||
${ly_base_dir}/unit_test/unit_test.cc
|
|
||||||
${ly_base_dir}/unit_test/video_common_test.cc
|
|
||||||
)
|
|
||||||
|
|
||||||
set(ly_header_files
|
FILE ( GLOB_RECURSE ly_unittest_sources ${ly_tst_dir}/*.cc )
|
||||||
${ly_inc_dir}/libyuv/basic_types.h
|
LIST ( SORT ly_unittest_sources )
|
||||||
${ly_inc_dir}/libyuv/compare.h
|
|
||||||
${ly_inc_dir}/libyuv/convert.h
|
|
||||||
${ly_inc_dir}/libyuv/convert_argb.h
|
|
||||||
${ly_inc_dir}/libyuv/convert_from.h
|
|
||||||
${ly_inc_dir}/libyuv/convert_from_argb.h
|
|
||||||
${ly_inc_dir}/libyuv/cpu_id.h
|
|
||||||
${ly_inc_dir}/libyuv/macros_msa.h
|
|
||||||
${ly_inc_dir}/libyuv/planar_functions.h
|
|
||||||
${ly_inc_dir}/libyuv/rotate.h
|
|
||||||
${ly_inc_dir}/libyuv/rotate_argb.h
|
|
||||||
${ly_inc_dir}/libyuv/rotate_row.h
|
|
||||||
${ly_inc_dir}/libyuv/row.h
|
|
||||||
${ly_inc_dir}/libyuv/scale.h
|
|
||||||
${ly_inc_dir}/libyuv/scale_argb.h
|
|
||||||
${ly_inc_dir}/libyuv/scale_row.h
|
|
||||||
${ly_inc_dir}/libyuv/version.h
|
|
||||||
${ly_inc_dir}/libyuv/video_common.h
|
|
||||||
${ly_inc_dir}/libyuv/mjpeg_decoder.h
|
|
||||||
)
|
|
||||||
|
|
||||||
include_directories(${ly_inc_dir})
|
INCLUDE_DIRECTORIES( BEFORE ${ly_inc_dir} )
|
||||||
|
|
||||||
add_library(${ly_lib_name} STATIC ${ly_source_files})
|
# this creates the static library (.a)
|
||||||
|
ADD_LIBRARY ( ${ly_lib_static} STATIC ${ly_source_files} )
|
||||||
|
|
||||||
add_executable(convert ${ly_base_dir}/util/convert.cc)
|
# this creates the shared library (.so)
|
||||||
target_link_libraries(convert ${ly_lib_name})
|
ADD_LIBRARY ( ${ly_lib_shared} SHARED ${ly_source_files} )
|
||||||
|
SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES OUTPUT_NAME "${ly_lib_name}" )
|
||||||
|
SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES PREFIX "lib" )
|
||||||
|
|
||||||
include(FindJPEG)
|
# this creates the conversion tool
|
||||||
|
ADD_EXECUTABLE ( convert ${ly_base_dir}/util/convert.cc )
|
||||||
|
TARGET_LINK_LIBRARIES ( convert ${ly_lib_static} )
|
||||||
|
|
||||||
|
|
||||||
|
INCLUDE ( FindJPEG )
|
||||||
if (JPEG_FOUND)
|
if (JPEG_FOUND)
|
||||||
include_directories(${JPEG_INCLUDE_DIR})
|
include_directories( ${JPEG_INCLUDE_DIR} )
|
||||||
target_link_libraries(convert ${JPEG_LIBRARY})
|
target_link_libraries( convert ${JPEG_LIBRARY} )
|
||||||
add_definitions(-DHAVE_JPEG)
|
add_definitions( -DHAVE_JPEG )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(TEST)
|
if(TEST)
|
||||||
@ -138,9 +69,15 @@ if(TEST)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(libyuv_unittest gflags)
|
target_link_libraries(libyuv_unittest gflags)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(TARGETS ${ly_lib_name} DESTINATION lib)
|
|
||||||
install(FILES ${ly_header_files} DESTINATION include/libyuv)
|
# install the conversion tool, .so, .a, and all the header files
|
||||||
install(FILES ${ly_inc_dir}/libyuv.h DESTINATION include/)
|
INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/convert DESTINATION bin RENAME yuvconvert )
|
||||||
|
INSTALL ( TARGETS ${ly_lib_static} DESTINATION lib )
|
||||||
|
INSTALL ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib )
|
||||||
|
INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include )
|
||||||
|
|
||||||
|
# create the .deb and .rpm packages using cpack
|
||||||
|
INCLUDE ( CM_linux_packages.cmake )
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
Name: libyuv
|
Name: libyuv
|
||||||
URL: http://code.google.com/p/libyuv/
|
URL: http://code.google.com/p/libyuv/
|
||||||
Version: 1640
|
Version: 1641
|
||||||
License: BSD
|
License: BSD
|
||||||
License File: LICENSE
|
License File: LICENSE
|
||||||
|
|
||||||
|
|||||||
@ -227,6 +227,14 @@ Release build/install
|
|||||||
cmake --build . --config Release
|
cmake --build . --config Release
|
||||||
sudo cmake --build . --target install --config Release
|
sudo cmake --build . --target install --config Release
|
||||||
|
|
||||||
|
Release package
|
||||||
|
|
||||||
|
mkdir out
|
||||||
|
cd out
|
||||||
|
cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||||
|
make -j4
|
||||||
|
make package
|
||||||
|
|
||||||
## Running Unittests
|
## Running Unittests
|
||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
|
|||||||
@ -11,6 +11,6 @@
|
|||||||
#ifndef INCLUDE_LIBYUV_VERSION_H_
|
#ifndef INCLUDE_LIBYUV_VERSION_H_
|
||||||
#define INCLUDE_LIBYUV_VERSION_H_
|
#define INCLUDE_LIBYUV_VERSION_H_
|
||||||
|
|
||||||
#define LIBYUV_VERSION 1640
|
#define LIBYUV_VERSION 1641
|
||||||
|
|
||||||
#endif // INCLUDE_LIBYUV_VERSION_H_
|
#endif // INCLUDE_LIBYUV_VERSION_H_
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user