Skip to content

Commit ab4ce8d

Browse files
committed
Move to Options files and update build.yml
1 parent 7764fd2 commit ab4ce8d

File tree

5 files changed

+47
-19
lines changed

5 files changed

+47
-19
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# The "official" binaries are built with Clang 13 on all platforms, and are linked against libc++
44
# on Linux.
55
#
6-
# We set CMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF here to reduce build time.
6+
# We set MUJOCO_ENABLE_IPO=OFF here to reduce build time.
77
# It is highly recommended that this is set to ON for production builds.
88

99
name: build
@@ -175,7 +175,7 @@ jobs:
175175
cd build &&
176176
cmake ..
177177
-DCMAKE_BUILD_TYPE:STRING=Release
178-
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=OFF
178+
-DMUJOCO_ENABLE_IPO:BOOL=OFF
179179
-DCMAKE_INSTALL_PREFIX:STRING=${{ matrix.tmpdir }}/mujoco_install
180180
-DMUJOCO_BUILD_EXAMPLES:BOOL=OFF
181181
${{ matrix.cmake_args }}
@@ -220,7 +220,7 @@ jobs:
220220
cd build &&
221221
cmake ..
222222
-DCMAKE_BUILD_TYPE:STRING=Release
223-
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=OFF
223+
-DMUJOCO_ENABLE_IPO:BOOL=OFF
224224
-Dmujoco_ROOT:STRING=${{ matrix.tmpdir }}/mujoco_install
225225
${{ matrix.cmake_args }}
226226
- name: Build samples
@@ -233,7 +233,7 @@ jobs:
233233
cd build &&
234234
cmake ..
235235
-DCMAKE_BUILD_TYPE:STRING=Release
236-
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=OFF
236+
-DMUJOCO_ENABLE_IPO:BOOL=OFF
237237
-Dmujoco_ROOT:STRING=${{ matrix.tmpdir }}/mujoco_install
238238
${{ matrix.cmake_args }}
239239
- name: Build simulate
@@ -253,7 +253,7 @@ jobs:
253253
source ${{ matrix.tmpdir }}/venv/bin/activate &&
254254
MUJOCO_PATH="${{ matrix.tmpdir }}/mujoco_install"
255255
MUJOCO_PLUGIN_PATH="${{ matrix.tmpdir }}/mujoco_install/mujoco_plugin"
256-
MUJOCO_CMAKE_ARGS="-DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=OFF ${{ matrix.cmake_args }}"
256+
MUJOCO_CMAKE_ARGS="-DMUJOCO_ENABLE_IPO:BOOL=OFF ${{ matrix.cmake_args }}"
257257
pip wheel -v --no-deps mujoco-*.tar.gz
258258
- name: Install Python bindings
259259
if: ${{ runner.os != 'Windows' }}

CMakeLists.txt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,6 @@ option(MUJOCO_BUILD_TESTS "Build tests for MuJoCo" ON)
4545
option(MUJOCO_TEST_PYTHON_UTIL "Build and test utility libraries for Python bindings" ON)
4646
option(MUJOCO_WITH_USD "Build with OpenUSD" OFF)
4747

48-
# Enable inter-procedural optimizations by default on release builds.
49-
if(CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
50-
set(MUJOCO_ENABLE_IPO_DEFAULT ON)
51-
else()
52-
set(MUJOCO_ENABLE_IPO_DEFAULT OFF)
53-
endif()
54-
option(MUJOCO_ENABLE_IPO, "Enable inter-procedural optimization (IPO)" ${MUJOCO_ENABLE_IPO_DEFAULT})
55-
56-
# IPO is disabled by default. If it's enabled here, it was explicitly enabled. MUJOCO_ENABLE_IPO should be used instead.
57-
if (CMAKE_INTERPROCEDURAL_OPTIMIZATION)
58-
message(WARNING "Setting CMAKE_INTERPROCEDURAL_OPTIMIZATION has no effect! Use MUJOCO_ENABLE_IPO.")
59-
endif()
60-
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION, ${MUJOCO_ENABLE_IPO})
61-
6248
# Option to provide a path to an existing USD build directory or to Houdini HFS directory.
6349
set(USD_DIR "" CACHE PATH "Path to an existing USD build directory.")
6450
set(HOUDINI_HFS_DIR "" CACHE PATH "Path to Houdini HFS directory to build USD plugins against.")

cmake/MujocoOptions.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,20 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang
104104
endif()
105105
endif()
106106

107+
# Enable inter-procedural optimizations by default on release builds.
108+
if(CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
109+
set(MUJOCO_ENABLE_IPO_DEFAULT ON)
110+
else()
111+
set(MUJOCO_ENABLE_IPO_DEFAULT OFF)
112+
endif()
113+
option(MUJOCO_ENABLE_IPO, "Enable inter-procedural optimization (IPO)" ${MUJOCO_ENABLE_IPO_DEFAULT})
114+
115+
# IPO is disabled by default. If it's enabled here, it was explicitly enabled. MUJOCO_ENABLE_IPO should be used instead.
116+
if (CMAKE_INTERPROCEDURAL_OPTIMIZATION)
117+
message(FATAL_ERROR "Setting CMAKE_INTERPROCEDURAL_OPTIMIZATION has no effect! Use MUJOCO_ENABLE_IPO.")
118+
endif()
119+
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION, ${MUJOCO_ENABLE_IPO})
120+
107121
include(MujocoHarden)
108122
set(EXTRA_COMPILE_OPTIONS ${EXTRA_COMPILE_OPTIONS} ${MUJOCO_HARDEN_COMPILE_OPTIONS})
109123
set(EXTRA_LINK_OPTIONS ${EXTRA_LINK_OPTIONS} ${MUJOCO_HARDEN_LINK_OPTIONS})

sample/cmake/SampleOptions.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,20 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang
104104
endif()
105105
endif()
106106

107+
# Enable inter-procedural optimizations by default on release builds.
108+
if(CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
109+
set(MUJOCO_ENABLE_IPO_DEFAULT ON)
110+
else()
111+
set(MUJOCO_ENABLE_IPO_DEFAULT OFF)
112+
endif()
113+
option(MUJOCO_ENABLE_IPO, "Enable inter-procedural optimization (IPO)" ${MUJOCO_ENABLE_IPO_DEFAULT})
114+
115+
# IPO is disabled by default. If it's enabled here, it was explicitly enabled. MUJOCO_ENABLE_IPO should be used instead.
116+
if (CMAKE_INTERPROCEDURAL_OPTIMIZATION)
117+
message(FATAL_ERROR "Setting CMAKE_INTERPROCEDURAL_OPTIMIZATION has no effect! Use MUJOCO_ENABLE_IPO.")
118+
endif()
119+
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION, ${MUJOCO_ENABLE_IPO})
120+
107121
include(MujocoHarden)
108122
set(EXTRA_COMPILE_OPTIONS ${EXTRA_COMPILE_OPTIONS} ${MUJOCO_HARDEN_COMPILE_OPTIONS})
109123
set(EXTRA_LINK_OPTIONS ${EXTRA_LINK_OPTIONS} ${MUJOCO_HARDEN_LINK_OPTIONS})

simulate/cmake/SimulateOptions.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,20 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang
104104
endif()
105105
endif()
106106

107+
# Enable inter-procedural optimizations by default on release builds.
108+
if(CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
109+
set(MUJOCO_ENABLE_IPO_DEFAULT ON)
110+
else()
111+
set(MUJOCO_ENABLE_IPO_DEFAULT OFF)
112+
endif()
113+
option(MUJOCO_ENABLE_IPO, "Enable inter-procedural optimization (IPO)" ${MUJOCO_ENABLE_IPO_DEFAULT})
114+
115+
# IPO is disabled by default. If it's enabled here, it was explicitly enabled. MUJOCO_ENABLE_IPO should be used instead.
116+
if (CMAKE_INTERPROCEDURAL_OPTIMIZATION)
117+
message(FATAL_ERROR "Setting CMAKE_INTERPROCEDURAL_OPTIMIZATION has no effect! Use MUJOCO_ENABLE_IPO.")
118+
endif()
119+
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION, ${MUJOCO_ENABLE_IPO})
120+
107121
include(MujocoHarden)
108122
set(EXTRA_COMPILE_OPTIONS ${EXTRA_COMPILE_OPTIONS} ${MUJOCO_HARDEN_COMPILE_OPTIONS})
109123
set(EXTRA_LINK_OPTIONS ${EXTRA_LINK_OPTIONS} ${MUJOCO_HARDEN_LINK_OPTIONS})

0 commit comments

Comments
 (0)