From 1c6a90804b2ab573fb9d9d9b4f3618b751af70e7 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sat, 2 Mar 2024 23:02:06 +0100 Subject: [PATCH] Use -O3 instead of -Ofast when targeting Emscripten (WASM) --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 131ea20..38cce02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,11 +3,17 @@ project(SoundTouch VERSION 2.3.3 LANGUAGES CXX) include(GNUInstallDirs) +set(COMPILE_OPTIONS) + if(MSVC) set(COMPILE_DEFINITIONS /O2 /fp:fast) - set(COMPILE_OPTIONS ) else() - set(COMPILE_OPTIONS -Ofast -Wall -Wextra -Wzero-as-null-pointer-constant -Wno-unknown-pragmas) + list(APPEND COMPILE_OPTIONS -Wall -Wextra -Wzero-as-null-pointer-constant -Wno-unknown-pragmas) + if(EMSCRIPTEN) + list(APPEND COMPILE_OPTIONS -O3) + else() + list(APPEND COMPILE_OPTIONS -Ofast) + endif() endif() #####################