Browse Source

CMake: Fix SSE not being enabled on x86 32bits (#1141)

Fixes #1133
Jérôme Leclercq 1 year ago
parent
commit
ebccdcbfae
1 changed files with 6 additions and 5 deletions
  1. 6 5
      Jolt/Jolt.cmake

+ 6 - 5
Jolt/Jolt.cmake

@@ -616,8 +616,12 @@ else()
 		# XCode builds for multiple architectures, we can't set global flags
 		# XCode builds for multiple architectures, we can't set global flags
 	elseif (CROSS_COMPILE_ARM OR CMAKE_OSX_ARCHITECTURES MATCHES "arm64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
 	elseif (CROSS_COMPILE_ARM OR CMAKE_OSX_ARCHITECTURES MATCHES "arm64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
 		# ARM64 uses no special commandline flags
 		# ARM64 uses no special commandline flags
-	elseif ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64")
-		# x64
+	elseif ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i386")
+		# x86 and x86_64
+  		# On 32-bit builds we need to default to using SSE instructions, the x87 FPU instructions have higher intermediate precision
+		# which will cause problems in the collision detection code (the effect is similar to leaving FMA on, search for
+		# JPH_PRECISE_MATH_ON for the locations where this is a problem).
+  
 		if (USE_AVX512)
 		if (USE_AVX512)
 			target_compile_options(Jolt PUBLIC -mavx512f -mavx512vl -mavx512dq -mavx2 -mbmi -mpopcnt -mlzcnt -mf16c)
 			target_compile_options(Jolt PUBLIC -mavx512f -mavx512vl -mavx512dq -mavx2 -mbmi -mpopcnt -mlzcnt -mf16c)
 		elseif (USE_AVX2)
 		elseif (USE_AVX2)
@@ -644,9 +648,6 @@ else()
 			target_compile_options(Jolt PUBLIC -mfma)
 			target_compile_options(Jolt PUBLIC -mfma)
 		endif()
 		endif()
 
 
-		# On 32-bit builds we need to default to using SSE instructions, the x87 FPU instructions have higher intermediate precision
-		# which will cause problems in the collision detection code (the effect is similar to leaving FMA on, search for
-		# JPH_PRECISE_MATH_ON for the locations where this is a problem).
 		if (NOT MSVC)
 		if (NOT MSVC)
 			target_compile_options(Jolt PUBLIC -mfpmath=sse)
 			target_compile_options(Jolt PUBLIC -mfpmath=sse)
 		endif()
 		endif()