Skip to content

Commit

Permalink
Statically link to libsndfile when pulled from vcpkg
Browse files Browse the repository at this point in the history
  • Loading branch information
Cacodemon345 authored and coelckers committed Aug 23, 2023
1 parent 1d5e344 commit e970fb1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ if (VCPKG_TOOLCHAIN)
endif()

option(VCPKG_LIBSNDFILE "Import libsndfile from vcpkg" OFF)
else()
set(VCPKG_MANIFEST_FEATURES)
endif()

list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
Expand Down
13 changes: 11 additions & 2 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ if(NOT WIN32 AND NOT APPLE)
determine_package_config_dependency(ZMUSIC_PACKAGE_DEPENDENCIES TARGET Threads::Threads MODULE Threads)
endif()

option(DYN_SNDFILE "Dynamically load libsndfile" ON)
if ("vcpkg-libsndfile" IN_LIST VCPKG_MANIFEST_FEATURES)
set(DYN_SNDFILE 0)
else()
option(DYN_SNDFILE "Dynamically load libsndfile" ON)
endif()

if(DYN_SNDFILE)
target_compile_definitions(zmusic-obj INTERFACE HAVE_SNDFILE DYN_SNDFILE)
else()
Expand All @@ -78,7 +83,11 @@ else()
endif()
endif()

option(DYN_MPG123 "Dynamically load libmpg123" ON)
if ("vcpkg-libsndfile" IN_LIST VCPKG_MANIFEST_FEATURES)
set(DYN_MPG123 0)
else()
option(DYN_MPG123 "Dynamically load libmpg123" ON)
endif()
if(DYN_MPG123)
target_compile_definitions(zmusic-obj INTERFACE HAVE_MPG123 DYN_MPG123)
else()
Expand Down

0 comments on commit e970fb1

Please sign in to comment.