Pull request changes

This commit is contained in:
Vidur Vij
2025-07-18 12:39:07 -05:00
parent b2300684d8
commit af87c6d7a0
+23 -21
View File
@@ -47,7 +47,7 @@ option(SIMULATE_GLFW_DYNAMIC_SYMBOLS "Whether to resolve GLFW symbols dynamicall
# Check if we are building as standalone project. # Check if we are building as standalone project.
set(SIMULATE_STANDALONE OFF) set(SIMULATE_STANDALONE OFF)
set(_INSTALL_SIMULATE ON) set(_INSTALL_SIMULATE ON)
set(EXPOSE_HEADERS OFF)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(SIMULATE_STANDALONE ON) set(SIMULATE_STANDALONE ON)
# If standalone, do not install the samples. # If standalone, do not install the samples.
@@ -124,12 +124,14 @@ if(SIMULATE_GLFW_DYNAMIC_SYMBOLS)
endif() endif()
add_library(mujoco::platform_ui_adapter ALIAS platform_ui_adapter) add_library(mujoco::platform_ui_adapter ALIAS platform_ui_adapter)
add_library(libsimulate STATIC $<TARGET_OBJECTS:platform_ui_adapter>) add_library(libmujoco_simulate STATIC $<TARGET_OBJECTS:platform_ui_adapter>)
set_target_properties(libsimulate PROPERTIES OUTPUT_NAME simulate) set_target_properties(libmujoco_simulate PROPERTIES OUTPUT_NAME simulate)
add_library(mujoco::libsimulate ALIAS libsimulate) add_library(mujoco::libmujoco_simulate ALIAS libmujoco_simulate)
set_target_properties(libmujoco_simulate PROPERTIES PUBLIC_HEADER "simulate.h;platform_ui_adapter.h;glfw_adapter.h;glfw_dispatch.h;glfw_corevideo.h;array_safety.h")
target_sources( target_sources(
libsimulate libmujoco_simulate
PUBLIC PUBLIC
simulate.h simulate.h
platform_ui_adapter.h platform_ui_adapter.h
@@ -138,14 +140,14 @@ target_sources(
array_safety.h array_safety.h
PRIVATE simulate.cc PRIVATE simulate.cc
) )
target_include_directories(libsimulate PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(libmujoco_simulate PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_options(libsimulate PRIVATE ${MUJOCO_SIMULATE_COMPILE_OPTIONS}) target_compile_options(libmujoco_simulate PRIVATE ${MUJOCO_SIMULATE_COMPILE_OPTIONS})
target_link_libraries(libsimulate PUBLIC lodepng mujoco::platform_ui_adapter mujoco::mujoco) target_link_libraries(libmujoco_simulate PUBLIC lodepng mujoco::platform_ui_adapter mujoco::mujoco)
target_link_options(libsimulate PRIVATE ${MUJOCO_SIMULATE_LINK_OPTIONS}) target_link_options(libmujoco_simulate PRIVATE ${MUJOCO_SIMULATE_LINK_OPTIONS})
if(APPLE) if(APPLE)
target_sources(libsimulate PRIVATE macos_gui.mm) target_sources(libmujoco_simulate PRIVATE macos_gui.mm)
target_link_libraries(libsimulate PUBLIC "-framework Cocoa") target_link_libraries(libmujoco_simulate PUBLIC "-framework Cocoa")
endif() endif()
# Build simulate executable # Build simulate executable
@@ -173,7 +175,7 @@ if(SIMULATE_BUILD_EXECUTABLE)
target_link_libraries( target_link_libraries(
simulate simulate
libsimulate libmujoco_simulate
mujoco::mujoco mujoco::mujoco
glfw glfw
Threads::Threads Threads::Threads
@@ -296,16 +298,16 @@ if(SIMULATE_BUILD_EXECUTABLE)
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT simulate PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT simulate
) )
# Specify public headers for libsimulate # Specify public headers for libmujoco_simulate
if(SIMULATE_EXPOSE_HEADERS)
set_target_properties(libsimulate PROPERTIES PUBLIC_HEADER "simulate.h;platform_ui_adapter.h;glfw_adapter.h;glfw_dispatch.h;glfw_corevideo.h;array_safety.h")
install( install(
TARGETS libsimulate TARGETS libmujoco_simulate
EXPORT ${PROJECT_NAME} EXPORT ${PROJECT_NAME}
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT simulate RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT simulate
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/simulate" COMPONENT simulate LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT simulate
) ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT simulate
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/simulate" COMPONENT simulate
)
endif() endif()
endif() endif()
endif() endif()