diff --git a/CMakeLists.txt b/CMakeLists.txt index 832457d42..a9a60a606 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2018-2022, Collabora, Ltd. +# Copyright 2018-2023, Collabora, Ltd. # SPDX-License-Identifier: BSL-1.0 cmake_minimum_required(VERSION 3.10.2) @@ -255,6 +255,7 @@ option_with_deps(XRT_FEATURE_SLAM "Enable SLAM tracking support" DEPENDS XRT_HAV option_with_deps(XRT_FEATURE_STEAMVR_PLUGIN "Build SteamVR plugin" DEPENDS "NOT ANDROID") option_with_deps(XRT_FEATURE_TRACING "Enable debug tracing on supported platforms" DEFAULT OFF DEPENDS "XRT_HAVE_PERCETTO OR XRT_HAVE_TRACY") option_with_deps(XRT_FEATURE_WINDOW_PEEK "Enable a window that displays the content of the HMD on screen" DEPENDS XRT_HAVE_SDL2) +option(XRT_FEATURE_SSE2 "Build using SSE2 instructions, if building for 32-bit x86" ON) if (XRT_FEATURE_SERVICE) # Disable the client debug gui by default for out-of-proc - diff --git a/CompilerFlags.cmake b/CompilerFlags.cmake index 888416ec9..55647a979 100644 --- a/CompilerFlags.cmake +++ b/CompilerFlags.cmake @@ -1,4 +1,4 @@ -# Copyright 2018-2021, Collabora, Ltd. +# Copyright 2018-2023, Collabora, Ltd. # SPDX-License-Identifier: BSL-1.0 if(NOT MSVC) @@ -8,6 +8,13 @@ if(NOT MSVC) ) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=int-conversion") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Wno-unused-parameter") + + # Use effectively ubiquitous SSE2 instead of x87 floating point + # for increased reliability/consistency + if(CMAKE_SYSTEM_PROCESSOR MATCHES "[xX]86" AND XRT_FEATURE_SSE2) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2 -mfpmath=sse") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2 -mfpmath=sse") + endif() endif() if(NOT WIN32)