Merge pull request #2713 from vidurvij-apptronik:vidur/remove-installing-glfw3-headers
PiperOrigin-RevId: 808125077 Change-Id: If87b65d2d8607f153dfd66fbfa9a6ca39c98845f
This commit is contained in:
@@ -454,7 +454,8 @@ mujoco_pybind11_module(_simulate simulate.cc)
|
|||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
_simulate
|
_simulate
|
||||||
PRIVATE mujoco
|
PRIVATE mujoco
|
||||||
mujoco::libsimulate
|
mujoco::libmujoco_simulate
|
||||||
|
glfw
|
||||||
errors_header
|
errors_header
|
||||||
raw
|
raw
|
||||||
structs_header
|
structs_header
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ if(MUJOCO_EXTRAS_STATIC_GLFW)
|
|||||||
unset(BUILD_SHARED_LIBS_OLD)
|
unset(BUILD_SHARED_LIBS_OLD)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT SAMPLE_STANDALONE)
|
if(NOT SAMPLE_STANDALONE AND NOT MUJOCO_SAMPLES_USE_SYSTEM_GLFW)
|
||||||
target_compile_options(glfw PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS})
|
target_compile_options(glfw PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS})
|
||||||
target_link_options(glfw PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS})
|
target_link_options(glfw PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS})
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
+48
-26
@@ -47,6 +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)
|
||||||
|
|
||||||
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.
|
||||||
@@ -93,7 +94,7 @@ if(NOT TARGET lodepng)
|
|||||||
# This is not a CMake project.
|
# This is not a CMake project.
|
||||||
set(LODEPNG_SRCS ${lodepng_SOURCE_DIR}/lodepng.cpp)
|
set(LODEPNG_SRCS ${lodepng_SOURCE_DIR}/lodepng.cpp)
|
||||||
set(LODEPNG_HEADERS ${lodepng_SOURCE_DIR}/lodepng.h)
|
set(LODEPNG_HEADERS ${lodepng_SOURCE_DIR}/lodepng.h)
|
||||||
add_library(lodepng STATIC ${LODEPNG_HEADERS} ${LODEPNG_SRCS})
|
add_library(lodepng OBJECT ${LODEPNG_HEADERS} ${LODEPNG_SRCS})
|
||||||
target_compile_options(lodepng PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS})
|
target_compile_options(lodepng PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS})
|
||||||
target_link_options(lodepng PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS})
|
target_link_options(lodepng PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS})
|
||||||
target_include_directories(lodepng PUBLIC ${lodepng_SOURCE_DIR})
|
target_include_directories(lodepng PUBLIC ${lodepng_SOURCE_DIR})
|
||||||
@@ -114,7 +115,7 @@ if(APPLE)
|
|||||||
target_link_libraries(platform_ui_adapter PUBLIC "-framework CoreVideo")
|
target_link_libraries(platform_ui_adapter PUBLIC "-framework CoreVideo")
|
||||||
endif()
|
endif()
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
platform_ui_adapter PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
platform_ui_adapter PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
$<TARGET_PROPERTY:glfw,INTERFACE_INCLUDE_DIRECTORIES>
|
$<TARGET_PROPERTY:glfw,INTERFACE_INCLUDE_DIRECTORIES>
|
||||||
)
|
)
|
||||||
target_link_libraries(platform_ui_adapter PUBLIC mujoco::mujoco)
|
target_link_libraries(platform_ui_adapter PUBLIC mujoco::mujoco)
|
||||||
@@ -123,23 +124,30 @@ 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> $<TARGET_OBJECTS:lodepng>)
|
||||||
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 simulate.h
|
PRIVATE simulate.cc
|
||||||
PRIVATE simulate.cc array_safety.h
|
|
||||||
)
|
)
|
||||||
target_include_directories(libsimulate PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(libmujoco_simulate
|
||||||
target_compile_options(libsimulate PRIVATE ${MUJOCO_SIMULATE_COMPILE_OPTIONS})
|
PUBLIC
|
||||||
target_link_libraries(libsimulate PUBLIC lodepng mujoco::platform_ui_adapter mujoco::mujoco)
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
target_link_options(libsimulate PRIVATE ${MUJOCO_SIMULATE_LINK_OPTIONS})
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/simulate>
|
||||||
|
PRIVATE
|
||||||
|
${lodepng_SOURCE_DIR}
|
||||||
|
)
|
||||||
|
target_compile_options(libmujoco_simulate PRIVATE ${MUJOCO_SIMULATE_COMPILE_OPTIONS})
|
||||||
|
target_link_libraries(libmujoco_simulate PUBLIC mujoco::mujoco)
|
||||||
|
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
|
||||||
@@ -167,13 +175,16 @@ 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
|
||||||
lodepng
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
target_link_libraries(simulate "-framework CoreVideo")
|
||||||
|
endif()
|
||||||
|
|
||||||
if (MUJOCO_WITH_USD)
|
if (MUJOCO_WITH_USD)
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
simulate
|
simulate
|
||||||
@@ -263,16 +274,6 @@ if(SIMULATE_BUILD_EXECUTABLE)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(
|
|
||||||
TARGETS simulate
|
|
||||||
EXPORT ${PROJECT_NAME}
|
|
||||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT simulate
|
|
||||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT simulate
|
|
||||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT simulate
|
|
||||||
BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT simulate
|
|
||||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT simulate
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT MUJOCO_SIMULATE_USE_SYSTEM_GLFW)
|
if(NOT MUJOCO_SIMULATE_USE_SYSTEM_GLFW)
|
||||||
# We downloaded GLFW. Depending if it is a static or shared LIBRARY we might
|
# We downloaded GLFW. Depending if it is a static or shared LIBRARY we might
|
||||||
# need to install it.
|
# need to install it.
|
||||||
@@ -288,5 +289,26 @@ if(SIMULATE_BUILD_EXECUTABLE)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
install(
|
||||||
|
TARGETS simulate
|
||||||
|
EXPORT ${PROJECT_NAME}
|
||||||
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT simulate
|
||||||
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT simulate
|
||||||
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT simulate
|
||||||
|
BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT simulate
|
||||||
|
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT simulate
|
||||||
|
)
|
||||||
|
|
||||||
|
# Specify public headers for libmujoco_simulate
|
||||||
|
|
||||||
|
install(
|
||||||
|
TARGETS libmujoco_simulate
|
||||||
|
EXPORT mujoco
|
||||||
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" 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()
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ if(MUJOCO_EXTRAS_STATIC_GLFW)
|
|||||||
unset(BUILD_SHARED_LIBS_OLD)
|
unset(BUILD_SHARED_LIBS_OLD)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT SIMULATE_STANDALONE)
|
if(NOT SIMULATE_STANDALONE AND NOT MUJOCO_SIMULATE_USE_SYSTEM_GLFW)
|
||||||
target_compile_options(glfw PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS})
|
target_compile_options(glfw PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS})
|
||||||
target_link_options(glfw PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS})
|
target_link_options(glfw PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS})
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
Reference in New Issue
Block a user