Skip to content

Commit

Permalink
FetchContent mujoco 3.0.1 if MUJOCO_ROOT_DIR not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanpsingh committed Dec 7, 2023
1 parent 09ab724 commit 446bc9f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,20 @@ project(
VERSION 1.0.0)

if(NOT DEFINED MUJOCO_ROOT_DIR)
message(FATAL_ERROR "Provide MUJOCO_ROOT_DIR")
# FetchContent from CMake >= 3.11
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11")
set(MUJOCO_DOWNLOAD_DIR "$ENV{HOME}/.mujoco/mujoco301")
message(STATUS "MUJOCO_ROOT_DIR is not provided. Will be automatically downloaded to ${MUJOCO_DOWNLOAD_DIR}.")
include(FetchContent)
FetchContent_Declare(mujoco
URL https://github.com/google-deepmind/mujoco/releases/download/3.0.1/mujoco-3.0.1-linux-x86_64.tar.gz
SOURCE_DIR ${MUJOCO_DOWNLOAD_DIR}
)
FetchContent_MakeAvailable(mujoco)
set(MUJOCO_ROOT_DIR "${MUJOCO_DOWNLOAD_DIR}")
else()
message(FATAL_ERROR "MUJOCO_ROOT_DIR is not provided. Download MuJoCo from mujoco.org and provide MUJOCO_ROOT_DIR.")
endif()
endif()

find_package(mc_rtc REQUIRED)
Expand Down

0 comments on commit 446bc9f

Please sign in to comment.