build: Add option to use SSE2 on 32-bit x86, and enable by default.

Fixes/works around a float comparison test failure in input transform.
This commit is contained in:
Ryan Pavlik 2023-03-02 16:46:05 -06:00
parent 172a5baf23
commit cb65c4f236
2 changed files with 10 additions and 2 deletions

View file

@ -1,4 +1,4 @@
# Copyright 2018-2022, Collabora, Ltd. # Copyright 2018-2023, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0 # SPDX-License-Identifier: BSL-1.0
cmake_minimum_required(VERSION 3.10.2) 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_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_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_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) if (XRT_FEATURE_SERVICE)
# Disable the client debug gui by default for out-of-proc - # Disable the client debug gui by default for out-of-proc -

View file

@ -1,4 +1,4 @@
# Copyright 2018-2021, Collabora, Ltd. # Copyright 2018-2023, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0 # SPDX-License-Identifier: BSL-1.0
if(NOT MSVC) if(NOT MSVC)
@ -8,6 +8,13 @@ if(NOT MSVC)
) )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=int-conversion") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=int-conversion")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Wno-unused-parameter") 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() endif()
if(NOT WIN32) if(NOT WIN32)