Make EGL optional
authorSimon Richter <Simon.Richter@hogyros.de>
Tue, 16 Apr 2013 18:04:42 +0000 (20:04 +0200)
committerZhigang Gong <zhigang.gong@linux.intel.com>
Thu, 18 Apr 2013 03:21:29 +0000 (11:21 +0800)
This fixes builds if EGL is unavailable. The OpenGL sharing extension will
be disabled then.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
src/CMakeLists.txt
utests/utest_helper.hpp

index 2d15b90..2f590c6 100644 (file)
@@ -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)
index b52174d..02249e1 100644 (file)
 #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,