[Beignet] [PATCH] Refine cmake script file.
Zhigang Gong
zhigang.gong at linux.intel.com
Tue Sep 17 02:35:29 PDT 2013
Remove GBM which is not needed. Adjust the header file including
sequence to avoid including incorrect cl header file when compile
with mesa source code package.
Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
CMake/FindEGL.cmake | 6 +++++-
CMake/FindGBM.cmake | 36 ------------------------------------
CMakeLists.txt | 15 ++++++---------
src/CMakeLists.txt | 7 ++++---
4 files changed, 15 insertions(+), 49 deletions(-)
delete mode 100644 CMake/FindGBM.cmake
diff --git a/CMake/FindEGL.cmake b/CMake/FindEGL.cmake
index 6caed56..d84ef95 100644
--- a/CMake/FindEGL.cmake
+++ b/CMake/FindEGL.cmake
@@ -41,7 +41,11 @@ FIND_PATH(MESA_SOURCE_PREFIX src/mesa/main/texobj.c
DOC "The mesa source directory which is needed for cl_khr_gl_sharing.")
IF(MESA_SOURCE_PREFIX)
-SET(MESA_SOURCE_INCLUDES "-I${MESA_SOURCE_PREFIX}/src/mesa -I${MESA_SOURCE_PREFIX}/include -I${MESA_SOURCE_PREFIX}/src/mapi -I${MESA_SOURCE_PREFIX}/src/mesa/drivers/dri/i965/ -I${MESA_SOURCE_PREFIX}/src/mesa/drivers/dri/common/")
+SET(MESA_SOURCE_INCLUDES ${MESA_SOURCE_PREFIX}/src/mesa
+ ${MESA_SOURCE_PREFIX}/include
+ ${MESA_SOURCE_PREFIX}/src/mapi
+ ${MESA_SOURCE_PREFIX}/src/mesa/drivers/dri/i965/
+ ${MESA_SOURCE_PREFIX}/src/mesa/drivers/dri/common/)
SET(MESA_SOURCE_FOUND 1 CACHE STRING "Set to 1 if mesa source code is found, 0 otherwise")
ELSE(MESA_SOURCE_PREFIX)
SET(MESA_SOURCE_FOUND 0 CACHE STRING "Set to 1 if mesa source code is found, 0 otherwise")
diff --git a/CMake/FindGBM.cmake b/CMake/FindGBM.cmake
deleted file mode 100644
index f20f4b2..0000000
--- a/CMake/FindGBM.cmake
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Try to find gbm library and include path.
-# Once done this will define
-#
-# GBM_FOUND
-# GBM_INCLUDE_PATH
-# GBM_LIBRARY
-#
-
-FIND_PATH(GBM_INCLUDE_PATH gbm.h
- ~/include/
- /usr/include/
- /usr/local/include/
- /sw/include/
- /opt/local/include/
- DOC "The directory where gen/program.h resides")
-FIND_LIBRARY(GBM_LIBRARY
- NAMES GBM gbm
- PATHS
- ~/lib/
- /usr/lib64
- /usr/lib
- /usr/local/lib64
- /usr/local/lib
- /sw/lib
- /opt/local/lib
- DOC "The GBM library")
-
-IF(GBM_INCLUDE_PATH)
- INCLUDE_DIRECTORIES(${GBM_INCLUDE_PATH})
- SET(GBM_FOUND 1 CACHE STRING "Set to 1 if GBM is found, 0 otherwise")
-ELSE(GBM_INCLUDE_PATH)
- SET(GBM_FOUND 0 CACHE STRING "Set to 1 if GBM is found, 0 otherwise")
-ENDIF(GBM_INCLUDE_PATH)
-
-MARK_AS_ADVANCED(GBM_FOUND)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e07e4f3..0b6c3d9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -116,15 +116,6 @@ ELSE(GBE_FOUND)
MESSAGE(STATUS "Looking for Gen-Backend - not found")
ENDIF(GBE_FOUND)
-Find_Package(GBM)
-IF(GBM_FOUND)
- MESSAGE(STATUS "Looking for GBM - found")
- SET(CMAKE_CXX_FLAGS "-DHAS_GBM ${CMAKE_CXX_FLAGS}")
- SET(CMAKE_C_FLAGS "-DHAS_GBM ${CMAKE_C_FLAGS}")
-ELSE(GBM_FOUND)
- MESSAGE(STATUS "Looking for GBM - not found")
-ENDIF(GBM_FOUND)
-
Find_Package(EGL)
IF(EGL_FOUND)
MESSAGE(STATUS "Looking for EGL - found")
@@ -132,6 +123,12 @@ ELSE(EGL_FOUND)
MESSAGE(STATUS "Looking for EGL - not found")
ENDIF(EGL_FOUND)
+IF(MESA_SOURCE_FOUND)
+ MESSAGE(STATUS "Looking for mesa source code - found")
+ELSE(MESA_SOURCE_FOUND)
+ MESSAGE(STATUS "Looking for mesa source code - not found, cl_khr_gl_sharing will be disabled.")
+ENDIF(MESA_SOURCE_FOUND)
+
Find_Package(OCLIcd)
IF(OCLIcd_FOUND)
MESSAGE(STATUS "Looking for OCL ICD header file - found")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f7f77cc..3fc8689 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,7 +1,8 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${DRM_INCLUDE_PATH}
${CMAKE_CURRENT_SOURCE_DIR}/../backend/src/backend/
- ${CMAKE_CURRENT_SOURCE_DIR}/../include)
+ ${CMAKE_CURRENT_SOURCE_DIR}/../include
+ ${MESA_SOURCE_INCLUDES})
set(OPENCL_SRC
cl_api.c
@@ -31,8 +32,8 @@ set(OPENCL_SRC
if (EGL_FOUND AND MESA_SOURCE_FOUND)
set (OPENCL_SRC ${OPENCL_SRC} cl_mem_gl.c cl_gl_api.c x11/mesa_egl_extension.c x11/mesa_egl_res_share.c intel/intel_dri_resource_sharing.c)
-SET(CMAKE_CXX_FLAGS "-DHAS_EGL ${CMAKE_CXX_FLAGS} ${MESA_SOURCE_INCLUDES}")
-SET(CMAKE_C_FLAGS "-DHAS_EGL ${CMAKE_C_FLAGS} ${MESA_SOURCE_INCLUDES}")
+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 AND MESA_SOURCE_FOUND)
SET(OPTIONAL_EGL_LIBRARY "")
--
1.7.9.5
More information about the Beignet
mailing list