PiperOrigin-RevId: 950629900 Change-Id: If4b3755f0e8653efbd9e6a4134140dd96b1f743d
This commit is contained in:
committed by
Copybara-Service
parent
3990305373
commit
6f487086a5
@@ -108,13 +108,16 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Enable interprocedural optimization (LTO) by default for non-Debug builds, but
|
# Provide a user-facing option to control Link-Time Optimization (LTO/IPO).
|
||||||
# only when the caller has not made an explicit choice. Checking the value (rather
|
# When ON (the default), LTO is enabled for non-Debug builds unless the caller
|
||||||
# than whether it is DEFINED) meant an explicit `-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF`
|
# has already set CMAKE_INTERPROCEDURAL_OPTIMIZATION explicitly.
|
||||||
# was silently overridden back to ON, e.g. in CI where LTO is disabled to cut
|
# Users can disable LTO entirely with -DMUJOCO_ENABLE_LTO=OFF.
|
||||||
# build time.
|
option(MUJOCO_ENABLE_LTO "Enable Link-Time Optimization (LTO) for non-Debug builds." ON)
|
||||||
if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION AND (CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug"))
|
|
||||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
|
if(MUJOCO_ENABLE_LTO)
|
||||||
|
if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION AND (CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug"))
|
||||||
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(MujocoHarden)
|
include(MujocoHarden)
|
||||||
|
|||||||
@@ -108,13 +108,16 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Enable interprocedural optimization (LTO) by default for non-Debug builds, but
|
# Provide a user-facing option to control Link-Time Optimization (LTO/IPO).
|
||||||
# only when the caller has not made an explicit choice. Checking the value (rather
|
# When ON (the default), LTO is enabled for non-Debug builds unless the caller
|
||||||
# than whether it is DEFINED) meant an explicit `-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF`
|
# has already set CMAKE_INTERPROCEDURAL_OPTIMIZATION explicitly.
|
||||||
# was silently overridden back to ON, e.g. in CI where LTO is disabled to cut
|
# Users can disable LTO entirely with -DMUJOCO_ENABLE_LTO=OFF.
|
||||||
# build time.
|
option(MUJOCO_ENABLE_LTO "Enable Link-Time Optimization (LTO) for non-Debug builds." ON)
|
||||||
if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION AND (CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug"))
|
|
||||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
|
if(MUJOCO_ENABLE_LTO)
|
||||||
|
if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION AND (CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug"))
|
||||||
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(MujocoHarden)
|
include(MujocoHarden)
|
||||||
|
|||||||
@@ -108,13 +108,16 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Enable interprocedural optimization (LTO) by default for non-Debug builds, but
|
# Provide a user-facing option to control Link-Time Optimization (LTO/IPO).
|
||||||
# only when the caller has not made an explicit choice. Checking the value (rather
|
# When ON (the default), LTO is enabled for non-Debug builds unless the caller
|
||||||
# than whether it is DEFINED) meant an explicit `-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF`
|
# has already set CMAKE_INTERPROCEDURAL_OPTIMIZATION explicitly.
|
||||||
# was silently overridden back to ON, e.g. in CI where LTO is disabled to cut
|
# Users can disable LTO entirely with -DMUJOCO_ENABLE_LTO=OFF.
|
||||||
# build time.
|
option(MUJOCO_ENABLE_LTO "Enable Link-Time Optimization (LTO) for non-Debug builds." ON)
|
||||||
if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION AND (CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug"))
|
|
||||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
|
if(MUJOCO_ENABLE_LTO)
|
||||||
|
if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION AND (CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug"))
|
||||||
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(MujocoHarden)
|
include(MujocoHarden)
|
||||||
|
|||||||
+1
-1
@@ -56,7 +56,7 @@ macro(mujoco_test name)
|
|||||||
set_target_properties(${name} PROPERTIES BUILD_RPATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
set_target_properties(${name} PROPERTIES BUILD_RPATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
||||||
# gtest_discover_tests is recommended over gtest_add_tests, but has issues on Windows.
|
# gtest_discover_tests is recommended over gtest_add_tests, but has issues on Windows.
|
||||||
# It also requires a GoogleTest binary, so we fall back for custom MAIN_TARGET (e.g. benchmarks).
|
# It also requires a GoogleTest binary, so we fall back for custom MAIN_TARGET (e.g. benchmarks).
|
||||||
if(WIN32 OR _ARGS_MAIN_TARGET)
|
if(WIN32 OR APPLE OR _ARGS_MAIN_TARGET)
|
||||||
gtest_add_tests(
|
gtest_add_tests(
|
||||||
TARGET ${name}
|
TARGET ${name}
|
||||||
SOURCES ${name}.cc
|
SOURCES ${name}.cc
|
||||||
|
|||||||
Reference in New Issue
Block a user