[Beignet] [PATCH] Add libelf check in CMakeList

junyan.he at inbox.com junyan.he at inbox.com
Thu Mar 2 10:02:16 UTC 2017


From: Junyan He <junyan.he at intel.com>

We need the libelf support to parse the binary files
generated by GBE backend from now on.

Signed-off-by: Junyan He <junyan.he at intel.com>
---
 CMakeLists.txt     | 8 ++++++++
 src/CMakeLists.txt | 1 +
 2 files changed, 9 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a111fe2..e6babe4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -103,6 +103,14 @@ ENDIF (USE_STANDALONE_GBE_COMPILER STREQUAL "true")
 
 set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-Bsymbolic -Wl,--no-undefined ${LLVM_LDFLAGS}")
 
+pkg_check_modules(ELF_LIB REQUIRED libelf)
+IF(ELF_LIB_FOUND)
+  MESSAGE(STATUS "Looking for libelf - found at ${ELF_LIB_PREFIX} ${ELF_LIB_VERSION}")
+  INCLUDE_DIRECTORIES(${ELF_LIB_INCLUDE_DIRS})
+ELSE(ELF_LIB_FOUND)
+  MESSAGE(STATUS "Looking for libelf - not found")
+ENDIF(ELF_LIB_FOUND)
+
 # XLib
 Find_Package(X11)
 IF(X11_FOUND)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 94e97ba..bd1007a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -179,6 +179,7 @@ target_link_libraries(
                       cl
                       rt
                       ${X11_LIBRARIES}
+                      ${ELF_LIB_LIBRARIES}
                       ${XEXT_LIBRARIES}
                       ${XFIXES_LIBRARIES}
                       ${DRM_INTEL_LIBRARIES}
-- 
2.7.4



More information about the Beignet mailing list