[Beignet] [PATCH V2] CMAKE: Refine builtin kernel bin generator
Xiuli Pan
xiuli.pan at intel.com
Thu Mar 2 03:33:31 UTC 2017
From: Pan Xiuli <xiuli.pan at intel.com>
Move the generated builtin str and bin files into the Cmake build
directory to avoid chaos when changing LLVM.
V2: Fix a bug that the builtin.cl was not written into build dir.
Signed-off-by: Pan Xiuli <xiuli.pan at intel.com>
---
src/CMakeLists.txt | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f3c4632..77a1c87 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -7,10 +7,10 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${OPENGL_INCLUDE_DIRS}
${EGL_INCLUDE_DIRS})
-macro (MakeKernelBinStr KERNEL_PATH KERNEL_FILES)
+macro (MakeKernelBinStr KERNEL_DIST KERNEL_SOURCE KERNEL_FILES)
foreach (KF ${KERNEL_FILES})
- set (input_file ${KERNEL_PATH}/${KF}.cl)
- set (output_file ${KERNEL_PATH}/${KF}_str.c)
+ set (input_file ${KERNEL_SOURCE}/${KF}.cl)
+ set (output_file ${KERNEL_DIST}/${KF}_str.c)
list (APPEND KERNEL_STR_FILES ${output_file})
list (GET GBE_BIN_GENERATER -1 GBE_BIN_FILE)
if(GEN_PCI_ID)
@@ -34,7 +34,7 @@ macro (MakeBuiltInKernelStr KERNEL_PATH KERNEL_FILES)
set (file_content)
file (REMOVE ${output_file})
foreach (KF ${KERNEL_NAMES})
- set (input_file ${KERNEL_PATH}/${KF}.cl)
+ set (input_file ${CMAKE_CURRENT_SOURCE_DIR}/kernels/${KF}.cl)
file(READ ${input_file} file_content )
STRING(REGEX REPLACE ";" "\\\\;" file_content "${file_content}")
file(APPEND ${output_file} ${file_content})
@@ -60,9 +60,9 @@ cl_internal_fill_image_1d_array cl_internal_fill_image_2d
cl_internal_fill_image_2d_array cl_internal_fill_image_3d
cl_internal_block_motion_estimate_intel)
set (BUILT_IN_NAME cl_internal_built_in_kernel)
-MakeBuiltInKernelStr ("${CMAKE_CURRENT_SOURCE_DIR}/kernels/" "${KERNEL_NAMES}")
-MakeKernelBinStr ("${CMAKE_CURRENT_SOURCE_DIR}/kernels/" "${KERNEL_NAMES}")
-MakeKernelBinStr ("${CMAKE_CURRENT_SOURCE_DIR}/kernels/" "${BUILT_IN_NAME}")
+MakeBuiltInKernelStr ("${CMAKE_CURRENT_BINARY_DIR}/kernels/" "${KERNEL_NAMES}")
+MakeKernelBinStr ("${CMAKE_CURRENT_BINARY_DIR}/kernels/" "${CMAKE_CURRENT_SOURCE_DIR}/kernels/" "${KERNEL_NAMES}")
+MakeKernelBinStr ("${CMAKE_CURRENT_BINARY_DIR}/kernels/" "${CMAKE_CURRENT_BINARY_DIR}/kernels/" "${BUILT_IN_NAME}")
set(OPENCL_SRC
${KERNEL_STR_FILES}
--
2.7.4
More information about the Beignet
mailing list