Skip to content

Commit 0e28541

Browse files
author
Alexander Batashev
authored
[XPTI][SYCL] Minor fixes to CMakeLists.txt (#5003)
- improve headers copy mechanisms to ensure it is done only when files are changed; - exclude XPTI unit tests from all targets by default.
1 parent e2fdf15 commit 0e28541

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

sycl/CMakeLists.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,19 @@ configure_file("${feature_header}.in" "${feature_header}")
118118
# TODO: detect and process remove header/directory case
119119
file(GLOB_RECURSE HEADERS_IN_SYCL_DIR CONFIGURE_DEPENDS "${sycl_inc_dir}/sycl/*")
120120
file(GLOB_RECURSE HEADERS_IN_CL_DIR CONFIGURE_DEPENDS "${sycl_inc_dir}/CL/*")
121+
string(REPLACE "${sycl_inc_dir}" "${SYCL_INCLUDE_BUILD_DIR}"
122+
OUT_HEADERS_IN_SYCL_DIR "${HEADERS_IN_SYCL_DIR}")
123+
string(REPLACE "${sycl_inc_dir}" "${SYCL_INCLUDE_BUILD_DIR}"
124+
OUT_HEADERS_IN_CL_DIR "${HEADERS_IN_CL_DIR}")
121125

122126
# Copy SYCL headers from sources to build directory
123127
add_custom_target(sycl-headers
124-
DEPENDS ${SYCL_INCLUDE_BUILD_DIR}/sycl
125-
${SYCL_INCLUDE_BUILD_DIR}/sycl/sycl.hpp
126-
${SYCL_INCLUDE_BUILD_DIR}/sycl/CL)
128+
DEPENDS ${OUT_HEADERS_IN_SYCL_DIR}
129+
${OUT_HEADERS_IN_CL_DIR})
127130

128131
add_custom_command(
129-
OUTPUT ${SYCL_INCLUDE_BUILD_DIR}/sycl
130-
${SYCL_INCLUDE_BUILD_DIR}/sycl/sycl.hpp
131-
${SYCL_INCLUDE_BUILD_DIR}/sycl/CL
132+
OUTPUT ${OUT_HEADERS_IN_SYCL_DIR}
133+
${OUT_HEADERS_IN_CL_DIR}
132134
DEPENDS ${HEADERS_IN_SYCL_DIR}
133135
${HEADERS_IN_CL_DIR}
134136
COMMAND ${CMAKE_COMMAND} -E copy_directory ${sycl_inc_dir}/sycl ${SYCL_INCLUDE_BUILD_DIR}/sycl

xpti/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,13 @@ add_subdirectory(src)
7878

7979
if (LLVM_BINARY_DIR)
8080
file(GLOB_RECURSE XPTI_HEADERS_LIST CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/xpti/*")
81+
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}" "${LLVM_BINARY_DIR}"
82+
XPTI_HEADERS_OUT_LIST "${XPTI_HEADERS_LIST}")
8183
add_custom_target(xpti-headers
82-
DEPENDS ${LLVM_BINARY_DIR}/include/xpti)
84+
DEPENDS ${XPTI_HEADERS_OUT_LIST})
8385

8486
add_custom_command(
85-
OUTPUT ${LLVM_BINARY_DIR}/include/xpti
87+
OUTPUT ${XPTI_HEADERS_OUT_LIST}
8688
DEPENDS ${XPTI_HEADERS_LIST}
8789
COMMAND ${CMAKE_COMMAND} -E copy_directory
8890
${CMAKE_CURRENT_SOURCE_DIR}/include/xpti

xptifw/unit_test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ if (NOT DEFINED LLVM_EXTERNAL_XPTIFW_SOURCE_DIR)
3838
endif()
3939
endif()
4040

41-
add_executable(XPTIFWUnitTests
41+
add_executable(XPTIFWUnitTests EXCLUDE_FROM_ALL
4242
xpti_api_tests.cpp
4343
xpti_correctness_tests.cpp
4444
)

0 commit comments

Comments
 (0)