Simulate: fixes for windows version
This commit is contained in:
@@ -82,6 +82,7 @@ target_link_options(uitools PRIVATE ${MUJOCO_SIMULATE_LINK_OPTIONS})
|
|||||||
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)
|
||||||
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_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) # TODO is that right
|
target_link_libraries(mjsimulate PUBLIC glfw uitools mujoco::mujoco) # TODO is that right
|
||||||
target_link_options(mjsimulate PRIVATE ${MUJOCO_SIMULATE_LINK_OPTIONS})
|
target_link_options(mjsimulate PRIVATE ${MUJOCO_SIMULATE_LINK_OPTIONS})
|
||||||
@@ -117,7 +118,12 @@ target_link_libraries(
|
|||||||
glfw
|
glfw
|
||||||
Threads::Threads
|
Threads::Threads
|
||||||
)
|
)
|
||||||
target_link_options(simulate PRIVATE ${MUJOCO_SAMPLE_LINK_OPTIONS})
|
|
||||||
|
if(WIN32)
|
||||||
|
target_link_options(simulate PRIVATE ${MUJOCO_SIMULATE_LINK_OPTIONS} /STACK:8000000)
|
||||||
|
else()
|
||||||
|
target_link_options(simulate PRIVATE ${MUJOCO_SIMULATE_LINK_OPTIONS})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
target_sources(simulate PRIVATE macos_save.mm)
|
target_sources(simulate PRIVATE macos_save.mm)
|
||||||
|
|||||||
@@ -1901,6 +1901,12 @@ void Simulate::renderthread(void) {
|
|||||||
this->clearcallback();
|
this->clearcallback();
|
||||||
mjv_freeScene(&this->scn);
|
mjv_freeScene(&this->scn);
|
||||||
mjr_freeContext(&this->con);
|
mjr_freeContext(&this->con);
|
||||||
|
|
||||||
|
// terminate GLFW (crashes with Linux NVidia drivers)
|
||||||
|
// Must call terminate in this thread on Windows with NVidia drivers (Intel is fine)
|
||||||
|
#if defined(__APPLE__) || defined(_WIN32)
|
||||||
|
glfwTerminate();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mujoco
|
} // namespace mujoco
|
||||||
|
|||||||
+14
-1
@@ -20,12 +20,25 @@
|
|||||||
|
|
||||||
#include "uitools.h"
|
#include "uitools.h"
|
||||||
|
|
||||||
|
#ifdef MJSIMULATE_STATIC
|
||||||
|
// static library
|
||||||
|
#define MJSIMULATEAPI
|
||||||
|
#define MJSIMULATELOCAL
|
||||||
|
#else
|
||||||
|
#ifdef MJSIMULATE_DLL_EXPORTS
|
||||||
|
#define MJSIMULATEAPI MUJOCO_HELPER_DLL_EXPORT
|
||||||
|
#else
|
||||||
|
#define MJSIMULATEAPI MUJOCO_HELPER_DLL_IMPORT
|
||||||
|
#endif
|
||||||
|
#define MJSIMULATELOCAL MUJOCO_HELPER_DLL_LOCAL
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace mujoco {
|
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