Enable MuJoCo Studio build and packaging on Windows.

Also:
- Patched Filament to support building with Clang, so the default MuJoCo build
  mode doesn't need to change. This should probably be upstreamed.
- Added missing Windows deps to MuJoCo Platform CMake config.
- Updated Studio CMake config to fix unresolved symbols issues on Windows.
PiperOrigin-RevId: 934612701
Change-Id: I3a34a5d274e1452c9cfef0e2868f2788b4b0c7e8
This commit is contained in:
Michael Moss
2026-06-18 16:49:49 -07:00
committed by Copybara-Service
parent e7ef6528b7
commit 492585ca7a
4 changed files with 555 additions and 32 deletions
+32 -21
View File
@@ -153,14 +153,13 @@ if(NOT TARGET mujoco::platform)
target_compile_features(mujoco_platform INTERFACE cxx_std_20)
set(PLATFORM_DEPS)
foreach(dep_lib IN ITEMS
set(dep_libs
mujoco_filament
dear_imgui
dear_imgui_stdlib
implot
filament
backend
SDL2
glfw3
image
ktxreader
@@ -181,8 +180,38 @@ if(NOT TARGET mujoco::platform)
basis_encoder
basis_transcoder
zstd
webp
sharpyuv
z
)
set(platform_system_libs)
if(WIN32)
list(APPEND dep_libs SDL2-static)
set(platform_system_libs winmm setupapi version imm32 opengl32)
else()
list(APPEND dep_libs SDL2)
if(UNIX AND NOT APPLE)
set(platform_system_libs pthread dl rt)
elseif(APPLE)
set(platform_system_libs
"-framework Cocoa"
"-framework IOKit"
"-framework Carbon"
"-framework ForceFeedback"
"-framework CoreVideo"
"-framework CoreAudio"
"-framework AudioToolbox"
"-framework Metal"
"-framework GameController"
"-framework CoreHaptics"
"-framework AVFoundation"
"-framework QuartzCore"
)
endif()
endif()
foreach(dep_lib IN LISTS dep_libs)
find_library(DEP_PATH_${dep_lib} ${dep_lib} HINTS ${MUJOCO_PLATFORM_HINTS})
if(DEP_PATH_${dep_lib})
add_library(mujoco::dep::${dep_lib} STATIC IMPORTED GLOBAL)
@@ -194,25 +223,7 @@ if(NOT TARGET mujoco::platform)
endif()
endforeach()
if(UNIX AND NOT APPLE)
list(APPEND PLATFORM_DEPS pthread dl rt)
endif()
if(APPLE)
list(APPEND PLATFORM_DEPS
"-framework Cocoa"
"-framework IOKit"
"-framework Carbon"
"-framework ForceFeedback"
"-framework CoreVideo"
"-framework CoreAudio"
"-framework AudioToolbox"
"-framework Metal"
"-framework GameController"
"-framework CoreHaptics"
"-framework AVFoundation"
"-framework QuartzCore"
)
endif()
list(APPEND PLATFORM_DEPS ${platform_system_libs})
set_target_properties(mujoco_platform PROPERTIES INTERFACE_LINK_LIBRARIES "${PLATFORM_DEPS}")
endif()
@@ -17,26 +17,26 @@ if(NOT TARGET mujoco::platform)
return()
endif()
set(STUDIO_COMMON_LIBS
mujoco::platform
structs_header
structs_wrappers
)
mujoco_pybind11_module(parser parser.cc)
target_link_libraries(parser PRIVATE mujoco::platform structs_header structs_wrappers)
target_link_libraries(parser PRIVATE ${STUDIO_COMMON_LIBS})
mujoco_pybind11_module(native_viewer_cc native_viewer.cc)
target_link_libraries(native_viewer_cc PRIVATE
mujoco::platform
structs_header
)
target_link_libraries(native_viewer_cc PRIVATE ${STUDIO_COMMON_LIBS})
mujoco_pybind11_module(renderer renderer.cc)
target_link_libraries(renderer PRIVATE mujoco::platform structs_header)
target_link_libraries(renderer PRIVATE ${STUDIO_COMMON_LIBS})
mujoco_pybind11_module(ux ux.cc)
target_link_libraries(ux PRIVATE
mujoco::platform
structs_header
)
target_link_libraries(ux PRIVATE ${STUDIO_COMMON_LIBS})
mujoco_pybind11_module(sim sim.cc)
target_link_libraries(sim PRIVATE mujoco::platform structs_header)
target_link_libraries(sim PRIVATE ${STUDIO_COMMON_LIBS})
set(MUJOCO_STUDIO_TARGETS
parser