Skip to content

Commit

Permalink
cmake: add cache variables for BUILD_SHARED_LIBS & VVDEC_LIBRARY_ONLY
Browse files Browse the repository at this point in the history
closes #202
  • Loading branch information
K-os committed Oct 15, 2024
1 parent 2dab52c commit 65509e7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ set( VVDEC_ENABLE_LOCAL_BITSTREAM_DOWNLOAD OFF CACHE BOOL "Enable or disable
# also install the test executable vvdecapp instead of the libraries and headers only
set( VVDEC_INSTALL_VVDECAPP OFF CACHE BOOL "Enable or disable installing the test vvdecapp" )

set( VVDEC_LIBRARY_ONLY OFF CACHE BOOL "Build libvvdec only (no vvdecapp)" )

set( BUILD_SHARED_LIBS OFF CACHE BOOL "Build libvvdec as a shared library" )

# enable postfix
set( VVDEC_ENABLE_BUILD_TYPE_POSTFIX OFF CACHE BOOL "Enable or disable build type postfix for apps and libs" )

Expand Down
20 changes: 12 additions & 8 deletions cmake/modules/vvdecInstall.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,19 @@ target_include_directories( vvdec SYSTEM INTERFACE $<INSTALL_INTERFACE:${CMAKE_
install( FILES ${CMAKE_BINARY_DIR}/vvdec/version.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vvdec )
install( DIRECTORY include/vvdec DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} )

if( VVDEC_INSTALL_VVDECAPP OR (${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten") )
# for Emscripten/WASM builds vvdecapp is always installed, since that is used like a library
set( INSTALL_TARGETS "vvdec;vvdecapp" )
else()
set( INSTALL_TARGETS "vvdec" )
if( VVDEC_INSTALL_VVDECAPP AND VVDEC_LIBRARY_ONLY )
message( FATAL_ERROR "VVDEC_INSTALL_VVDECAPP conflicts with VVDEC_LIBRARY_ONLY" )
endif()

if ( NOT VVDEC_INSTALL_VVDECAPP )
install( CODE "message( NOTICE \"The vvdecapp binary is not installed by default anymore. To also install vvdecapp set '-DVVDEC_INSTALL_VVDECAPP=ON' (with make: 'install-vvdecapp=1')\" )" )
endif()
set( INSTALL_TARGETS vvdec )

if( NOT VVDEC_LIBRARY_ONLY )
if( VVDEC_INSTALL_VVDECAPP
OR (${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten") ) # for Emscripten/WASM builds vvdecapp is always installed, since that is used like a library
list( APPEND INSTALL_TARGETS vvdecapp )
else()
install( CODE "message( NOTICE \"The vvdecapp binary is not installed by default any more. To also install vvdecapp set '-DVVDEC_INSTALL_VVDECAPP=ON' (with make: 'install-vvdecapp=1')\" )" )
endif()
endif()


Expand Down
3 changes: 3 additions & 0 deletions source/App/vvdecapp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ set_target_properties( ${EXE_NAME} PROPERTIES MINSIZEREL_POSTFIX "${CMAKE_MI
if( VVDEC_INSTALL_RPATH )
set_target_properties( ${EXE_NAME} PROPERTIES INSTALL_RPATH "${VVDEC_INSTALL_RPATH}" )
endif()
if( VVDEC_LIBRARY_ONLY )
set_target_properties( ${EXE_NAME} PROPERTIES EXCLUDE_FROM_ALL TRUE )
endif()

target_link_libraries( ${EXE_NAME} Threads::Threads vvdec )
target_include_directories( ${EXE_NAME} PRIVATE ../../Lib/libmd5 )
Expand Down

0 comments on commit 65509e7

Please sign in to comment.