Simulate: fix MacOS build (still crashes due to GLFW misusage)

This commit is contained in:
Levi Burner
2022-06-02 22:14:08 -04:00
parent ed82f055e8
commit 95510a07d4
2 changed files with 18 additions and 19 deletions
+12 -13
View File
@@ -24,6 +24,18 @@
#include <mujoco/mjxmacro.h>
#include "array_safety.h"
// When launched via an App Bundle on macOS, the working directory is the path to the App Bundle's
// resource directory. This causes files to be saved into the bundle, which is not the desired
// behavior. Instead, we open a save dialog box to ask the user where to put the file.
// Since the dialog box logic needs to be written in Objective-C, we separate it into a different
// source file.
#ifdef __APPLE__
std::string getSavePath(const char* filename);
#else
static std::string getSavePath(const char* filename) {
return filename;
}
#endif
namespace {
namespace mj = ::mujoco;
@@ -1026,19 +1038,6 @@ void uiLayout(mjuiState* state) {
rect[3].height = rect[0].height;
}
// When launched via an App Bundle on macOS, the working directory is the path to the App Bundle's
// resource directory. This causes files to be saved into the bundle, which is not the desired
// behavior. Instead, we open a save dialog box to ask the user where to put the file.
// Since the dialog box logic needs to be written in Objective-C, we separate it into a different
// source file.
#ifdef __APPLE__
std::string getSavePath(const char* filename);
#else
static std::string getSavePath(const char* filename) {
return filename;
}
#endif
// handle UI event
void uiEvent(mjuiState* state) {
mj::Simulate* simulate = (mj::Simulate*)(state->userdata);