diff --git a/CMakeLists.txt b/CMakeLists.txt index 090093bb5..f9916fbbb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,6 +103,10 @@ endif() # enable install target set( VVENC_ENABLE_INSTALL ON CACHE BOOL "Enable or disable install target" ) +set( VVENC_LIBRARY_ONLY OFF CACHE BOOL "Build libvvenc only (no vvencapp,vvencFFapp,vvenclibtest,vvencinterfacetest" ) + +set( BUILD_SHARED_LIBS OFF CACHE BOOL "Build libvvenc as a shared library" ) + # enable postfix set( VVENC_ENABLE_BUILD_TYPE_POSTFIX OFF CACHE BOOL "Enable or disable build type postfix for apps and libs" ) diff --git a/cmake/modules/vvencInstall.cmake b/cmake/modules/vvencInstall.cmake index 149a25a31..3e08bb415 100644 --- a/cmake/modules/vvencInstall.cmake +++ b/cmake/modules/vvencInstall.cmake @@ -5,8 +5,20 @@ set( RUNTIME_DEST ${CMAKE_INSTALL_BINDIR} ) set( LIBRARY_DEST ${CMAKE_INSTALL_LIBDIR} ) set( ARCHIVE_DEST ${CMAKE_INSTALL_LIBDIR} ) +if( VVENC_INSTALL_FULLFEATURE_APP AND VVENC_LIBRARY_ONLY ) + message( FATAL_ERROR "VVENC_INSTALL_FULLFEATURE_APP conflicts with VVENC_LIBRARY_ONLY" ) +endif() + set( VVENC_INST_TARGETS vvenc ) +if( NOT VVENC_LIBRARY_ONLY ) + list( APPEND VVENC_INST_TARGETS vvencapp ) + + if( VVENC_INSTALL_FULLFEATURE_APP ) + list( APPEND VVENC_INST_TARGETS vvencFFapp ) + endif() +endif() + # install targets macro( install_targets config_ ) string( TOLOWER ${config_} config_lc_ ) @@ -16,15 +28,6 @@ macro( install_targets config_ ) RUNTIME DESTINATION ${RUNTIME_DEST} LIBRARY DESTINATION ${LIBRARY_DEST} ARCHIVE DESTINATION ${ARCHIVE_DEST} ) - if( VVENC_INSTALL_FULLFEATURE_APP ) - install( TARGETS vvencapp vvencFFapp - CONFIGURATIONS ${config_} - RUNTIME DESTINATION ${RUNTIME_DEST} ) - else() - install( TARGETS vvencapp - CONFIGURATIONS ${config_} - RUNTIME DESTINATION ${RUNTIME_DEST} ) - endif() endmacro( install_targets ) # install pdb file for static and shared libraries @@ -68,9 +71,11 @@ install_targets( MinSizeRel ) # install pdb files install_lib_pdb( vvenc ) -install_exe_pdb( vvencapp ) -if( VVENC_INSTALL_FULLFEATURE_APP ) - install_exe_pdb( vvencFFapp ) +if( NOT VVENC_LIBRARY_ONLY ) + install_exe_pdb( vvencapp ) + if( VVENC_INSTALL_FULLFEATURE_APP ) + install_exe_pdb( vvencFFapp ) + endif() endif() # configure version file diff --git a/cmake/modules/vvencTests.cmake b/cmake/modules/vvencTests.cmake index 762df3310..2c467b9e0 100644 --- a/cmake/modules/vvencTests.cmake +++ b/cmake/modules/vvencTests.cmake @@ -1,6 +1,10 @@ # enable testing with ctest enable_testing() +if( VVENC_LIBRARY_ONLY ) + message( WARNING "The test suite will not be able to run, when building the vvenc library only (VVENC_LIBRARY_ONLY=ON)" ) +endif() + set( TEST_YUV "${PROJECT_SOURCE_DIR}/test/data/RTn23_80x44p15_f15.yuv" ) set( TEST_CFG "${PROJECT_SOURCE_DIR}/test/data/RTn23.cfg" ) set( CFG_DIR "${PROJECT_SOURCE_DIR}/cfg" ) diff --git a/source/App/vvencFFapp/CMakeLists.txt b/source/App/vvencFFapp/CMakeLists.txt index 87ab0c964..72f09ddd3 100644 --- a/source/App/vvencFFapp/CMakeLists.txt +++ b/source/App/vvencFFapp/CMakeLists.txt @@ -28,6 +28,9 @@ set_target_properties( ${EXE_NAME} PROPERTIES RELEASE_POSTFIX "${CMAKE_RE set_target_properties( ${EXE_NAME} PROPERTIES DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}" ) set_target_properties( ${EXE_NAME} PROPERTIES RELWITHDEBINFO_POSTFIX "${CMAKE_RELWITHDEBINFO_POSTFIX}" ) set_target_properties( ${EXE_NAME} PROPERTIES MINSIZEREL_POSTFIX "${CMAKE_MINSIZEREL_POSTFIX}" ) +if( VVENC_LIBRARY_ONLY ) + set_target_properties( ${EXE_NAME} PROPERTIES EXCLUDE_FROM_ALL TRUE ) +endif() target_compile_options( ${EXE_NAME} PRIVATE $<$,$>:-Wall> $<$:-Wall -fdiagnostics-show-option> diff --git a/source/App/vvencapp/CMakeLists.txt b/source/App/vvencapp/CMakeLists.txt index d29c1d12a..9720cd5a6 100644 --- a/source/App/vvencapp/CMakeLists.txt +++ b/source/App/vvencapp/CMakeLists.txt @@ -25,6 +25,9 @@ set_target_properties( ${EXE_NAME} PROPERTIES RELEASE_POSTFIX "${CMAKE_RE set_target_properties( ${EXE_NAME} PROPERTIES DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}" ) set_target_properties( ${EXE_NAME} PROPERTIES RELWITHDEBINFO_POSTFIX "${CMAKE_RELWITHDEBINFO_POSTFIX}" ) set_target_properties( ${EXE_NAME} PROPERTIES MINSIZEREL_POSTFIX "${CMAKE_MINSIZEREL_POSTFIX}" ) +if( VVENC_LIBRARY_ONLY ) + set_target_properties( ${EXE_NAME} PROPERTIES EXCLUDE_FROM_ALL TRUE ) +endif() target_compile_options( ${EXE_NAME} PRIVATE $<$,$>:-Wall> $<$:-Wall -fdiagnostics-show-option> diff --git a/test/vvencinterfacetest/CMakeLists.txt b/test/vvencinterfacetest/CMakeLists.txt index 94f7f85b8..eb82d09f6 100644 --- a/test/vvencinterfacetest/CMakeLists.txt +++ b/test/vvencinterfacetest/CMakeLists.txt @@ -18,6 +18,9 @@ set_target_properties( ${EXE_NAME} PROPERTIES RELEASE_POSTFIX "${CMAKE_RE set_target_properties( ${EXE_NAME} PROPERTIES DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}" ) set_target_properties( ${EXE_NAME} PROPERTIES RELWITHDEBINFO_POSTFIX "${CMAKE_RELWITHDEBINFO_POSTFIX}" ) set_target_properties( ${EXE_NAME} PROPERTIES MINSIZEREL_POSTFIX "${CMAKE_MINSIZEREL_POSTFIX}" ) +if( VVENC_LIBRARY_ONLY ) + set_target_properties( ${EXE_NAME} PROPERTIES EXCLUDE_FROM_ALL TRUE ) +endif() target_compile_options( ${EXE_NAME} PRIVATE $<$,$>:-Wall> $<$:-Wall -fdiagnostics-show-option> diff --git a/test/vvenclibtest/CMakeLists.txt b/test/vvenclibtest/CMakeLists.txt index d5dbb6111..08fbc50d2 100644 --- a/test/vvenclibtest/CMakeLists.txt +++ b/test/vvenclibtest/CMakeLists.txt @@ -18,6 +18,9 @@ set_target_properties( ${EXE_NAME} PROPERTIES RELEASE_POSTFIX "${CMAKE_RE set_target_properties( ${EXE_NAME} PROPERTIES DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}" ) set_target_properties( ${EXE_NAME} PROPERTIES RELWITHDEBINFO_POSTFIX "${CMAKE_RELWITHDEBINFO_POSTFIX}" ) set_target_properties( ${EXE_NAME} PROPERTIES MINSIZEREL_POSTFIX "${CMAKE_MINSIZEREL_POSTFIX}" ) +if( VVENC_LIBRARY_ONLY ) + set_target_properties( ${EXE_NAME} PROPERTIES EXCLUDE_FROM_ALL TRUE ) +endif() target_compile_options( ${EXE_NAME} PRIVATE $<$,$>:-Wall> $<$:-Wall -fdiagnostics-show-option>