[llvm-dev] llvm.natvis should be included when generating LLVM.sln

Zachary Turner via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 12 11:24:05 PST 2016


CMake cannot yet do this.  You will need to change the Visual Studio 2015
generator to support the nativs tag.  I'm not a CMake developer, but a 5
minutes look at the CMake source code suggests this might be very easy.  If
you look at cmVisualStudio10TargetGenerator::WriteAllSources(), you'll see
that it calls GetLanguage() on the source file, and depending on which
language is set, it uses a different tool.  Either ClCompile, MASM,
ResourceCompile, etc.  It sounds like all you need to do is add another
language type, called Natvis, and put it behind a check on the version of
the generator to make sure this language is only recognized when VS Version
>= 2015.

If it were me, I would whip up a 10 line patch that did exactly this, post
it on the CMake dev list, and see what kind of feedback I got.

On Sun, Jan 10, 2016 at 3:59 PM <Alexander G. Riccio> via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> So, I've investigated this a bit more, and I see that adding a debug
> visualizer to a (simple test) project adds the following text to the
> vcxproj file:
>
>   <ItemGroup>
>     <Natvis Include="..\..\..\..\..\..\..\LLVM\llvm\utils\llvm.natvis" />
>   </ItemGroup>
>
> (This was an unrelated test project, hence the many path components)
>
> ...right after the main.cpp file:
>
>   <ItemGroup>
>     <ClCompile Include="main.cpp" />
>   </ItemGroup>
>
> ...so that the vcxproj file looks like this:
>
>   <ItemGroup>
>     <ClCompile Include="main.cpp" />
>   </ItemGroup>
>   <ItemGroup>
>     <Natvis Include="..\..\..\..\..\..\..\LLVM\llvm\utils\llvm.natvis" />
>   </ItemGroup>
>
> My question, then, is how can I get CMake to emit the "<Natvis Include="
> element when generating the vcxproj files? Any CMake experts?
>
> If CMake CANNOT yet do this, I'll just file a bug for it
> <http://cmake.org/Bug>.
>
>
> Sincerely,
> Alexander Riccio
> --
> "Change the world or go home."
> about.me/ariccio
>
> <http://about.me/ariccio>
> If left to my own devices, I will build more.
>>
> On Mon, Jan 4, 2016 at 8:01 PM, <Alexander G. Riccio> <
> alexander at riccio.com> wrote:
>
>> As of Visual Studio 2015, natvis files can be included as part of
>> individual projects
>> <http://blogs.msdn.com/b/vcblog/archive/2015/09/28/debug-visualizers-in-visual-c-2015.aspx>,
>> a much better method than manually copying the file to an specific
>> directory in %USERPROFILE%.
>>
>> I think it should be included in one of the CMakeLists.txt files, does
>> anybody know how I can add it?
>>
>> Sincerely,
>> Alexander Riccio
>> --
>> "Change the world or go home."
>> about.me/ariccio
>>
>> <http://about.me/ariccio>
>> If left to my own devices, I will build more.
>>>>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://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/20160112/80b24225/attachment.html>


More information about the llvm-dev mailing list