Support for Clang(LLVM) within Visual Studio Solutions¶
Clang(LLVM) can be used as an alternative compiler to the Microsoft Compiler (cl.exe).
It can be selected by changing the Properties of each VS Project and changing the General > Platform Toolset to LLVM (clang-cl) as described here
This will mean that msbuild.exe will invoke clang-cl.exe instead of cl.exe. clang-cl.exe is a "wrapper" process which will convert the usual cl.exe command-line options into clang command-line options and then invoke the clang.exe process.
Turbo Build Accelerator supports the Clang(LLVM) within Visual Studio Solutions. No additional effort by the User is required.
The Hook process turbo-clangcl.exe will use the configuration file for turbo-cl.xml. If clang-specific configuration is required, then simply create a turbo-clangcl.xml.
Minor modifications to msbuild Microsoft.Cpp.ClangCl.Common.targets files¶
Note that the Turbo Build Accelerator requires a minor modification to msbuild.exe files Microsoft.Cpp.ClangCl.Common.targets like C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.ClangCl.Common.targets. This is to modify the invocation of the turbo-clangcl.exe process and launch it for multiple C/CPP source files, in the same manner as used for cl.exe.
The modification will be automatically made by the Turbo Agent service within its start-up phase. It will search for the Microsoft.Cpp.ClangCl.Common.targets files within VS2019, 2022, and 2026 installations.
The modification is minor and looks like below (see sections marked with <!-- Modification by Turbo Build Accelerator -->) :
<!-- copy MultiProcessorCompilation to _MultiProcessorCompilation. MultiProcessorCompilation
is cleared to avoid passing /MP to clang-cl which generates a warning -->
<ItemGroup>
<ClCompile Condition="'%(ClCompile.MultiProcessorCompilation)' == 'true' or '$(MultiProcCL)' == 'true'">
<_MultiProcessorCompilation>true</_MultiProcessorCompilation>
<MultiProcessorCompilation>false</MultiProcessorCompilation>
</ClCompile>
<!-- Modification by Turbo Build Accelerator - if building with Turbo set the _MultiProcessorCompilation=false to prevent the MultiToolTask being invoked -->
<ClCompile Condition="'$(CLToolExe)' == 'turbo-clangcld_$(PlatformTarget).exe' or '$(CLToolExe)' == 'turbo-clangcl_$(PlatformTarget).exe' ">
<_MultiProcessorCompilation>false</_MultiProcessorCompilation>
<MultiProcessorCompilation>false</MultiProcessorCompilation>
</ClCompile>
<!-- End Modification by Turbo Build Accelerator -->
</ItemGroup>