[llvm-dev] Switching to Ninja

Adrian McCarthy via llvm-dev llvm-dev at lists.llvm.org
Mon Aug 10 10:05:31 PDT 2020


I have separate build directories Ninja Debug and Ninja Release and another
"build" directory for Visual Studio.

I build in a Ninja directory.  I never build in Visual Studio.  My Visual
Studio directory is exclusively for project and solution files to make
navigating through the code work well in the IDE.

To debug in Visual Studio, I open the project properties for the executable
I want to debug and point at the appropriate executable in one of the Ninja
directories.   Occasionally, it's worth regenerating the VS projects and
solutions to account for new, moved, and removed files.  But then you have
to remember to update the project properties again.

I have a stupid batch file that lets me (re)create any of my build
directories and runs Cmake with the appropriate generators.

A "Visual Studio command prompt" is just a normal command prompt that has
executed `vcvarsall.bat`.  That batch file adds a ridiculous number of
things to PATH and other environment variables--almost certainly more than
is necessary--but I haven't bothered to figure which bits can be
eliminated.  I made two shortcuts for launching command prompts that set up
their environment (which includes calling vcvarsall.bat) for one particular
type of build.

So my general pattern is to browse and edit in Visual Studio, save all, run
ninja in one of my customized command prompts, debug in Visual Studio,
repeat.  I have yet another command prompt set up for git.

There are probably lots of ways to handle LLVM on Windows with Visual
Studio.  Some of those may be better than mine, but mine has worked well
for me for a while.

On Mon, Aug 10, 2020 at 3:05 AM Andrzej Warzynski via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

>
>
> On 09/08/2020 16:00, Paul C. Anagnostopoulos via llvm-dev wrote:
>
> >
> > 1. Building with Visual Studio created build/release/bin. Building with
> Ninja created build/bin (no release directory). Does that make sense? (I
> have -DCMAKE_BUILD_TYPE=Release on the cmake command.)
> >
>
> Yes. CMake's Visual Studio generators are multiconfig, which means that
> you specify the build type (Release vs Debug etc) when _building_.
> Ninja, by default, is single-config (i.e. you specify build type when
> _configuring_ with CMake).
>
> You can check your generator via CMake's GENERETOR_IS_MULTICONFIG
> (
> https://cmake.org/cmake/help/v3.18/prop_gbl/GENERATOR_IS_MULTI_CONFIG.html).
>
> Also, recently CMake added support for multi-config builds for Ninja:
> https://cmake.org/cmake/help/v3.18/generator/Ninja%20Multi-Config.html
>
> -Andrzej
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200810/e1eef5e0/attachment.html>


More information about the llvm-dev mailing list