From 02cffbe4ad23c0b25d0e2c466c1d8f9cbb926e20 Mon Sep 17 00:00:00 2001 From: Hirek193 Date: Wed, 6 May 2026 20:02:00 +0200 Subject: [PATCH] Enable AVX2 support --- CMakeLists.txt | 11 ++++++++++- stdafx.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8806a7dc..28436635 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,6 +81,7 @@ option(WITH_BETTER_RENDERER "Experimental multi-backend renderer based on NVRHI" option(GENERATE_PDB "Generate executable with program debugging symbols" ON) option(ENABLE_MCC "Enable multicore compilation" ON) option(WITHDUMPGEN "Enable generating DMP files on crash" ON) +option(ENABLE_AVX2 "Enable AVX2 instruction set (requires AVX2-capable CPU, Haswell/2013 or newer)" ON) set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) @@ -508,7 +509,6 @@ else() target_compile_definitions(${PROJECT_NAME} PUBLIC WITH_DISCORD_RPC=0) endif() - find_package(OpenAL REQUIRED) if (TARGET OpenAL::OpenAL) target_link_libraries(${PROJECT_NAME} OpenAL::OpenAL) @@ -582,4 +582,13 @@ endif() if(ENABLE_MCC AND MSVC) message(STATUS "Enabling multi-processor compilation for MSVC.") add_compile_options(/MP) +endif() + +if(ENABLE_AVX2) + message(STATUS "Enabling AVX2 instruction set.") + if (MSVC) + target_compile_options(${PROJECT_NAME} PRIVATE /arch:AVX2) + else() + target_compile_options(${PROJECT_NAME} PRIVATE -mavx2) + endif() endif() \ No newline at end of file diff --git a/stdafx.h b/stdafx.h index 8138b138..73340a69 100644 --- a/stdafx.h +++ b/stdafx.h @@ -93,6 +93,8 @@ #define GLM_FORCE_SWIZZLE #define GLM_ENABLE_EXPERIMENTAL #define GLM_FORCE_CTOR_INIT +#define GLM_FORCE_INLINE +#define GLM_FORCE_INTRINSICS #include #include #include