[llvm-dev] How to build only the necessary components with MSVC

Chris Bieneman via llvm-dev llvm-dev at lists.llvm.org
Fri Apr 5 10:44:40 PDT 2019


You don't actually need to change your CMake configuration to reduce the number of components you build. Just don't build the `all` target, instead build the components you need.

Alternatively you can set the CMake variable `LLVM_DISTRIBUTION_COMPONENTS` to the list of things you need, which will result in the generation of a `distribution` target which will build just those pieces.

-Chris

> On Mar 29, 2019, at 3:19 PM, Liviu Prodea via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> I configure LLVM build with this command
> 
> cd llvm-8.0.0.src & md buildsys-x64-MT & cd buildsys-x64-MT & cmake -G "Ninja" -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_CRT_RELEASE=MT -DLLVM_ENABLE_RTTI=1 -DLLVM_ENABLE_TERMINFO=OFF -DCMAKE_INSTALL_PREFIX=../x64-MT ..
> 
> The number of build objects grew with every major release to 1660 for LLVM 7 and 1761 for LLVM 8.
> 
> I only need the components requested here
> 
> https://gitlab.freedesktop.org/mesa/mesa/blob/master/scons/llvm.py#L103 <https://gitlab.freedesktop.org/mesa/mesa/blob/master/scons/llvm.py#L103>
> 
> After reading
> 
> https://llvm.org/devmtg/2015-04/slides/eurollvm-2015-build.pdf <https://llvm.org/devmtg/2015-04/slides/eurollvm-2015-build.pdf>
> 
> and
> 
> https://llvm.org/docs/CMake.html <https://llvm.org/docs/CMake.html>
> 
> I found these options to be relevant: LLVM_DYLIB_COMPONENTS, LLVM_BUILD_LLVM_DYLIB, LLVM_LINK_LLVM_DYLIB, LLVM_BUILD_TOOLS and LLVM_INCLUDE_TOOLS. Unfortunately LLVM_DYLIB_COMPONENTS depends on LLVM_BUILD_LLVM_DYLIB which doesn't support MSVC, I can turn off LLVM_BUILD_TOOLS and LLVM_INCLUDE_TOOLS if I figure out how to filter unneeded components as I would no longer need llvm-config anymore. 
> _______________________________________________
> 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/20190405/2a1c0dec/attachment.html>


More information about the llvm-dev mailing list