summaryrefslogtreecommitdiff
path: root/CMake
diff options
context:
space:
mode:
authorGuo Yejun <yejun.guo@intel.com>2015-01-09 21:42:55 +0800
committerZhigang Gong <zhigang.gong@intel.com>2015-01-12 09:05:24 +0800
commitf9a012929bf1f5b6249482ff169f6e86647f1364 (patch)
treea2daf970216d7218830002d12932a19a1ba50d2d /CMake
parentd191ae473190bc47e41df6dc3a73cbfd7d3214bb (diff)
downloadbeignet-f9a012929bf1f5b6249482ff169f6e86647f1364.tar.gz
add CMake option USE_STANDALONE_GBE_COMPILER and STANDALONE_GBE_COMPILER_DIR
At some platforms with old c/c++ environment, C++11 features are not supported, it results in the failure to build the gbe compiler part which depends on LLVM/clang using C++11 features. The way to resolve is to build a standalone gbe compiler within another feasible system, and build beignet with the already built standalone gbe compiler by setting USE_STANDALONE_GBE_COMPILER=true. The path of the standalone compiler is /usr/local/lib/beignet as default or could be specified by STANDALONE_GBE_COMPILER_DIR. Once USE_STANDALONE_GBE_COMPILER is given, all the gbe compiler relative code will not be built any longer, only libcl.so and libgebinterp.so are built. And libcl.so is special for GEN_PCI_ID, which is queried from the building machie or could be specified as CMake option. v2: separate the CMake option name. update the commit comments. add back the script for gen pci id, and build driver with it. v3: add file FindStandaloneGbeCompiler.cmake to make the main cmakefile clean. Signed-off-by: Guo Yejun <yejun.guo@intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'CMake')
-rw-r--r--CMake/FindStandaloneGbeCompiler.cmake35
1 files changed, 35 insertions, 0 deletions
diff --git a/CMake/FindStandaloneGbeCompiler.cmake b/CMake/FindStandaloneGbeCompiler.cmake
new file mode 100644
index 00000000..c27980e1
--- /dev/null
+++ b/CMake/FindStandaloneGbeCompiler.cmake
@@ -0,0 +1,35 @@
+# Find the standalone gbe compiler
+#
+# STANDALONE_GBE_COMPILER_DIR - base path of standalone compiler
+# STANDALONE_GBE_COMPILER - full file name of standalone compiler
+# GEN_PCI_ID - Gen's PCI ID
+
+IF (STANDALONE_GBE_COMPILER_DIR)
+ FIND_PROGRAM(STANDALONE_GBE_COMPILER
+ NAMES gbe_bin_generater
+ DOC "standalone gbe compiler executable"
+ PATHS ${STANDALONE_GBE_COMPILER_DIR} NO_DEFAULT_PATH)
+ELSE (STANDALONE_GBE_COMPILER_DIR)
+ FIND_PROGRAM(STANDALONE_GBE_COMPILER
+ NAMES gbe_bin_generater
+ DOC "standalone gbe compiler executable"
+ PATHS /usr/local/lib/beignet/)
+ENDIF (STANDALONE_GBE_COMPILER_DIR)
+
+IF (STANDALONE_GBE_COMPILER)
+ MESSAGE(STATUS "Looking for standalone gbe compiler - found at ${STANDALONE_GBE_COMPILER}")
+ STRING(REGEX REPLACE "(.*)/.*" "\\1" STANDALONE_GBE_COMPILER_DIR ${STANDALONE_GBE_COMPILER})
+ IF (NOT GEN_PCI_ID)
+ Find_Program(LSPCI lspci)
+ IF (LSPCI)
+ MESSAGE(STATUS "Looking for lspci - found")
+ ELSE (LSPCI)
+ MESSAGE(FATAL_ERROR "Looking for lspci - not found")
+ ENDIF (LSPCI)
+ EXECUTE_PROCESS(COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/GetGenID.sh"
+ OUTPUT_VARIABLE GEN_PCI_ID)
+ MESSAGE(STATUS "Platform Gen PCI id is " ${GEN_PCI_ID})
+ ENDIF (NOT GEN_PCI_ID)
+ELSE (STANDALONE_GBE_COMPILER)
+ MESSAGE(FATAL_ERROR "Looking for standalone gbe compiler - not found")
+ENDIF (STANDALONE_GBE_COMPILER) \ No newline at end of file