diff --git a/src/experimental/platform/egl_utils.cc b/src/experimental/platform/egl_utils.cc index 3125f2f7..a91109ad 100644 --- a/src/experimental/platform/egl_utils.cc +++ b/src/experimental/platform/egl_utils.cc @@ -16,12 +16,17 @@ #include -#include -#include +#if __has_include("third_party/GL/gl/include/EGL/egl.h") + #define MUJOCO_HAS_EGL + #include + #include +#endif #include namespace mujoco::platform { +#ifdef MUJOCO_HAS_EGL + static EGLDisplay CreateInitializedEglDisplay() { auto eglQueryDevicesEXT = (PFNEGLQUERYDEVICESEXTPROC)eglGetProcAddress("eglQueryDevicesEXT"); @@ -136,9 +141,16 @@ struct EglContext { EGLContext context_; }; +#endif // MUJOCO_HAS_EGL + std::shared_ptr CreateEglContext() { + #ifdef MUJOCO_HAS_EGL auto egl_context = std::make_shared(); return std::static_pointer_cast(egl_context); + #else + mju_error("EGL is not supported"); + return nullptr; + #endif } } // namespace mujoco::platform