[Beignet] [PATCH 7/8] Make EGL optional

Zhigang Gong zhigang.gong at linux.intel.com
Wed Apr 17 00:51:58 PDT 2013


From: Simon Richter <Simon.Richter at hogyros.de>

This fixes builds if EGL is unavailable. The OpenGL sharing extension will
be disabled then.

Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
 src/CMakeLists.txt      | 5 ++++-
 utests/utest_helper.hpp | 8 ++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2d15b90..2f590c6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -32,6 +32,9 @@ if (EGL_FOUND)
 set (OPENCL_SRC ${OPENCL_SRC} cl_mem_gl.c cl_gl_api.c x11/gbm_dri2_x11_platform.c)
 SET(CMAKE_CXX_FLAGS "-DHAS_EGL ${CMAKE_CXX_FLAGS}")
 SET(CMAKE_C_FLAGS "-DHAS_EGL ${CMAKE_C_FLAGS}")
+SET(OPTIONAL_EGL_LIBRARY "${EGL_LIBRARY}")
+else(EGL_FOUND)
+SET(OPTIONAL_EGL_LIBRARY "")
 endif (EGL_FOUND)
 
 if (OCLIcd_FOUND)
@@ -53,6 +56,6 @@ target_link_libraries(
                       ${DRM_INTEL_LIBRARY}
                       ${DRM_LIBRARY}
                       ${OPENGL_LIBRARIES}
-                      ${EGL_LIBRARY}
+                      ${OPTIONAL_EGL_LIBRARY}
                       ${GBM_LIBRARY})
 install (TARGETS cl LIBRARY DESTINATION lib)
diff --git a/utests/utest_helper.hpp b/utests/utest_helper.hpp
index b52174d..02249e1 100644
--- a/utests/utest_helper.hpp
+++ b/utests/utest_helper.hpp
@@ -41,6 +41,10 @@
 #include  <EGL/egl.h>
 #include  <EGL/eglext.h>
 #include <CL/cl_gl.h>
+
+extern EGLDisplay  eglDisplay;
+extern EGLContext  eglContext;
+extern EGLSurface  eglSurface;
 #endif
 
 #define OCL_THROW_ERROR(FN, STATUS) \
@@ -128,10 +132,6 @@ extern cl_mem buf[MAX_BUFFER_N];
 extern void* buf_data[MAX_BUFFER_N];
 extern size_t globals[3];
 extern size_t locals[3];
-extern Display    *xDisplay;
-extern EGLDisplay  eglDisplay;
-extern EGLSurface  eglSurface;
-
 
 enum {
   SOURCE = 0,
-- 
1.7.11.7



More information about the Beignet mailing list