Fix various MuJoCo Studio build issues on Windows, MacOS and Linux

PiperOrigin-RevId: 833313973
Change-Id: I7ec181374e0bb49c32420d025044c31f6fc3c657
This commit is contained in:
Matija Kecman
2025-11-17 06:34:43 -08:00
committed by Copybara-Service
parent a66cf303f8
commit 8eca9926dc
16 changed files with 108 additions and 67 deletions
+16 -4
View File
@@ -47,6 +47,13 @@ target_compile_definitions(${MUJOCO_STUDIO_TARGET_NAME}
-D${MUJOCO_STUDIO_RENDER_CONFIG}
)
if (WIN32)
target_compile_definitions(${MUJOCO_STUDIO_TARGET_NAME}
PRIVATE
-D_USE_MATH_DEFINES
)
endif()
include(third_party_deps/dear_imgui)
include(third_party_deps/implot)
target_link_libraries(${MUJOCO_STUDIO_TARGET_NAME}
@@ -63,13 +70,18 @@ target_link_libraries(${MUJOCO_STUDIO_TARGET_NAME}
# Filament backend requires additional files to be copied into an "assets" folder.
if(MUJOCO_USE_FILAMENT)
if(WIN32)
# Copy to work around lack of symlink permissions on Windows.
set(COPY_COMMAND copy_directory)
else()
set(COPY_COMMAND create_symlink)
endif()
add_custom_command(
TARGET ${MUJOCO_STUDIO_TARGET_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
-E create_symlink
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/../src/experimental/filament/assets
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/assets
COMMAND ${CMAKE_COMMAND} -E ${COPY_COMMAND}
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/../src/experimental/filament/assets
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/assets
COMMENT "Copying Filament assets to build directory"
)
endif()
+2 -2
View File
@@ -176,8 +176,8 @@ void App::OnModelLoaded(std::string_view model_file) {
window_->SetTitle("MuJoCo Studio : " + std::string(model_file));
tmp_.last_load_file = std::string(model_file_);
std::filesystem::path path(model_file_);
base_path = std::string(path.parent_path()) + "/";
model_name = std::string(path.stem());
base_path = path.parent_path().string() + "/";
model_name = path.stem().string();
} else {
window_->SetTitle("MuJoCo Studio");
tmp_.last_load_file = base_path;