Skip to content

Commit f7d0f61

Browse files
committed
[SYCL] add include/sycl_wrappers header search directory for sycl device target
compilations Signed-off-by: Vladimir Lazarev <[email protected]>
1 parent 76bcf3c commit f7d0f61

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,16 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
11131113
if (JA.isOffloading(Action::OFK_Cuda))
11141114
getToolChain().AddCudaIncludeArgs(Args, CmdArgs);
11151115

1116+
// Add include directories for SYCL
1117+
if (!Args.hasArg(options::OPT_nobuiltininc) &&
1118+
getToolChain().getTriple().isSYCLDeviceEnvironment()) {
1119+
SmallString<128> P(D.ResourceDir);
1120+
llvm::sys::path::append(P, "include");
1121+
llvm::sys::path::append(P, "sycl_wrappers");
1122+
CmdArgs.push_back("-internal-isystem");
1123+
CmdArgs.push_back(Args.MakeArgString(P));
1124+
}
1125+
11161126
// Add -i* options, and automatically translate to
11171127
// -include-pch/-include-pth for transparent PCH support. It's
11181128
// wonky, but we include looking for .gch so we can support seamless

clang/lib/Headers/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,12 @@ install(
183183
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
184184
DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include/cuda_wrappers)
185185

186+
install(
187+
FILES ${sycl_wrapper_files}
188+
COMPONENT clang-headers
189+
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
190+
DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include/sycl_wrappers)
191+
186192
if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
187193
add_llvm_install_targets(install-clang-headers
188194
DEPENDS clang-headers

0 commit comments

Comments
 (0)