From ea803ff2d4a0afb4bbe5447c3681e7782c75f5ac Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 29 Jun 2023 00:58:02 +1000 Subject: [PATCH] Build: Always use bundled soundtouch Because we're disabling exceptions in it. Might gain a bit of speed by -Ofast as well. --- .../workflows/scripts/linux/appimage-qt.sh | 1 - .../linux/flatpak/modules/12-soundtouch.json | 25 ------------------- .../linux/flatpak/net.pcsx2.PCSX2.json | 1 - .../scripts/linux/install-packages-qt.sh | 1 - 3rdparty/soundtouch/CMakeLists.txt | 18 ++++++++++--- .../soundtouch/soundtouch/soundtouch_config.h | 3 +++ cmake/SearchForStuff.cmake | 4 +-- pcsx2/CMakeLists.txt | 2 +- 8 files changed, 20 insertions(+), 35 deletions(-) delete mode 100644 .github/workflows/scripts/linux/flatpak/modules/12-soundtouch.json create mode 100644 3rdparty/soundtouch/soundtouch/soundtouch_config.h diff --git a/.github/workflows/scripts/linux/appimage-qt.sh b/.github/workflows/scripts/linux/appimage-qt.sh index f7862358bc..29424deacf 100755 --- a/.github/workflows/scripts/linux/appimage-qt.sh +++ b/.github/workflows/scripts/linux/appimage-qt.sh @@ -61,7 +61,6 @@ declare -a SYSLIBS=( "libwrap.so.0" "libharfbuzz.so.0" "libFLAC.so.8" - "libSoundTouch.so.1" "libXau.so.6" "libXcomposite.so.1" "libXcursor.so.1" diff --git a/.github/workflows/scripts/linux/flatpak/modules/12-soundtouch.json b/.github/workflows/scripts/linux/flatpak/modules/12-soundtouch.json deleted file mode 100644 index a63a623b5f..0000000000 --- a/.github/workflows/scripts/linux/flatpak/modules/12-soundtouch.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "soundtouch", - "buildsystem": "cmake-ninja", - "build-options": { - "strip": true - }, - "sources": [ - { - "type": "git", - "url": "https://codeberg.org/soundtouch/soundtouch.git", - "tag": "2.3.2", - "commit": "29fba832a7920a04eab956b3990c50e13d8c93f9" - } - ], - "cleanup": [ - "/bin", - "/include", - "/lib/*.a", - "/lib/*.la", - "/lib/cmake", - "/lib/pkgconfig", - "/share/doc" - ] -} - diff --git a/.github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.json b/.github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.json index d3cad72a2b..a1bb0063b6 100644 --- a/.github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.json +++ b/.github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.json @@ -27,7 +27,6 @@ "modules": [ "modules/10-libpcap.json", "modules/11-libaio.json", - "modules/12-soundtouch.json", "modules/20-sdl2.json", "modules/21-libbacktrace.json", { diff --git a/.github/workflows/scripts/linux/install-packages-qt.sh b/.github/workflows/scripts/linux/install-packages-qt.sh index 7ad9ada9ee..48ef6d26bc 100755 --- a/.github/workflows/scripts/linux/install-packages-qt.sh +++ b/.github/workflows/scripts/linux/install-packages-qt.sh @@ -52,7 +52,6 @@ declare -a PCSX2_PACKAGES=( "libpulse-dev" "librsvg2-dev" "libsamplerate0-dev" - "libsoundtouch-dev" "libudev-dev" "libx11-xcb-dev" "libavcodec-dev" diff --git a/3rdparty/soundtouch/CMakeLists.txt b/3rdparty/soundtouch/CMakeLists.txt index 6f2f426b91..116bfd0354 100644 --- a/3rdparty/soundtouch/CMakeLists.txt +++ b/3rdparty/soundtouch/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(soundtouch +add_library(pcsx2-soundtouch source/SoundStretch/WavFile.cpp source/SoundTouch/AAFilter.cpp source/SoundTouch/BPMDetect.cpp @@ -30,5 +30,17 @@ add_library(soundtouch source/SoundTouch/RateTransposer.h source/SoundTouch/TDStretch.h ) -target_include_directories(soundtouch PUBLIC soundtouch) -add_library(PkgConfig::SOUNDTOUCH ALIAS soundtouch) + +target_include_directories(pcsx2-soundtouch PUBLIC soundtouch) +target_compile_definitions(pcsx2-soundtouch PUBLIC SOUNDTOUCH_FLOAT_SAMPLES ST_NO_EXCEPTION_HANDLING) + +if(NOT "${CMAKE_BUILD_TYPE}" MATCHES "Debug") + if(MSVC) + target_compile_options(pcsx2-soundtouch PRIVATE /O2 /fp:fast) + else() + target_compile_options(pcsx2-soundtouch PRIVATE -Ofast) + endif() +endif() + +add_library(SoundTouch::SoundTouch ALIAS pcsx2-soundtouch) + diff --git a/3rdparty/soundtouch/soundtouch/soundtouch_config.h b/3rdparty/soundtouch/soundtouch/soundtouch_config.h new file mode 100644 index 0000000000..3942afe48e --- /dev/null +++ b/3rdparty/soundtouch/soundtouch/soundtouch_config.h @@ -0,0 +1,3 @@ +// autotools configuration step replaces this file with a configured version. +// this empty file stub is provided to avoid error about missing include file +// when not using autotools build diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index 7921b6b7a1..89b97b3fd9 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -9,7 +9,6 @@ if (WIN32) add_subdirectory(3rdparty/zlib EXCLUDE_FROM_ALL) add_subdirectory(3rdparty/libpng EXCLUDE_FROM_ALL) add_subdirectory(3rdparty/libjpeg EXCLUDE_FROM_ALL) - add_subdirectory(3rdparty/soundtouch EXCLUDE_FROM_ALL) add_subdirectory(3rdparty/wil EXCLUDE_FROM_ALL) add_subdirectory(3rdparty/xz EXCLUDE_FROM_ALL) add_subdirectory(3rdparty/D3D12MemAlloc EXCLUDE_FROM_ALL) @@ -74,8 +73,6 @@ else() endif() endif() - check_lib(SOUNDTOUCH SoundTouch SoundTouch.h PATH_SUFFIXES soundtouch) - if(NOT QT_BUILD) find_optional_system_library(SDL2 3rdparty/sdl2 2.0.12) endif() @@ -165,6 +162,7 @@ endif() add_subdirectory(3rdparty/lzma EXCLUDE_FROM_ALL) add_subdirectory(3rdparty/libchdr EXCLUDE_FROM_ALL) +add_subdirectory(3rdparty/soundtouch EXCLUDE_FROM_ALL) # rapidyaml includes fast_float as a submodule, saves us pulling it in directly. # Normally, we'd just pull in the cmake project, and link to it, but... it seems to enable diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index a716b89260..6de650ed67 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -1179,7 +1179,7 @@ target_link_libraries(PCSX2_FLAGS INTERFACE cpuinfo zydis ZLIB::ZLIB - PkgConfig::SOUNDTOUCH + SoundTouch::SoundTouch PNG::PNG LibLZMA::LibLZMA Zstd::Zstd