aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/modules
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2022-12-15 18:54:48 +0000
committerJoão Valverde <j@v6e.pt>2022-12-16 11:11:28 +0000
commitae148498649e38105607e9da2262fc276ffe2049 (patch)
treea603adaab2f0b334fb39eb72f0644a7ab91da838 /cmake/modules
parenta4f56e90a66e81f85d8e5f81eb3e5781198311c3 (diff)
Windows: Use SpeexDSP binary package
Remove bundled code and use vcpkg binary library instead.
Diffstat (limited to 'cmake/modules')
-rw-r--r--cmake/modules/FindSpeexDSP.cmake40
1 files changed, 30 insertions, 10 deletions
diff --git a/cmake/modules/FindSpeexDSP.cmake b/cmake/modules/FindSpeexDSP.cmake
index 6c111111e5..cd6ada0c42 100644
--- a/cmake/modules/FindSpeexDSP.cmake
+++ b/cmake/modules/FindSpeexDSP.cmake
@@ -1,18 +1,26 @@
+# Find the system's SpeexDSP includes and library
#
-# - Find speexdsp libraries
-#
-# SPEEXDSP_INCLUDE_DIRS - where to find speexdsp headers.
-# SPEEXDSP_LIBRARIES - List of libraries when using speexdsp.
-# SPEEXDSP_FOUND - True if speexdsp is found.
+# SPEEXDSP_INCLUDE_DIRS - where to find SpeexDSP headers
+# SPEEXDSP_LIBRARIES - List of libraries when using SpeexDSP
+# SPEEXDSP_FOUND - True if SpeexDSP found
+# SPEEXDSP_DLL_DIR - (Windows) Path to the SpeexDSP DLL
+# SPEEXDSP_DLL - (Windows) Name of the SpeexDSP DLL
+
+include(FindWSWinLibs)
+FindWSWinLibs("speexdsp-.*" "SPEEXDSP_HINTS")
+
+if(NOT WIN32)
+ find_package(PkgConfig)
+ pkg_search_module(PC_SPEEXDSP speexdsp)
+endif()
-find_package(PkgConfig QUIET)
-pkg_search_module(PC_SPEEXDSP QUIET speexdsp)
find_path(SPEEXDSP_INCLUDE_DIR
NAMES
speex/speex_resampler.h
HINTS
${PC_SPEEXDSP_INCLUDE_DIRS}
+ ${SPEEXDSP_HINTS}/include
)
find_library(SPEEXDSP_LIBRARY
@@ -20,16 +28,28 @@ find_library(SPEEXDSP_LIBRARY
speexdsp
HINTS
${PC_SPEEXDSP_LIBRARY_DIRS}
+ ${SPEEXDSP_HINTS}/lib
)
include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(SpeexDSP
- REQUIRED_VARS SPEEXDSP_LIBRARY SPEEXDSP_INCLUDE_DIR
- VERSION_VAR PC_SPEEXDSP_VERSION)
+find_package_handle_standard_args(SpeexDSP DEFAULT_MSG SPEEXDSP_LIBRARY SPEEXDSP_INCLUDE_DIR)
if(SPEEXDSP_FOUND)
set(SPEEXDSP_LIBRARIES ${SPEEXDSP_LIBRARY})
set(SPEEXDSP_INCLUDE_DIRS ${SPEEXDSP_INCLUDE_DIR})
+ if(WIN32)
+ set(SPEEXDSP_DLL_DIR "${SPEEXDSP_HINTS}/bin"
+ CACHE PATH "Path to SpeexDSP DLL"
+ )
+ file(GLOB _speexdsp_dll RELATIVE "${SPEEXDSP_DLL_DIR}"
+ "${SPEEXDSP_DLL_DIR}/libspeexdsp.dll"
+ )
+ set(SPEEXDSP_DLL ${_speexdsp_dll}
+ # We're storing filenames only. Should we use STRING instead?
+ CACHE FILEPATH "SpeexDSP DLL file name"
+ )
+ mark_as_advanced(SPEEXDSP_DLL_DIR SPEEXDSP_DLL)
+ endif()
else()
set(SPEEXDSP_LIBRARIES)
set(SPEEXDSP_INCLUDE_DIRS)