Skip to content

Commit

Permalink
[SYCL][libclc] Fix missing build dependencies (#13145)
Browse files Browse the repository at this point in the history
This commit fixes the problem of missing build dependencies between
libclc source files and their various includes.

We would like to do this with compiler-generated dependency files
because then the dependencies are accurate and there are no false
positives, leading to unnecessary rebuilds. This is how regular C/C++
dependencies are usually tracked by CMake.

Note that this variable is an internal API so is not guaranteed to work,
but then again *all* of CMake's support for new languages (which we use
for CLC/LL languages) is an internal API. On balance this change is
probably worth it due to how minimally invasive it is.

The alternative would be to either:

1. list/glob all possible files in the directory as dependencies, which
would lead to false positives.
2. rewrite the library generation as a loop over all files and calling
`add_custom_command`, which can produce a dependency file (by tweaking
our clang command line) that can also be fed back to the same command
via the `DEPFILE` argument. This would be a much larger change and is
not as "neat".
  • Loading branch information
frasercrmck authored Mar 28, 2024
1 parent f894d08 commit f2ac688
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions libclc/cmake/CMakeCLCInformation.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ if(NOT CMAKE_CLC_CREATE_STATIC_LIBRARY)
endif()

set(CMAKE_INCLUDE_FLAG_CLC "-I")
set(CMAKE_DEPFILE_FLAGS_CLC "-MD -MT <DEP_TARGET> -MF <DEP_FILE>")

0 comments on commit f2ac688

Please sign in to comment.