mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-28 01:18:31 +00:00
cmake: Fix build flags on MSVC
This commit is contained in:
parent
f0cc05d09b
commit
cd79bef0cf
|
@ -1,12 +1,11 @@
|
|||
# Copyright 2018-2023, Collabora, Ltd.
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
|
||||
# Target used for applying more aggressive optimizations to math-heavy code
|
||||
add_library(xrt-optimized-math INTERFACE)
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(xrt-optimized-math INTERFACE $<IF:$<CONFIG:Debug>,/O2,/O3>)
|
||||
target_compile_options(xrt-optimized-math INTERFACE $<IF:$<CONFIG:Debug>,/O2 /Ob2,/O2 /Ob3>)
|
||||
else()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra -Wno-unused-parameter")
|
||||
set(CMAKE_C_FLAGS
|
||||
|
@ -31,3 +30,28 @@ if(NOT WIN32)
|
|||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined")
|
||||
endif()
|
||||
|
||||
# Must call before adding targets that will use xrt-optimized-math
|
||||
macro(xrt_optimized_math_flags)
|
||||
if(MSVC)
|
||||
foreach(
|
||||
FLAGSVAR
|
||||
CMAKE_CXX_FLAGS_DEBUG
|
||||
CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL
|
||||
CMAKE_C_FLAGS_DEBUG
|
||||
CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_C_FLAGS_MINSIZEREL
|
||||
)
|
||||
|
||||
string(REPLACE "/Od" "" ${FLAGSVAR} "${${FLAGSVAR}}")
|
||||
string(REPLACE "/O1" "" ${FLAGSVAR} "${${FLAGSVAR}}")
|
||||
string(REPLACE "/O2" "" ${FLAGSVAR} "${${FLAGSVAR}}")
|
||||
string(REPLACE "/Ob1" "" ${FLAGSVAR} "${${FLAGSVAR}}")
|
||||
string(REPLACE "/Ob0" "" ${FLAGSVAR} "${${FLAGSVAR}}")
|
||||
string(REPLACE "/RTC1" "" ${FLAGSVAR} "${${FLAGSVAR}}")
|
||||
endforeach()
|
||||
endif()
|
||||
endmacro()
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
# Copyright 2019-2022, Collabora, Ltd.
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
xrt_optimized_math_flags()
|
||||
|
||||
add_library(
|
||||
aux_math STATIC
|
||||
m_api.h
|
||||
|
@ -43,3 +45,8 @@ target_link_libraries(
|
|||
PRIVATE xrt-optimized-math
|
||||
)
|
||||
target_include_directories(aux_math SYSTEM PRIVATE ${EIGEN3_INCLUDE_DIR})
|
||||
|
||||
if(MSVC)
|
||||
get_target_property(options aux_math COMPILE_OPTIONS)
|
||||
message(STATUS "COMPILE_OPTIONS: ${options}")
|
||||
endif()
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
# Copyright 2019-2022, Collabora, Ltd.
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
xrt_optimized_math_flags()
|
||||
|
||||
add_library(
|
||||
aux_tracking STATIC
|
||||
t_data_utils.c
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
add_subdirectory(kine_lm)
|
||||
|
||||
xrt_optimized_math_flags()
|
||||
|
||||
# t_ht_mercury_model
|
||||
add_library(t_ht_mercury_model STATIC hg_model.cpp)
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
# Copyright 2022-2023, Collabora, Ltd.
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
xrt_optimized_math_flags()
|
||||
|
||||
add_library(
|
||||
t_ht_mercury_kine_lm STATIC lm_interface.hpp lm_main.cpp lm_hand_init_guesser.hpp
|
||||
lm_hand_init_guesser.cpp
|
||||
|
|
Loading…
Reference in a new issue