@@ -199,6 +199,42 @@ target_link_libraries(mujoco PUBLIC
199199 ${MJC_PHYSICS_PLUGIN_TARGET_NAME}
200200)
201201
202+ ## ----- Newton USD Schemas (codeless plugin) -----
203+
204+ function (install_newton_usd_plugin install_base_dir )
205+ include (FetchContent )
206+
207+ FetchContent_Declare (
208+ newton-usd-schemas
209+ GIT_REPOSITORY https://github.com/newton-physics/newton-usd-schemas.git
210+ GIT_TAG v0.1.0rc3
211+ GIT_SHALLOW TRUE
212+ UPDATE_DISCONNECTED TRUE
213+ )
214+
215+ FetchContent_GetProperties (newton-usd-schemas)
216+ if (NOT newton-usd-schemas_POPULATED)
217+ FetchContent_Populate (newton-usd-schemas)
218+ endif ()
219+
220+ set (NEWTON_USD_DIR "${newton-usd-schemas_SOURCE_DIR}/newton_usd_schemas" )
221+ if (NOT EXISTS "${NEWTON_USD_DIR} " )
222+ message (FATAL_ERROR "newton_usd_schemas directory not found in fetched repository" )
223+ endif ()
224+
225+ set (NEWTON_BUILD_DIR "${CMAKE_BINARY_DIR} /${install_base_dir} /newton" )
226+ file (MAKE_DIRECTORY "${NEWTON_BUILD_DIR} " )
227+ configure_file ("${NEWTON_USD_DIR} /plugInfo.json" "${NEWTON_BUILD_DIR} /plugInfo.json" COPYONLY )
228+ configure_file ("${NEWTON_USD_DIR} /generatedSchema.usda" "${NEWTON_BUILD_DIR} /generatedSchema.usda" COPYONLY )
229+
230+ install (FILES "${NEWTON_BUILD_DIR} /plugInfo.json"
231+ DESTINATION "${install_base_dir} /newton"
232+ )
233+ install (FILES "${NEWTON_BUILD_DIR} /generatedSchema.usda"
234+ DESTINATION "${install_base_dir} /newton"
235+ )
236+ endfunction ()
237+
202238## Installation
203239
204240# Generate and install plugInfo.json for each plugin
@@ -219,6 +255,10 @@ install(FILES
219255 DESTINATION ${MJ_USD_INSTALL_DIR_LIB} /mjcPhysics
220256)
221257
258+ install_newton_usd_plugin (
259+ ${MJ_USD_INSTALL_DIR_LIB}
260+ )
261+
222262# Install shared libraries
223263install (TARGETS
224264 ${MJCF_PLUGIN_TARGET_NAME}
0 commit comments