Add separate build step for OpenUSD to third_party_deps.
This will fetch and call the build_usd.py build helper for OpenUSD and build within the MuJoCo _deps folder. Simplifying the build process for MuJoCo with USD. Users can still provide their own USD build, but must now do so via pxr_DIR. PiperOrigin-RevId: 846735578 Change-Id: I0da7eb2da6465e2d518084340e762bf370adb6d5
This commit is contained in:
committed by
Copybara-Service
parent
76e0a78b32
commit
9e150fe82c
+18
-20
@@ -54,25 +54,6 @@ if(EMSCRIPTEN)
|
||||
option(MUJOCO_BUILD_TESTS_WASM "Build tests for WASM bindings" ON)
|
||||
endif()
|
||||
|
||||
# Option to provide a path to an existing USD build directory or to Houdini HFS directory.
|
||||
set(USD_DIR "" CACHE PATH "Path to an existing USD build directory.")
|
||||
set(HOUDINI_HFS_DIR "" CACHE PATH "Path to Houdini HFS directory to build USD plugins against.")
|
||||
if(USD_DIR)
|
||||
if(EXISTS "${USD_DIR}")
|
||||
# If the path is provided, set MUJOCO_WITH_USD to ON and add the path to CMAKE_PREFIX_PATH.
|
||||
set(MUJOCO_WITH_USD ON CACHE BOOL "Build with OpenUSD" FORCE)
|
||||
list(PREPEND CMAKE_PREFIX_PATH "${USD_DIR}")
|
||||
message(STATUS "Using custom USD build directory: ${USD_DIR}")
|
||||
else()
|
||||
message(WARNING "Invalid path provided for USD_DIR: ${USD_DIR}")
|
||||
endif()
|
||||
elseif(HOUDINI_HFS_DIR)
|
||||
if(EXISTS "${HOUDINI_HFS_DIR}")
|
||||
set(MUJOCO_WITH_USD ON CACHE BOOL "Build with OpenUSD" FORCE)
|
||||
message(STATUS "Building Mujoco USD against Houdini HFS: ${HOUDINI_HFS_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(APPLE AND (MUJOCO_BUILD_EXAMPLES OR MUJOCO_BUILD_SIMULATE))
|
||||
enable_language(OBJC)
|
||||
enable_language(OBJCXX)
|
||||
@@ -243,7 +224,24 @@ if(MUJOCO_BUILD_EXAMPLES)
|
||||
endif()
|
||||
|
||||
if(MUJOCO_WITH_USD)
|
||||
target_compile_definitions(mujoco PUBLIC mjUSEUSD)
|
||||
include(third_party_deps/openusd)
|
||||
|
||||
get_filename_component(USD_INSTALL_ROOT "${pxr_DIR}/lib" ABSOLUTE)
|
||||
install(
|
||||
DIRECTORY ${USD_INSTALL_ROOT}/
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(mujoco PROPERTIES
|
||||
BUILD_RPATH "${USD_INSTALL_ROOT}"
|
||||
INSTALL_RPATH "@loader_path")
|
||||
elseif(UNIX)
|
||||
set_target_properties(mujoco PROPERTIES
|
||||
BUILD_RPATH "${USD_INSTALL_ROOT}"
|
||||
INSTALL_RPATH "$ORIGIN")
|
||||
endif()
|
||||
|
||||
add_subdirectory(src/experimental/usd)
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user