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

Liviu Prodea via llvm-dev llvm-dev at lists.llvm.org
Tue Apr 9 03:32:01 PDT 2019


 Tested ''LLVM_DISTRIBUTION_COMPONENTS' and it doesn't work as I expected so I am sticking to I found working for me. In case anyone is interested here is what I did:
https://github.com/pal1000/mesa-dist-win/blob/master/buildscript/modules/ninjallvmbuild.cmd
-----------------------------------------------------------------------------------



    On Friday, April 5, 2019, 10:36:11 PM GMT+3, Liviu Prodea <liviuprodea at yahoo.com> wrote:  
 
 I kind of figured it out and scripted the targets picking solution myself but that 'LLVM_DISTRIBUTION_COMPONENTS' option is definitely better as it should work with both MsBuild and ninja. Too bad this isn't in the docs though:
https://llvm.org/docs/CMake.html#llvm-specific-variables   On Friday, April 5, 2019, 8:44:43 PM GMT+3, Chris Bieneman <chris.bieneman at me.com> wrote:  
 
 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
After reading
https://llvm.org/devmtg/2015-04/slides/eurollvm-2015-build.pdf
and
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/20190409/1f213908/attachment.html>


More information about the llvm-dev mailing list