Correct clang paths for incremental builds.

We should be using bin/clang, not the build/lightining/bin/clang since
build/ is the project's internal build directory.  This patch corrects
this where possible.

However, lightning does not install all it's end user files under out/
so some headers can not be found anywhere in out/ in an incremental build.
This header (opencl-c.h) if fetched out of the lightning source tree if
necessary.

Change-Id: I083d8b27bb39dd615fba3bb0711a789318f95e77
这个提交包含在:
Sean Keely
2019-11-16 00:18:52 -06:00
父节点 5774d9162b
当前提交 f62017f4a5
修改 2 个文件,包含 25 行新增3 行删除
+13 -2
查看文件
@@ -89,8 +89,12 @@ endif()
if (DEFINED LLVM_DIR)
set(CLANG ${LLVM_DIR}/clang)
if (NOT EXISTS ${CLANG})
# SPK temp until Jenkins script input is corrected.
set (CLANG ${OPENCL_DIR}/bin/clang)
if (NOT EXISTS ${CLANG})
message("ERROR: path to clang (${CLANG}) is not valid. Is define LLVM_DIR correct?")
return()
endif()
endif()
else()
message("WARNING: LLVM_DIR define is not set. Kernels will not be built.")
@@ -110,6 +114,13 @@ else()
set(OPENCL_VER "2.0")
endif()
if(NOT EXISTS "${OPENCL_INC_DIR}/opencl-c.h")
set(OPENCL_INC_DIR "${OPENCL_DIR}/../../../external/llvm-clang/lib/Headers/")
if(NOT EXISTS "${OPENCL_INC_DIR}/opencl-c.h")
message(WARNING "opencl-c.h not found.")
endif()
endif()
if (NOT DEFINED TARGET_DEVICES)
message("WARNING: No targets devices provided on command line")
message(" e.g., cmake -DTARGET_DEVICES=\"gfx803;gfx900;gfx...\" ..")
@@ -223,7 +234,7 @@ link_directories(${ROCR_LIB_DIR})
#
set(ROCR_LIBS ${ROCR_LIBS} hsa-runtime${ONLY64STR})
include_directories(${ROCR_INC_DIR} ${OPENCL_INC_DIR})
include_directories(${ROCR_INC_DIR} "${OPENCL_DIR}/include")
# Use this function to build any samples that have kernels to be built
function(process_sample S_NAME TARG_DEV HAS_KERNEL)
@@ -237,7 +248,7 @@ function(process_sample S_NAME TARG_DEV HAS_KERNEL)
if (${HAS_KERNEL})
# Build the kernel
separate_arguments(CLANG_ARG_LIST UNIX_COMMAND
"-x cl -Xclang -finclude-default-header -target amdgcn-amdh-amdhsa -mcpu=${TARG_DEV} -mno-code-object-v3 ${BITCODE_LIBS} -cl-std=CL${OPENCL_VER} ${CL_FILE_LIST} -o ${KERNEL_DIR}/${SNAME_KERNEL}")
"-x cl -target amdgcn-amd-amdhsa -include ${OPENCL_INC_DIR}opencl-c.h -mcpu=${TARG_DEV} -mno-code-object-v3 ${BITCODE_LIBS} -cl-std=CL${OPENCL_VER} ${CL_FILE_LIST} -o ${KERNEL_DIR}/${SNAME_KERNEL}")
add_custom_target("${TARG_NAME}" ${CLANG} ${CLANG_ARG_LIST} COMMAND
${CMAKE_COMMAND} -E create_symlink
"../${SNAME_EXE}" "${KERNEL_DIR}/${SNAME_EXE}"
+12 -1
查看文件
@@ -89,8 +89,12 @@ endif()
if (DEFINED LLVM_DIR)
set(CLANG ${LLVM_DIR}/clang)
if (NOT EXISTS ${CLANG})
# SPK temp until Jenkins script input is corrected.
set (CLANG ${OPENCL_DIR}/bin/clang)
if (NOT EXISTS ${CLANG})
message("ERROR: path to clang (${CLANG}) is not valid. Is define LLVM_DIR correct?")
return()
endif()
endif()
else()
message("WARNING: LLVM_DIR define is not set. Kernels will not be built.")
@@ -110,6 +114,13 @@ else()
set(OPENCL_VER "2.0")
endif()
if(NOT EXISTS "${OPENCL_INC_DIR}/opencl-c.h")
set(OPENCL_INC_DIR "${OPENCL_DIR}/../../../external/llvm-clang/lib/Headers/")
if(NOT EXISTS "${OPENCL_INC_DIR}/opencl-c.h")
message(WARNING "opencl-c.h not found.")
endif()
endif()
if (NOT DEFINED TARGET_DEVICES)
message("No targets devices provided on command line")
message(" e.g., cmake -DTARGET_DEVICES=\"gfx803;gfx900;gfx...\" ..")
@@ -266,7 +277,7 @@ function(build_kernel S_NAME TARG_DEV)
set(HSACO_TARG_LIST ${HSACO_TARG_LIST} ${TARG_NAME}
CACHE INTERNAL HSA_TARG_LIST)
separate_arguments(CLANG_ARG_LIST UNIX_COMMAND
"-x cl -Xclang -finclude-default-header -target amdgcn-amdh-amdhsa -mcpu=${TARG_DEV} -mno-code-object-v3 ${BITCODE_LIBS} -cl-std=CL${OPENCL_VER} ${CL_FILE_LIST} -o ${KERNEL_DIR}/${SNAME_KERNEL}")
"-x cl -target amdgcn-amd-amdhsa -include ${OPENCL_INC_DIR}opencl-c.h -mcpu=${TARG_DEV} -mno-code-object-v3 ${BITCODE_LIBS} -cl-std=CL${OPENCL_VER} ${CL_FILE_LIST} -o ${KERNEL_DIR}/${SNAME_KERNEL}")
add_custom_target("${TARG_NAME}" ${CLANG} ${CLANG_ARG_LIST} COMMAND
${CMAKE_COMMAND} -E create_symlink
"../${ROCRTST}" "${KERNEL_DIR}/${ROCRTST}"