From 2788198b75b5a965c50b2871dbf2ab3e53693a84 Mon Sep 17 00:00:00 2001 From: Gauvain 'GovanifY' Roussel-Tarbouriech Date: Mon, 2 Nov 2020 12:21:00 +0100 Subject: [PATCH] 3rdparty: add libsamplerate cmake defs --- cmake/Findlibsamplerate.cmake | 25 +++++++++++++++++++++++++ cmake/SearchForStuff.cmake | 7 +++++++ pcsx2/CMakeLists.txt | 4 ++-- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 cmake/Findlibsamplerate.cmake diff --git a/cmake/Findlibsamplerate.cmake b/cmake/Findlibsamplerate.cmake new file mode 100644 index 0000000000..cda5f2caa5 --- /dev/null +++ b/cmake/Findlibsamplerate.cmake @@ -0,0 +1,25 @@ +# - Try to find libsamplerate +# Once done this will define +# +# LIBSAMPLERATE_FOUND - system has libsamplerate +# LIBSAMPLERATE_INCLUDE_DIRS - the libsamplerate include directory +# LIBSAMPLERATE_LIBRARIES - The libsamplerate libraries + +find_package(PkgConfig) +if(PKG_CONFIG_FOUND) + pkg_check_modules (LIBSAMPLERATE samplerate) + list(APPEND LIBSAMPLERATE_INCLUDE_DIRS ${LIBSAMPLERATE_INCLUDEDIR}) +endif() + +if(NOT LIBSAMPLERATE_FOUND) + find_path( LIBSAMPLERATE_INCLUDE_DIRS "samplerate.h" + PATH_SUFFIXES "samplerate" ) + find_library( LIBSAMPLERATE_LIBRARIES samplerate) +endif() + +# handle the QUIETLY and REQUIRED arguments and set SAMPLERATE_FOUND to TRUE if +# all listed variables are TRUE +include( "FindPackageHandleStandardArgs" ) +find_package_handle_standard_args(libsamplerate DEFAULT_MSG LIBSAMPLERATE_INCLUDE_DIRS LIBSAMPLERATE_LIBRARIES) + +mark_as_advanced(LIBSAMPLERATE_INCLUDE_DIRS LIBSAMPLERATE_LIBRARIES) diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index 5dabd85623..342aa932bf 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -93,6 +93,9 @@ find_package(ZLIB) ## Use pcsx2 package to find module include(FindLibc) +## Use pcsx2 package to find module +include(Findlibsamplerate) + ## Use CheckLib package to find module include(CheckLib) if(Linux) @@ -189,6 +192,10 @@ if(PCAP_FOUND) include_directories(${PCAP_INCLUDE_DIR}) endif() +if(LIBSAMPLERATE_FOUND) + include_directories(${LIBSAMPLERATE_INCLUDE_DIR}) +endif() + if(LIBXML2_FOUND) include_directories(${LIBXML2_INCLUDE_DIRS}) endif() diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index d7c69a81ee..5a01a8068a 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -361,8 +361,6 @@ set(pcsx2USBSources # USB headers set(pcsx2USBHeaders USB/USB.h - USB/PS2Etypes.h - USB/PS2Edefs.h USB/proxybase.h USB/deviceproxy.h USB/configuration.h @@ -905,6 +903,7 @@ set(pcsx2FinalLibs Utilities x86emitter fmt::fmt + libsamplerate ${wxWidgets_LIBRARIES} ${GTK2_LIBRARIES} ${ZLIB_LIBRARIES} @@ -914,6 +913,7 @@ set(pcsx2FinalLibs ${SOUNDTOUCH_LIBRARIES} ${SDL2_LIBRARIES} ${PCAP_LIBRARY} + ${LIBSAMPLERATE_LIBRARIES} ${LIBXML2_LIBRARIES} ${Platform_Libs} )