[llvm-branch-commits] [clang] [clang] Revise IDE folder structure (PR #89743)
Aaron Ballman via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue May 14 05:40:25 PDT 2024
AaronBallman wrote:
> @AaronBallman Thanks for having a look.
>
> > With this patch, I get errors when loading a visual studio solution generated with these change, and all of clang's libraries are placed at the top level. The error is a dialog box saying "The solution already contains an item named 'clang'."
>
> I got similar errors with "Unittest" and "UnitTest". I only solved it by using "Unit". I am assuming this is because there is something else already with that name but inconsistent case. I never seen this for this for "Clang"/"clang", but it could be when not all patches from the series are applied. Specifically I think clang-tools-extra may use "Clang"/"clang".
>
> > Another thing (that is existing behavior) worth noting is that at some point, we lost the ability to browse directly to files in Visual Studio. Instead of going to `Clang Libraries->clangDriver->Source Files->ToolChain.cpp`, you have to go to `Object Libraries->obj.clangDriver->Source Files->ToolChain.cpp` which is pretty strange. Your patch doesn't change this, but if we're correcting folder structure behavior, we should probably address that at the same time if we can.
>
> This is how CMake handles object libraries. There is one target `obj.clangDriver` that builds all the *.obj file, and a library that is not used. The target `clangDriver` then has a dependency on `obj.clangDriver` and has its *.obj files added, but not the source files. This is to be able to link a static library (`clangDriver_static.a`) and a dynamic library (`clangDriver.so`) at the [same time](https://github.com/llvm/llvm-project/blob/ca1bd5995f6ed934f9187305190a5abfac049173/llvm/cmake/modules/AddLLVM.cmake#L547) but compiling the source files just once. I don't know the reason, but in contrast to other subprojects Clang uses this build mode [even when building just one library](https://github.com/llvm/llvm-project/blob/ca1bd5995f6ed934f9187305190a5abfac049173/clang/cmake/modules/AddClang.cmake#L102).
Ah interesting, thank you for the explanation! I know at one point in time, this used to generate a more obvious layout for the solution file, so I was surprised by the change.
> There is an exception for XCode, and we could do the same for MSVC (or add the source files as non-compiled sources to make them show up like `ADDITIONAL_HEADERS` ). However, for this patch series I did not intent to change anything about how the build system works.
SGTM! It might be useful to explore doing that, but I don't know how many folks are still generating solution files these days. Personally, I use MSVC's integrated CMake support which has its own set of problems but tends to be better than using a solution file (esp in terms of compilation times).
https://github.com/llvm/llvm-project/pull/89743
More information about the llvm-branch-commits
mailing list