Visual Studio project for clang has no sources

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Visual Studio project for clang has no sources

suyash singh via cfe-dev

Hi,

 

   I'm working on LLVM on Windows using the MSVC CMake generator. Most of my time is spent in LLVM itself, which works fine. Each library has a source, headers, and tablegen directory (if there are tablegen files). However, in the Clang libraries, I only have "Object Libraries", and I can't access any headers or cpp files from visual studio.

 

   I'm wondering if anybody has encountered this issue before and knows how I might work around it.

 

Thanks,

   Christopher Tetreault


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Visual Studio project for clang has no sources

suyash singh via cfe-dev
On Wed, Feb 26, 2020 at 8:38 AM Chris Tetreault via cfe-dev
<[hidden email]> wrote:
>
> Hi,
>
>    I'm working on LLVM on Windows using the MSVC CMake generator. Most of my time is spent in LLVM itself, which works fine. Each library has a source, headers, and tablegen directory (if there are tablegen files). However, in the Clang libraries, I only have "Object Libraries", and I can't access any headers or cpp files from visual studio.
>
>    I'm wondering if anybody has encountered this issue before and knows how I might work around it.

I use MSVC to open the LLVM folder as a cmake project (so I don't
execute cmake with the MSVC generator and open a solution from there),
and I get similarly bad behavior (all the LLVM components show up fine
in the solution explorer, but none of the other projects are there).
As best I can tell, Visual Studio doesn't handle the monorepo layout
nearly as well as it handled the previous directory layout and I've
not found a way to improve the situation. It's frustrating, so if
others have ideas on how to make Clang development on Windows at least
as good as it was before the git transition, that would be
appreciated. FWIW, my CMake configuration settings are:
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DLLVM_ENABLE_IDE=ON
-DLLVM_OPTIMIZED_TABLEGEN=ON

~Aaron
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Visual Studio project for clang has no sources

suyash singh via cfe-dev
Aaron,

   I've struggled with the Visual Studio issue for a few months now. I gave up on using the direct CMake support long ago because I don't care to manage the CMake settings .json file and I think that in its current state, Visual Studio still works better with msbuild projects. That said, I think the issue you're seeing is the fact that Visual Studio shows the files directly under the folder you have open only. If you create a CMakeLists.txt file in the folder above the llvm folder that just does add_subdirectory(llvm), I think it ends up working. You may have to tweak it, but it was something silly like that.

   For my issue, I suspect that I am either not passing a required flag, or the build system is broken for MSVC. I seem to recall it working a few months ago.

Thanks,
   Christopher Tetreault

-----Original Message-----
From: Aaron Ballman <[hidden email]>
Sent: Wednesday, February 26, 2020 5:59 AM
To: Chris Tetreault <[hidden email]>
Cc: [hidden email]
Subject: [EXT] Re: [cfe-dev] Visual Studio project for clang has no sources

On Wed, Feb 26, 2020 at 8:38 AM Chris Tetreault via cfe-dev <[hidden email]> wrote:
>
> Hi,
>
>    I'm working on LLVM on Windows using the MSVC CMake generator. Most of my time is spent in LLVM itself, which works fine. Each library has a source, headers, and tablegen directory (if there are tablegen files). However, in the Clang libraries, I only have "Object Libraries", and I can't access any headers or cpp files from visual studio.
>
>    I'm wondering if anybody has encountered this issue before and knows how I might work around it.

I use MSVC to open the LLVM folder as a cmake project (so I don't execute cmake with the MSVC generator and open a solution from there), and I get similarly bad behavior (all the LLVM components show up fine in the solution explorer, but none of the other projects are there).
As best I can tell, Visual Studio doesn't handle the monorepo layout nearly as well as it handled the previous directory layout and I've not found a way to improve the situation. It's frustrating, so if others have ideas on how to make Clang development on Windows at least as good as it was before the git transition, that would be appreciated. FWIW, my CMake configuration settings are:
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DLLVM_ENABLE_IDE=ON -DLLVM_OPTIMIZED_TABLEGEN=ON

~Aaron
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Visual Studio project for clang has no sources

suyash singh via cfe-dev
In reply to this post by suyash singh via cfe-dev
Am Mi., 26. Feb. 2020 um 07:38 Uhr schrieb Chris Tetreault via cfe-dev
<[hidden email]>:
>    I'm working on LLVM on Windows using the MSVC CMake generator. Most of my time is spent in LLVM itself, which works fine. Each library has a source, headers, and tablegen directory (if there are tablegen files). However, in the Clang libraries, I only have "Object Libraries", and I can't access any headers or cpp files from visual studio.

Clang's CMakeLists.txt uses object libraries to only compile each cpp
file once and link the object files into both, a static and dynamic
library (don't know why LLVM doesn't do the same thing). As a result,
the clangXYZ libraries only contain the object files to be linked, but
are compiled by a separate "obj.clangXYZ" target. You find the object
library targets themselves in the "Object Libraries" folder (sibling
of "Clang libraries", "Clang executable", ...). If you expand these
projects, they do contain "Header Files" and "Source Files".

Michael
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Visual Studio project for clang has no sources

suyash singh via cfe-dev
Michael,

   I see it now, thank you for pointing it out. It might be nice to organize this stuff better (the solution generated by our cmake for llvm overall is a bit of a mess), I think that it would make sense to swap contents of "Clang libraries" and "Object Libraries" as a start. For the time being, I am happy. Thanks for your help!

Thanks,
   Christopher Tetreault

-----Original Message-----
From: Michael Kruse <[hidden email]>
Sent: Wednesday, February 26, 2020 10:08 AM
To: Chris Tetreault <[hidden email]>
Cc: [hidden email]
Subject: [EXT] Re: [cfe-dev] Visual Studio project for clang has no sources

Am Mi., 26. Feb. 2020 um 07:38 Uhr schrieb Chris Tetreault via cfe-dev
<[hidden email]>:
>    I'm working on LLVM on Windows using the MSVC CMake generator. Most of my time is spent in LLVM itself, which works fine. Each library has a source, headers, and tablegen directory (if there are tablegen files). However, in the Clang libraries, I only have "Object Libraries", and I can't access any headers or cpp files from visual studio.

Clang's CMakeLists.txt uses object libraries to only compile each cpp file once and link the object files into both, a static and dynamic library (don't know why LLVM doesn't do the same thing). As a result, the clangXYZ libraries only contain the object files to be linked, but are compiled by a separate "obj.clangXYZ" target. You find the object library targets themselves in the "Object Libraries" folder (sibling of "Clang libraries", "Clang executable", ...). If you expand these projects, they do contain "Header Files" and "Source Files".

Michael
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev