Skip to content

Commit 808b38d

Browse files
authored
[SYCL] Use relative paths for SYCL headers install (#3940)
`${SYCL_INCLUDE_DEPLOY_DIR}` is defined as `${CMAKE_INSTALL_PREFIX}/${SYCL_INCLUDE_DIR}`, this is unnecessary because when using relative paths, CMake will automatically prefix install destinations with `${CMAKE_INSTALL_PREFIX}`, so we can directly use `${SYCL_INCLUDE_DIR}`. It is also preferable to use relative paths, because it enables the `DESTDIR` mechanism that can make it possible to change the install prefix after the configuration, with for example things like `make DESTDIR=/new/install/prefix install`, or when manually calling the CMake install scripts. This patch has no functional changes and should have no effect on existing builds, aside from enabling `DESTDIR`.
1 parent 34e1f7c commit 808b38d

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

sycl/CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ set(CLANG_VERSION "${CLANG_VERSION_MAJOR}.${CLANG_VERSION_MINOR}.${CLANG_VERSION
6969

7070
set(SYCL_INCLUDE_DIR "include")
7171
set(SYCL_INCLUDE_BUILD_DIR ${LLVM_BINARY_DIR}/${SYCL_INCLUDE_DIR})
72-
set(SYCL_INCLUDE_DEPLOY_DIR ${CMAKE_INSTALL_PREFIX}/${SYCL_INCLUDE_DIR})
7372

7473
add_llvm_external_project(opencl)
7574
list(FIND LLVM_ENABLE_PROJECTS opencl OPENCL_FOUND)
@@ -85,7 +84,7 @@ file(COPY ${OpenCL_INCLUDE_DIR}/CL
8584

8685
# Include OpenCL Headers into final bundle.
8786
install(DIRECTORY ${OpenCL_INCLUDE_DIR}/CL
88-
DESTINATION ${SYCL_INCLUDE_DEPLOY_DIR}/sycl
87+
DESTINATION ${SYCL_INCLUDE_DIR}/sycl
8988
COMPONENT OpenCL-Headers)
9089

9190
option(SYCL_BUILD_PI_CUDA
@@ -106,8 +105,8 @@ COMMAND ${CMAKE_COMMAND} -E copy_directory ${sycl_inc_dir}/CL ${SYCL_INCLUDE_BUI
106105
COMMENT "Copying SYCL headers ...")
107106

108107
# Copy SYCL headers from sources to install directory
109-
install(DIRECTORY "${sycl_inc_dir}/sycl" DESTINATION ${SYCL_INCLUDE_DEPLOY_DIR} COMPONENT sycl-headers)
110-
install(DIRECTORY "${sycl_inc_dir}/CL" DESTINATION ${SYCL_INCLUDE_DEPLOY_DIR}/sycl COMPONENT sycl-headers)
108+
install(DIRECTORY "${sycl_inc_dir}/sycl" DESTINATION ${SYCL_INCLUDE_DIR} COMPONENT sycl-headers)
109+
install(DIRECTORY "${sycl_inc_dir}/CL" DESTINATION ${SYCL_INCLUDE_DIR}/sycl COMPONENT sycl-headers)
111110

112111
set(SYCL_RT_LIBS sycl)
113112
if (MSVC)

sycl/test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set(LLVM_BUILD_BINARY_DIRS "${LLVM_BINARY_DIR}/bin/")
88
set(LLVM_BUILD_LIBRARY_DIRS "${LLVM_BINARY_DIR}/lib/")
99

1010
set(RT_TEST_ARGS ${RT_TEST_ARGS} "-v")
11-
set(DEPLOY_RT_TEST_ARGS ${DEPLOY_RT_TEST_ARGS} "-v -D SYCL_TOOLS_DIR=${CMAKE_INSTALL_PREFIX}/bin -D SYCL_LIBS_DIR=${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX} -D SYCL_INCLUDE=${SYCL_INCLUDE_DEPLOY_DIR}")
11+
set(DEPLOY_RT_TEST_ARGS ${DEPLOY_RT_TEST_ARGS} "-v -D SYCL_TOOLS_DIR=${CMAKE_INSTALL_PREFIX}/bin -D SYCL_LIBS_DIR=${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX} -D SYCL_INCLUDE=${CMAKE_INSTALL_PREFIX}/${SYCL_INCLUDE_DIR}")
1212

1313
find_package(Threads REQUIRED)
1414
set(SYCL_THREADS_LIB ${CMAKE_THREAD_LIBS_INIT})

0 commit comments

Comments
 (0)