[llvm-dev] using the bat script build_llvm_package.bat on windows

Alexandre Ganea via llvm-dev llvm-dev at lists.llvm.org
Sun Apr 12 11:24:59 PDT 2020


build_llvm_package.bat is only a template for building releases.

You can use it as reference, but for a two-stage build the simplest you can do is:


  1.  Ensure cmake, ninja build, python, GnuWin32 are installed and available in %PATH%.
  2.  Start “x64 Native Tools Command Prompt for VS 2017” from the Start menu/Visual Studio 2017.
  3.  ‘cd’ to the root of your git checkout and run:


D:\llvm-project> mkdir build1 && cd build1

D:\llvm-project\build1> cmake -GNinja ../llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_ENABLE_PROJECTS="llvm;clang;lld"
(…)

D:\llvm-project\build1> ninja check-all

The first stage will therefore use MSVC. If the above commands succeed, you can move on to stage 2:

D:\llvm-project\build1> cd .. && mkdir build2 && cd build2

D:\llvm-project\build2> cmake -GNinja ../llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_ENABLE_LIBXML2=OFF -DCMAKE_C_COMPILER="../build1/bin/clang-cl.exe" -DCMAKE_CXX_COMPILER="../build1/bin/clang-cl.exe" -DCMAKE_LINKER="../build1/bin/lld-link.exe" -DLLVM_ENABLE_LLD=ON -DCMAKE_CXX_FLAGS="-Xclang -O3" -DCMAKE_C_FLAGS="-Xclang -O3" -DLLVM_ENABLE_PROJECTS="llvm;clang;lld" -DCLANG_TABLEGEN="../build1/bin/clang-tblgen.exe" -DLLVM_TABLEGEN="../build1/bin/llvm-tblgen.exe"

D:\llvm-project\build2> ninja check-all

You should have now the binaries for the second stage in build2\bin.

This is only an example. You can then take a look at https://llvm.org/docs/CMake.html for extra cmake flags that can be used to tweak your build. You could for example use ThinLTO on the second stage, by adding -DLLVM_ENABLE_LTO=Thin. You can also use `cmake-gui` if you don’t want to go through command-lines (ensure it points to the right build stage).

Best,
Alex.

De : llvm-dev <llvm-dev-bounces at lists.llvm.org> De la part de blackthirt33n . via llvm-dev
Envoyé : April 11, 2020 7:46 PM
À : llvm-dev at lists.llvm.org
Objet : [llvm-dev] using the bat script build_llvm_package.bat on windows

where should the file build_llvm_package.bat be placed and how should the build_llvm_package.bat be called?
or
is there a another way to do a two stage build of the llvm project on windows starting with using visual studio 2017 community.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200412/31feaa92/attachment.html>


More information about the llvm-dev mailing list