Link GLFW as a shared library by default
Use one option name to control building GLFW as static/shared since it is not straightforward to set it seperately for the samples and simulate
This commit is contained in:
@@ -58,8 +58,8 @@ findorfetch(
|
|||||||
EXCLUDE_FROM_ALL
|
EXCLUDE_FROM_ALL
|
||||||
)
|
)
|
||||||
|
|
||||||
option(MUJOCO_SAMPLES_STATIC_GLFW "Link MuJoCo sample apps against GLFW statically." ON)
|
option(MUJOCO_EXTRAS_STATIC_GLFW "Link MuJoCo sample apps and simulate libraries against GLFW statically." OFF)
|
||||||
if(MUJOCO_SAMPLES_STATIC_GLFW)
|
if(MUJOCO_EXTRAS_STATIC_GLFW)
|
||||||
set(BUILD_SHARED_LIBS_OLD ${BUILD_SHARED_LIBS})
|
set(BUILD_SHARED_LIBS_OLD ${BUILD_SHARED_LIBS})
|
||||||
set(BUILD_SHARED_LIBS
|
set(BUILD_SHARED_LIBS
|
||||||
OFF
|
OFF
|
||||||
@@ -88,12 +88,12 @@ findorfetch(
|
|||||||
EXCLUDE_FROM_ALL
|
EXCLUDE_FROM_ALL
|
||||||
)
|
)
|
||||||
|
|
||||||
if(MUJOCO_SAMPLES_STATIC_GLFW)
|
if(MUJOCO_EXTRAS_STATIC_GLFW)
|
||||||
set(BUILD_SHARED_LIBS
|
set(BUILD_SHARED_LIBS
|
||||||
${BUILD_SHARED_LIBS_OLD}
|
${BUILD_SHARED_LIBS_OLD}
|
||||||
CACHE BOOL "Build SHARED libraries" FORCE
|
CACHE BOOL "Build SHARED libraries" FORCE
|
||||||
)
|
)
|
||||||
unset(BUILD_SHARED_LIBS_OLD)
|
unset(MUJOCO_EXTRAS_STATIC_GLFW)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT SAMPLE_STANDALONE)
|
if(NOT SAMPLE_STANDALONE)
|
||||||
|
|||||||
+13
-29
@@ -70,30 +70,21 @@ if(MUJOCO_HARDEN)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Utility library
|
|
||||||
#add_library(uitools STATIC)
|
|
||||||
#target_sources(uitools PRIVATE uitools.h uitools.c)
|
|
||||||
#target_include_directories(uitools PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
#target_compile_options(uitools PUBLIC ${MUJOCO_SIMULATE_COMPILE_OPTIONS})
|
|
||||||
#target_link_libraries(uitools PUBLIC glfw mujoco::mujoco)
|
|
||||||
#target_link_options(uitools PRIVATE ${MUJOCO_SIMULATE_LINK_OPTIONS})
|
|
||||||
|
|
||||||
# mjsimulate library
|
# mjsimulate library
|
||||||
#add_library(mjsimulate SHARED)
|
add_library(mjsimulate SHARED)
|
||||||
#target_sources(mjsimulate PUBLIC simulate.h array_safety.h simulate.cc)
|
target_sources(mjsimulate PUBLIC simulate.h array_safety.h simulate.cc uitools.h uitools.c)
|
||||||
#target_include_directories(mjsimulate PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(mjsimulate PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
#target_compile_definitions(mjsimulate PUBLIC MJSIMULATE_DLL_EXPORTS)
|
target_compile_definitions(mjsimulate PUBLIC MJSIMULATE_DLL_EXPORTS)
|
||||||
#target_compile_options(mjsimulate PUBLIC ${MUJOCO_SIMULATE_COMPILE_OPTIONS})
|
target_compile_options(mjsimulate PUBLIC ${MUJOCO_SIMULATE_COMPILE_OPTIONS})
|
||||||
#target_link_libraries(mjsimulate PUBLIC glfw uitools mujoco::mujoco)
|
target_link_libraries(mjsimulate PUBLIC glfw mujoco::mujoco)
|
||||||
#target_link_options(mjsimulate PRIVATE ${MUJOCO_SIMULATE_LINK_OPTIONS})
|
target_link_options(mjsimulate PRIVATE ${MUJOCO_SIMULATE_LINK_OPTIONS})
|
||||||
|
|
||||||
#if(APPLE)
|
if(APPLE)
|
||||||
# target_sources(mjsimulate PRIVATE macos_save.mm)
|
target_sources(mjsimulate PRIVATE macos_save.mm)
|
||||||
# target_link_libraries(mjsimulate PUBLIC "-framework Cocoa")
|
target_link_libraries(mjsimulate PUBLIC "-framework Cocoa")
|
||||||
#endif()
|
endif()
|
||||||
|
|
||||||
# Build samples that require GLFW.
|
|
||||||
|
|
||||||
|
# Build simulate executable
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(SIMULATE_RESOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../dist/mujoco.icns)
|
set(SIMULATE_RESOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../dist/mujoco.icns)
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
@@ -103,8 +94,6 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(simulate main.cc array_safety.h
|
add_executable(simulate main.cc array_safety.h
|
||||||
uitools.h uitools.c
|
|
||||||
simulate.h array_safety.h simulate.cc
|
|
||||||
${SIMULATE_RESOURCE_FILES})
|
${SIMULATE_RESOURCE_FILES})
|
||||||
target_compile_options(simulate PUBLIC ${MUJOCO_SIMULATE_COMPILE_OPTIONS})
|
target_compile_options(simulate PUBLIC ${MUJOCO_SIMULATE_COMPILE_OPTIONS})
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
@@ -120,17 +109,12 @@ endif()
|
|||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
simulate
|
simulate
|
||||||
# mjsimulate
|
mjsimulate
|
||||||
# uitools
|
|
||||||
mujoco::mujoco
|
mujoco::mujoco
|
||||||
glfw
|
glfw
|
||||||
Threads::Threads
|
Threads::Threads
|
||||||
)
|
)
|
||||||
|
|
||||||
if(APPLE)
|
|
||||||
target_sources(simulate PRIVATE macos_save.mm)
|
|
||||||
target_link_libraries(simulate "-framework Cocoa")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_options(simulate PRIVATE ${MUJOCO_SIMULATE_LINK_OPTIONS} /STACK:8000000)
|
target_link_options(simulate PRIVATE ${MUJOCO_SIMULATE_LINK_OPTIONS} /STACK:8000000)
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ findorfetch(
|
|||||||
EXCLUDE_FROM_ALL
|
EXCLUDE_FROM_ALL
|
||||||
)
|
)
|
||||||
|
|
||||||
option(MUJOCO_SIMULATE_STATIC_GLFW "Link MuJoCo simulate library and app against GLFW statically." ON)
|
option(MUJOCO_EXTRAS_STATIC_GLFW "Link MuJoCo sample apps and simulate libraries against GLFW statically." OFF)
|
||||||
if(MUJOCO_SIMULATE_STATIC_GLFW)
|
if(MUJOCO_EXTRAS_STATIC_GLFW)
|
||||||
set(BUILD_SHARED_LIBS_OLD ${BUILD_SHARED_LIBS})
|
set(BUILD_SHARED_LIBS_OLD ${BUILD_SHARED_LIBS})
|
||||||
set(BUILD_SHARED_LIBS
|
set(BUILD_SHARED_LIBS
|
||||||
OFF
|
OFF
|
||||||
@@ -88,7 +88,7 @@ findorfetch(
|
|||||||
EXCLUDE_FROM_ALL
|
EXCLUDE_FROM_ALL
|
||||||
)
|
)
|
||||||
|
|
||||||
if(MUJOCO_SIMULATE_STATIC_GLFW)
|
if(MUJOCO_EXTRAS_STATIC_GLFW)
|
||||||
set(BUILD_SHARED_LIBS
|
set(BUILD_SHARED_LIBS
|
||||||
${BUILD_SHARED_LIBS_OLD}
|
${BUILD_SHARED_LIBS_OLD}
|
||||||
CACHE BOOL "Build SHARED libraries" FORCE
|
CACHE BOOL "Build SHARED libraries" FORCE
|
||||||
|
|||||||
+1
-1
@@ -38,7 +38,7 @@ namespace mujoco {
|
|||||||
//-------------------------------- global -----------------------------------------------
|
//-------------------------------- global -----------------------------------------------
|
||||||
|
|
||||||
// Simulate states not contained in MuJoCo structures
|
// Simulate states not contained in MuJoCo structures
|
||||||
class Simulate {
|
class MJSIMULATEAPI Simulate {
|
||||||
public:
|
public:
|
||||||
// create object and initialize the simulate ui
|
// create object and initialize the simulate ui
|
||||||
Simulate(void);
|
Simulate(void);
|
||||||
|
|||||||
Reference in New Issue
Block a user