From 144a8a9e8562d142050133fb3eb283c166555c00 Mon Sep 17 00:00:00 2001 From: Haroon Qureshi Date: Tue, 3 Feb 2026 15:07:43 -0800 Subject: [PATCH] Make EGL utils conditional on EGL.h. PiperOrigin-RevId: 865064686 Change-Id: I3728de6e49e4c36d76b410c2458767f74df069c9 --- src/experimental/platform/egl_utils.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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