CMakeLists: build for x86-64-v3 by default
Some checks failed
Build / Linux (static) (push) Has been cancelled
Build / Windows (push) Has been cancelled
Build / Web (WASM) (push) Has been cancelled
Build / Deploy to GitHub Pages (push) Has been cancelled

This commit is contained in:
2026-04-09 15:42:52 +02:00
parent d54fe997e5
commit 0835fe1183
2 changed files with 10 additions and 4 deletions

View File

@@ -180,11 +180,17 @@ if(EMSCRIPTEN)
else()
# ── Native Build ─────────────────────────────────────────────────────────
option(NATIVE_BUILD "Optimize for the host CPU (-march=native)" OFF)
if(MSVC)
set(CMAKE_CXX_FLAGS_RELEASE "/O2 /DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "/O2 /DNDEBUG /arch:AVX2")
set(CMAKE_CXX_FLAGS_DEBUG "/Zi /Od")
else()
if(NATIVE_BUILD)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -DNDEBUG")
else()
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=x86-64-v3 -DNDEBUG")
endif()
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -fsanitize=address,undefined")
endif()

View File

@@ -53,7 +53,7 @@ You can find the Web version here, delivered in 870 kB: https://ericek111.github
# Install dependencies (Debian/Ubuntu)
sudo apt install build-essential cmake pkg-config libsdl2-dev libfftw3-dev libsndfile1-dev libgl-dev
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake -B build -DCMAKE_BUILD_TYPE=Release -DNATIVE_BUILD=ON
cmake --build build -j$(nproc)
```
@@ -62,7 +62,7 @@ cmake --build build -j$(nproc)
```powershell
vcpkg install sdl2 fftw3 "libsndfile[core]" --triplet x64-windows
cmake -B build -DCMAKE_BUILD_TYPE=Release `
cmake -B build -DCMAKE_BUILD_TYPE=Release -DNATIVE_BUILD=ON `
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" `
-DVCPKG_TARGET_TRIPLET=x64-windows
cmake --build build --config Release