Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: add cache variables for BUILD_SHARED_LIBS & VVENC_LIBRARY_ONLY #442

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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" )

Expand Down
29 changes: 17 additions & 12 deletions cmake/modules/vvencInstall.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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_ )
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions source/App/vvencFFapp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wall>
$<$<CXX_COMPILER_ID:GNU>:-Wall -fdiagnostics-show-option>
Expand Down
3 changes: 3 additions & 0 deletions source/App/vvencapp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wall>
$<$<CXX_COMPILER_ID:GNU>:-Wall -fdiagnostics-show-option>
Expand Down
3 changes: 3 additions & 0 deletions test/vvencinterfacetest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wall>
$<$<CXX_COMPILER_ID:GNU>:-Wall -fdiagnostics-show-option>
Expand Down
3 changes: 3 additions & 0 deletions test/vvenclibtest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wall>
$<$<CXX_COMPILER_ID:GNU>:-Wall -fdiagnostics-show-option>
Expand Down