Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[soundtouch] Fix WASM build by using -O3 instead of -Ofast #37103

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ports/soundtouch/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ vcpkg_from_github(
REF ${VERSION}
SHA512 93f757b2c1abe16be589e0d191e6c0416c5980843bd416cd5cb820b65a705d98081c0fc7ca0d9880af54b5343318262c77ba39a096bb240ceec084e93ceef964
HEAD_REF master
PATCHES
use-o3-emscripten.patch # Upstream PR: https://codeberg.org/soundtouch/soundtouch/pulls/29
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
Expand Down
34 changes: 34 additions & 0 deletions ports/soundtouch/use-o3-emscripten.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From 405c4586d4556982fd5bbddf1c70bc4815465c51 Mon Sep 17 00:00:00 2001
Date: Sat, 2 Mar 2024 23:02:06 +0100
Subject: [PATCH] Use -O3 instead of -Ofast when targeting Emscripten (WASM)

---
CMakeLists.txt | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

Comment on lines +1 to +8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cruft...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is auto-generated by git format-patch. Not really needed indeed, but IMO doesn't hurt either (the file overview is nice to see what a patch does at a glance)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 14f23e8..dabcb9c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,11 +3,16 @@ project(SoundTouch VERSION 2.3.2 LANGUAGES CXX)

include(GNUInstallDirs)

+set(COMPILE_OPTIONS)
+
if(MSVC)
set(COMPILE_DEFINITIONS /O2 /fp:fast)
- set(COMPILE_OPTIONS )
else()
- set(COMPILE_OPTIONS -Ofast)
+ if(EMSCRIPTEN)
+ list(APPEND COMPILE_OPTIONS -O3)
+ else()
+ list(APPEND COMPILE_OPTIONS -Ofast)
+ endif()
Comment on lines +19 to +28
Copy link
Contributor

@dg0yt dg0yt Mar 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this follow the vcpkg toolchain and build type instead of being hardcoded?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess so, but if upstream wants to force optimizations, better to have something that builds 🤷

endif()

#####################
--
2.43.0

2 changes: 1 addition & 1 deletion ports/soundtouch/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "soundtouch",
"version": "2.3.2",
"port-version": 2,
"port-version": 3,
"description": "SoundTouch is an open-source audio processing library for changing the Tempo, Pitch and Playback Rates of audio streams or audio files.",
"homepage": "https://www.surina.net/soundtouch",
"supports": "!uwp",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -8166,7 +8166,7 @@
},
"soundtouch": {
"baseline": "2.3.2",
"port-version": 2
"port-version": 3
},
"soxr": {
"baseline": "0.1.3",
Expand Down
5 changes: 5 additions & 0 deletions versions/s-/soundtouch.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "a30af1c2b397ee59f6c0048c5453ebbdf4626415",
"version": "2.3.2",
"port-version": 3
},
{
"git-tree": "ac2649a7dd79e3a99721c357c744f81b94643a3c",
"version": "2.3.2",
Expand Down
Loading