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:
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...@lists.llvm.org> De la part de blackthirt33n . via llvm-dev
Envoyé : April 11, 2020 7:46 PM
À : llvm...@lists.llvm.org
Objet : [llvm-dev] using the bat script build_llvm_package.bat on windows
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
You have Strawberry Perl installed, and that comes with MinGW. cmake picks up the GNU binutils inside that distribution, instead of MSVC cl.exe. Like Brian suggested, there are too many link jobs going on, so you could re-run `ninja check-all -j 2`, but that will be slower to build.
If you want to build the first stage with MSVC, do this (because cmake doesn’t like backslashes):
D:\llvm-project> set VS2017=%VCToolsInstallDir:\=/%
And the re-run cmake, telling it explicitly which compiler it should use (similar to what you’ll do for the second stage):
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" -DCMAKE_C_COMPILER="%VS2017%/bin/HostX64/x64/cl.EXE" -DCMAKE_CXX_COMPILER="%VS2017%/bin/HostX64/x64/cl.EXE" -DCMAKE_LINKER="%VS2017%/bin/HostX64/x64/link.EXE"
De : llvm-dev <llvm-dev...@lists.llvm.org>
De la part de blackthirt33n . via llvm-dev
Envoyé : April 12, 2020 6:59 PM
À : llvm...@lists.llvm.org
Objet : Re: [llvm-dev] using the bat script build_llvm_package.bat on windows