build: use libsamplerate with vcpkg sdl2 port

Enable the samplerate feature for the vcpkg sdl2 port to use
libsamplerate for resampling.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2024-01-02 02:56:29 +00:00
parent d1aa4eb23d
commit 390482a719
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
2 changed files with 20 additions and 1 deletions

View File

@ -45,7 +45,7 @@ if(TAG_RELEASE)
include(MakeReleaseCommitAndTag) include(MakeReleaseCommitAndTag)
endif() endif()
set(VCPKG_DEPS pkgconf zlib sdl2 gettext wxwidgets) set(VCPKG_DEPS pkgconf zlib "sdl2[samplerate]" gettext wxwidgets)
set(VCPKG_DEPS_OPTIONAL set(VCPKG_DEPS_OPTIONAL
sfml ENABLE_LINK sfml ENABLE_LINK

View File

@ -202,6 +202,25 @@ IF(SDL2_LIBRARY_TEMP)
SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP} -lversion -limm32) SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP} -lversion -limm32)
ENDIF(MINGW) ENDIF(MINGW)
# Add libsamplerate with vcpkg
if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg")
if(WIN32)
unset(arch_suffix)
unset(path_prefix)
if(VCPKG_TARGET_TRIPLET MATCHES -static)
set(arch_suffix -static)
endif()
if(CMAKE_BUILD_TYPE MATCHES "^(Debug|RelWithDebInfo)$")
set(path_prefix debug)
endif()
set(installed_prefix ${_VCPKG_INSTALLED_DIR}/${WINARCH}-windows${arch_suffix}/${path_prefix})
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${installed_prefix}/lib/samplerate.lib)
else()
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} -lsamplerate)
endif()
endif()
# Add some stuff from pkg-config, if available # Add some stuff from pkg-config, if available
IF(NOT PKG_CONFIG_EXECUTABLE) IF(NOT PKG_CONFIG_EXECUTABLE)
FIND_PACKAGE(PkgConfig QUIET) FIND_PACKAGE(PkgConfig QUIET)