From f7d0f61098e13826e4784e2291026351e7572b7d Mon Sep 17 00:00:00 2001 From: Vladimir Lazarev Date: Sat, 29 Dec 2018 01:20:34 +0300 Subject: [PATCH] [SYCL] add include/sycl_wrappers header search directory for sycl device target compilations Signed-off-by: Vladimir Lazarev --- clang/lib/Driver/ToolChains/Clang.cpp | 10 ++++++++++ clang/lib/Headers/CMakeLists.txt | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 2ed390897d75d..21ef861ede411 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -1113,6 +1113,16 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA, if (JA.isOffloading(Action::OFK_Cuda)) getToolChain().AddCudaIncludeArgs(Args, CmdArgs); + // Add include directories for SYCL + if (!Args.hasArg(options::OPT_nobuiltininc) && + getToolChain().getTriple().isSYCLDeviceEnvironment()) { + SmallString<128> P(D.ResourceDir); + llvm::sys::path::append(P, "include"); + llvm::sys::path::append(P, "sycl_wrappers"); + CmdArgs.push_back("-internal-isystem"); + CmdArgs.push_back(Args.MakeArgString(P)); + } + // Add -i* options, and automatically translate to // -include-pch/-include-pth for transparent PCH support. It's // wonky, but we include looking for .gch so we can support seamless diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt index 1329a2b235075..9b2e0d9e4c6d2 100644 --- a/clang/lib/Headers/CMakeLists.txt +++ b/clang/lib/Headers/CMakeLists.txt @@ -183,6 +183,12 @@ install( PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include/cuda_wrappers) +install( + FILES ${sycl_wrapper_files} + COMPONENT clang-headers + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ + DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include/sycl_wrappers) + if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's. add_llvm_install_targets(install-clang-headers DEPENDS clang-headers