[LLVMdev] msbuild and clang

Hans Wennborg hans at chromium.org
Mon Jun 8 11:55:27 PDT 2015


On Mon, Jun 8, 2015 at 11:44 AM, Russell Wallace
<russell.wallace at gmail.com> wrote:
> I'm trying to compile some large programs with clang on Windows (with a view
> to compiling to bit code and then running some whole program optimisations
> on the bit code).
>
> Take for example the Python 2.7 interpreter:
>
> As is typically the case, the usual build procedure involves running msbuild
> which invokes the Microsoft compiler.
>
> The most obvious procedure would then be to substitute clang-cl.exe for
> cl.exe and thereby take advantage of msbuild supplying correct flags,
> include paths et cetera.
>
> What's the recommended procedure for this - rename clang-cl.exe to cl.exe
> and put it earlier in your path?

Yes, that's how Clang's Visual Studio integration currently works.

> clang-cl requires some extra flags to get it to generate bit code instead of
> object files - what's the recommended way to get that when msbuild doesn't
> by default supply such flags?

I'm not that familiar with msbuild, but in Visual Studio you can add
extra flags for your project under Configuration Properties -> C/C++
-> Command Line.

> Are there any existing tutorials or anything describing techniques for this?

I don't know of any tutorials, but did you try installing Clang via
the release packages [1] or weekly snapshots [2]? That will install
Clang as a "Platform Toolset" that you can just select from inside
Visual Studio. That's generally the easiest way to try it out.

Cheers,
Hans

[1]. http://llvm.org/releases/download.html
[2]. http://llvm.org/builds/



More information about the llvm-dev mailing list