[Beignet] [PATCH] Make libgbm optional without EGL support

Simon Richter Simon.Richter at hogyros.de
Mon May 13 14:07:06 PDT 2013


If EGL or GBM cannot be found, the EGL support is disabled, and then
neither library is required.
---
 src/CMakeLists.txt |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2f590c6..cea78c0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -28,14 +28,16 @@ set(OPENCL_SRC
     x11/dricommon.c 
     x11/va_dri2.c)
 
-if (EGL_FOUND)
+if (EGL_FOUND AND GBM_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_GBM_LIBRARY "${GBM_LIBRARY}")
+else(EGL_FOUND AND GBM_FOUND)
 SET(OPTIONAL_EGL_LIBRARY "")
-endif (EGL_FOUND)
+SET(OPTIONAL_GBM_LIBRARY "")
+endif (EGL_FOUND AND GBM_FOUND)
 
 if (OCLIcd_FOUND)
 set (OPENCL_SRC ${OPENCL_SRC} cl_khr_icd.c)
@@ -57,5 +59,5 @@ target_link_libraries(
                       ${DRM_LIBRARY}
                       ${OPENGL_LIBRARIES}
                       ${OPTIONAL_EGL_LIBRARY}
-                      ${GBM_LIBRARY})
+                      ${OPTIONAL_GBM_LIBRARY})
 install (TARGETS cl LIBRARY DESTINATION lib)
-- 
1.7.10.4



More information about the Beignet mailing list