The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cmake: Fix build flags on MSVC

authored by

Ryan Pavlik and committed by
Jakob Bornecrantz
cd79bef0 f0cc05d0

+39 -2
+26 -2
CompilerFlags.cmake
··· 1 1 # Copyright 2018-2023, Collabora, Ltd. 2 2 # SPDX-License-Identifier: BSL-1.0 3 3 4 - 5 4 # Target used for applying more aggressive optimizations to math-heavy code 6 5 add_library(xrt-optimized-math INTERFACE) 7 6 8 7 if(MSVC) 9 - target_compile_options(xrt-optimized-math INTERFACE $<IF:$<CONFIG:Debug>,/O2,/O3>) 8 + target_compile_options(xrt-optimized-math INTERFACE $<IF:$<CONFIG:Debug>,/O2 /Ob2,/O2 /Ob3>) 10 9 else() 11 10 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra -Wno-unused-parameter") 12 11 set(CMAKE_C_FLAGS ··· 31 30 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") 32 31 set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined") 33 32 endif() 33 + 34 + # Must call before adding targets that will use xrt-optimized-math 35 + macro(xrt_optimized_math_flags) 36 + if(MSVC) 37 + foreach( 38 + FLAGSVAR 39 + CMAKE_CXX_FLAGS_DEBUG 40 + CMAKE_CXX_FLAGS_RELEASE 41 + CMAKE_CXX_FLAGS_RELWITHDEBINFO 42 + CMAKE_CXX_FLAGS_MINSIZEREL 43 + CMAKE_C_FLAGS_DEBUG 44 + CMAKE_C_FLAGS_RELEASE 45 + CMAKE_C_FLAGS_RELWITHDEBINFO 46 + CMAKE_C_FLAGS_MINSIZEREL 47 + ) 48 + 49 + string(REPLACE "/Od" "" ${FLAGSVAR} "${${FLAGSVAR}}") 50 + string(REPLACE "/O1" "" ${FLAGSVAR} "${${FLAGSVAR}}") 51 + string(REPLACE "/O2" "" ${FLAGSVAR} "${${FLAGSVAR}}") 52 + string(REPLACE "/Ob1" "" ${FLAGSVAR} "${${FLAGSVAR}}") 53 + string(REPLACE "/Ob0" "" ${FLAGSVAR} "${${FLAGSVAR}}") 54 + string(REPLACE "/RTC1" "" ${FLAGSVAR} "${${FLAGSVAR}}") 55 + endforeach() 56 + endif() 57 + endmacro()
+7
src/xrt/auxiliary/math/CMakeLists.txt
··· 1 1 # Copyright 2019-2022, Collabora, Ltd. 2 2 # SPDX-License-Identifier: BSL-1.0 3 3 4 + xrt_optimized_math_flags() 5 + 4 6 add_library( 5 7 aux_math STATIC 6 8 m_api.h ··· 43 45 PRIVATE xrt-optimized-math 44 46 ) 45 47 target_include_directories(aux_math SYSTEM PRIVATE ${EIGEN3_INCLUDE_DIR}) 48 + 49 + if(MSVC) 50 + get_target_property(options aux_math COMPILE_OPTIONS) 51 + message(STATUS "COMPILE_OPTIONS: ${options}") 52 + endif()
+2
src/xrt/auxiliary/tracking/CMakeLists.txt
··· 1 1 # Copyright 2019-2022, Collabora, Ltd. 2 2 # SPDX-License-Identifier: BSL-1.0 3 3 4 + xrt_optimized_math_flags() 5 + 4 6 add_library( 5 7 aux_tracking STATIC 6 8 t_data_utils.c
+2
src/xrt/tracking/hand/mercury/CMakeLists.txt
··· 5 5 6 6 add_subdirectory(kine_lm) 7 7 8 + xrt_optimized_math_flags() 9 + 8 10 # t_ht_mercury_model 9 11 add_library(t_ht_mercury_model STATIC hg_model.cpp) 10 12
+2
src/xrt/tracking/hand/mercury/kine_lm/CMakeLists.txt
··· 1 1 # Copyright 2022-2023, Collabora, Ltd. 2 2 # SPDX-License-Identifier: BSL-1.0 3 3 4 + xrt_optimized_math_flags() 5 + 4 6 add_library( 5 7 t_ht_mercury_kine_lm STATIC lm_interface.hpp lm_main.cpp lm_hand_init_guesser.hpp 6 8 lm_hand_init_guesser.cpp