Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrate LLVM Clang 4.x.x / 5.x.x / 6.x.x into Visual Studio 2017

The official LLVM 4.0 build for Windows integrates with Visual Studio up to Visual Studio 2015. Unfortunately it still doesn't support Visual Studio 2017.

When you try to set the Platform Toolset of a project to LLVM-vs2014, it pops up an error.

Do you know any way to make it work?


Update

In 2018, LLVM 6.0 officially still doesn't support integration with Visual Studio 2017 (version 15.X.X), only with the Visual Studio 2015 (version 14.X.X) toolset.

like image 565
plasmacel Avatar asked Apr 18 '17 06:04

plasmacel


3 Answers

It requires some msbuild targets that only ship with the C++ v140 toolset, and VS 2017 only installs the v141 toolset by default. If you open the VS 2017 installer, find the checkbox for the v140 toolset and install that then the right C++ msbuild targets will be available and the thing will work.

like image 171
keith Avatar answered Oct 05 '22 01:10

keith


Finally, I found a brilliant GitHub repo with the required MSBuild platform toolsets which integrates LLVM clang 5.0.0 into Visual Studio 2017. After following the instructions of the README file, you will have two new platform toolsets LLVM-vs2017 and LLVM-vs2017_xp. Problem solved.

Update

I made a fork which is updated for LLVM 6.0.0 and provides better integration by providing include and library paths of LLVM/clang.

Thanks to Royi, who realized that the original .prop files are explicitly tailored for LLVM 5.0 and it misses adding the proper lib ( $(LLVMInstallDir)\lib) and include ($(LLVMInstallDir)\lib\clang\6.0.0\include) folders.

like image 36
plasmacel Avatar answered Oct 05 '22 02:10

plasmacel


The LLVM project now explicitly supports Visual Studio 2017 via https://marketplace.visualstudio.com/items?itemName=LLVMExtensions.llvm-toolchain

like image 33
thakis Avatar answered Oct 05 '22 02:10

thakis