Add Python Studio CMake configs and integrate into python build and packaging
PiperOrigin-RevId: 930532579 Change-Id: I2c4b51664475cc8fba92d70d072528843aa03f0c
This commit is contained in:
committed by
Copybara-Service
parent
41ac783d3a
commit
ab17ff5552
@@ -150,6 +150,7 @@ if(NOT TARGET mujoco::platform)
|
|||||||
foreach(dep_lib IN ITEMS
|
foreach(dep_lib IN ITEMS
|
||||||
mujoco_filament
|
mujoco_filament
|
||||||
dear_imgui
|
dear_imgui
|
||||||
|
dear_imgui_stdlib
|
||||||
implot
|
implot
|
||||||
filament
|
filament
|
||||||
backend
|
backend
|
||||||
@@ -178,7 +179,12 @@ if(NOT TARGET mujoco::platform)
|
|||||||
)
|
)
|
||||||
find_library(DEP_PATH_${dep_lib} ${dep_lib} HINTS ${MUJOCO_LIBRARY_DIR})
|
find_library(DEP_PATH_${dep_lib} ${dep_lib} HINTS ${MUJOCO_LIBRARY_DIR})
|
||||||
if(DEP_PATH_${dep_lib})
|
if(DEP_PATH_${dep_lib})
|
||||||
list(APPEND PLATFORM_DEPS "${DEP_PATH_${dep_lib}}")
|
add_library(mujoco::dep::${dep_lib} STATIC IMPORTED GLOBAL)
|
||||||
|
set_target_properties(mujoco::dep::${dep_lib} PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${DEP_PATH_${dep_lib}}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${MUJOCO_INCLUDE}"
|
||||||
|
)
|
||||||
|
list(APPEND PLATFORM_DEPS mujoco::dep::${dep_lib})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
@@ -524,6 +530,8 @@ target_link_libraries(
|
|||||||
structs_header
|
structs_header
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_subdirectory(experimental/studio)
|
||||||
|
|
||||||
set(LIBRARIES_FOR_WHEEL
|
set(LIBRARIES_FOR_WHEEL
|
||||||
"$<TARGET_FILE:_callbacks>"
|
"$<TARGET_FILE:_callbacks>"
|
||||||
"$<TARGET_FILE:_constants>"
|
"$<TARGET_FILE:_constants>"
|
||||||
@@ -538,6 +546,12 @@ set(LIBRARIES_FOR_WHEEL
|
|||||||
"$<TARGET_FILE:mujoco>"
|
"$<TARGET_FILE:mujoco>"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(MUJOCO_STUDIO_TARGETS)
|
||||||
|
foreach(target IN LISTS MUJOCO_STUDIO_TARGETS)
|
||||||
|
list(APPEND LIBRARIES_FOR_WHEEL "$<TARGET_FILE:${target}>")
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
add_executable(mjpython mjpython/mjpython.mm)
|
add_executable(mjpython mjpython/mjpython.mm)
|
||||||
target_include_directories(mjpython PRIVATE "${Python3_INCLUDE_DIRS}")
|
target_include_directories(mjpython PRIVATE "${Python3_INCLUDE_DIRS}")
|
||||||
@@ -573,6 +587,9 @@ if(MUJOCO_PYTHON_MAKE_WHEEL)
|
|||||||
_structs
|
_structs
|
||||||
mujoco
|
mujoco
|
||||||
)
|
)
|
||||||
|
if(MUJOCO_STUDIO_TARGETS)
|
||||||
|
add_dependencies(wheel ${MUJOCO_STUDIO_TARGETS})
|
||||||
|
endif()
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
add_dependencies(wheel mjpython)
|
add_dependencies(wheel mjpython)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
# Copyright 2026 DeepMind Technologies Limited
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
if(NOT TARGET mujoco::platform)
|
||||||
|
message(WARNING "mujoco::platform target not found. experimental/studio bindings will not be built.")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mujoco_pybind11_module(parser parser.cc)
|
||||||
|
target_link_libraries(parser PRIVATE mujoco::platform structs_header structs_wrappers)
|
||||||
|
|
||||||
|
mujoco_pybind11_module(native_viewer_cc native_viewer.cc)
|
||||||
|
target_link_libraries(native_viewer_cc PRIVATE
|
||||||
|
mujoco::platform
|
||||||
|
structs_header
|
||||||
|
)
|
||||||
|
|
||||||
|
mujoco_pybind11_module(renderer renderer.cc)
|
||||||
|
target_link_libraries(renderer PRIVATE mujoco::platform structs_header)
|
||||||
|
|
||||||
|
mujoco_pybind11_module(ux ux.cc)
|
||||||
|
target_link_libraries(ux PRIVATE
|
||||||
|
mujoco::platform
|
||||||
|
structs_header
|
||||||
|
)
|
||||||
|
|
||||||
|
mujoco_pybind11_module(sim sim.cc)
|
||||||
|
target_link_libraries(sim PRIVATE mujoco::platform structs_header)
|
||||||
|
|
||||||
|
set(MUJOCO_STUDIO_TARGETS
|
||||||
|
parser
|
||||||
|
native_viewer_cc
|
||||||
|
renderer
|
||||||
|
ux
|
||||||
|
sim
|
||||||
|
PARENT_SCOPE
|
||||||
|
)
|
||||||
|
|
||||||
|
# dear_imgui bindings
|
||||||
|
mujoco_pybind11_module(dear_imgui ../dear_imgui/dear_imgui.cc)
|
||||||
|
target_link_libraries(dear_imgui PRIVATE
|
||||||
|
mujoco::dep::dear_imgui
|
||||||
|
mujoco::dep::dear_imgui_stdlib
|
||||||
|
)
|
||||||
|
target_include_directories(dear_imgui PRIVATE ../dear_imgui)
|
||||||
|
set_target_properties(dear_imgui PROPERTIES
|
||||||
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../dear_imgui"
|
||||||
|
)
|
||||||
|
|
||||||
|
# implot bindings
|
||||||
|
mujoco_pybind11_module(implot ../implot/implot.cc)
|
||||||
|
target_link_libraries(implot PRIVATE
|
||||||
|
mujoco::dep::implot
|
||||||
|
mujoco::dep::dear_imgui
|
||||||
|
)
|
||||||
|
target_include_directories(implot PRIVATE ../dear_imgui)
|
||||||
|
set_target_properties(implot PROPERTIES
|
||||||
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../implot"
|
||||||
|
)
|
||||||
@@ -382,6 +382,15 @@ setuptools.setup(
|
|||||||
CMakeExtension('mujoco._simulate'),
|
CMakeExtension('mujoco._simulate'),
|
||||||
CMakeExtension('mujoco._specs'),
|
CMakeExtension('mujoco._specs'),
|
||||||
CMakeExtension('mujoco._structs'),
|
CMakeExtension('mujoco._structs'),
|
||||||
|
# Studio extensions
|
||||||
|
CMakeExtension('mujoco.experimental.studio.parser'),
|
||||||
|
CMakeExtension('mujoco.experimental.studio.native_viewer_cc'),
|
||||||
|
CMakeExtension('mujoco.experimental.studio.renderer'),
|
||||||
|
CMakeExtension('mujoco.experimental.studio.ux'),
|
||||||
|
CMakeExtension('mujoco.experimental.studio.sim'),
|
||||||
|
# ImGui/ImPlot extensions
|
||||||
|
CMakeExtension('mujoco.experimental.dear_imgui.dear_imgui'),
|
||||||
|
CMakeExtension('mujoco.experimental.implot.implot'),
|
||||||
],
|
],
|
||||||
scripts=['mujoco/mjpython/mjpython.py']
|
scripts=['mujoco/mjpython/mjpython.py']
|
||||||
if platform.system() == 'Darwin'
|
if platform.system() == 'Darwin'
|
||||||
|
|||||||
Reference in New Issue
Block a user