[libclc] [libclc] Track dependencies through dependency files (PR #86965)

2024-03-28 Thread Fraser Cormack via cfe-commits

https://github.com/frasercrmck closed 
https://github.com/llvm/llvm-project/pull/86965
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libclc] [libclc] Track dependencies through dependency files (PR #86965)

2024-03-28 Thread Fraser Cormack via cfe-commits

frasercrmck wrote:

> The build here seems to be trying to define clc as a language, which then 
> results in needing to rely on language support magic like this. I think it 
> would be better if this did what rocm-device-libs does and treat these as 
> custom targets. I don't think it's particularly helpful to pretend like this 
> is a normal host compiler detection situation.
> 
> https://github.com/ROCm/llvm-project/blob/efc7219da809b6bce7b1c92c1915a0eac68fb1f2/amd/device-libs/cmake/OCL.cmake#L136

Yes, I agree. It also makes building `libclc` in-tree a nuisance, because CMake 
needs to know the path to the "language compilers" at configure time, which 
leads to _fun_ like intuiting the final output path of `clang` and other tools 
and writing an empty string to those paths to ensure they exist on disk before 
you call `enable_language`.

So I agree that moving to custom targets would be beneficial for many reasons. 
I think overall it would be a simpler solution, not least because it's the more 
idiomatic way of doing CMake. I might look into that in the near future, but 
can't promise it.

https://github.com/llvm/llvm-project/pull/86965
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libclc] [libclc] Track dependencies through dependency files (PR #86965)

2024-03-28 Thread Matt Arsenault via cfe-commits

https://github.com/arsenm approved this pull request.

In the context of what the build is already doing, this should be fine 

https://github.com/llvm/llvm-project/pull/86965
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libclc] [libclc] Track dependencies through dependency files (PR #86965)

2024-03-28 Thread Matt Arsenault via cfe-commits

arsenm wrote:

The build here seems to be trying to define clc as a language, which then 
results in needing to rely on language support magic like this. I think it 
would be better if this did what rocm-device-libs does and treat these as 
custom targets. I don't think it's particularly helpful to pretend like this is 
a normal host compiler detection situation. 

https://github.com/ROCm/llvm-project/blob/efc7219da809b6bce7b1c92c1915a0eac68fb1f2/amd/device-libs/cmake/OCL.cmake#L136

https://github.com/llvm/llvm-project/pull/86965
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libclc] [libclc] Track dependencies through dependency files (PR #86965)

2024-03-28 Thread Fraser Cormack via cfe-commits

https://github.com/frasercrmck created 
https://github.com/llvm/llvm-project/pull/86965

This commit fixes the problem of missing build dependencies between libclc 
source files and their various includes (namely headers and .inc files).

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. It should work with all supported compilers 
and CMake generators.

>From 9dfb66dc1be0652fef199b51754fe017d330c43c Mon Sep 17 00:00:00 2001
From: Fraser Cormack 
Date: Thu, 28 Mar 2024 15:43:29 +
Subject: [PATCH] [libclc] Track dependencies through dependency files

This commit fixes the problem of missing build dependencies between
libclc source files and their various includes (namely headers and .inc
files).

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. It should work
with all supported compilers and CMake generators.
---
 libclc/cmake/CMakeCLCInformation.cmake | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libclc/cmake/CMakeCLCInformation.cmake 
b/libclc/cmake/CMakeCLCInformation.cmake
index 6eecf4edf0e7bb..95327e44397222 100644
--- a/libclc/cmake/CMakeCLCInformation.cmake
+++ b/libclc/cmake/CMakeCLCInformation.cmake
@@ -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  -MF ")

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits