Skip to content
name: windows-llvm-msvc-build
permissions:
contents: write
on: [push, pull_request]
jobs:
build:
# Skip building pull requests from the same repository
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
runs-on: windows-2022
env:
BUILD_TYPE: Release
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
path: llvm-msvc
submodules: 'recursive'
- name: Install vswhere
run: |
choco install vswhere --version 2.8.4 --force
- name: Setup MSVC
run: |
$vsPath = &vswhere -version 17.8.5 -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
echo "VSINSTALLDIR=$vsPath" >> $env:GITHUB_ENV
echo "PATH=$vsPath\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64;$env:PATH" >> $env:GITHUB_ENV
- name: Build llvm
run: |
cmake -Bbuild -G "Visual Studio 17 2022" -A x64 `
-DHAVE_STD_IS_TRIVIALLY_COPYABLE=0 -DLLVM_TOOL_LLVM_SHLIB_BUILD=off `
-DLLVM_INCLUDE_TESTS=OFF `
-DLLVM_INCLUDE_TOOLS=ON `
-DLLVM_INCLUDE_EXAMPLES=OFF `
-DLLDB_ENABLE_PYTHON=OFF `
-DLLVM_ENABLE_LIBXML2=OFF `
-DLLVM_ENABLE_ZLIB=OFF `
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} `
-DLLVM_USE_CRT_RELEASE=MT `
-DCMAKE_INSTALL_PREFIX=install `
-DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64;Mips;RISCV" `
-DLLVM_ENABLE_PROJECTS="clang;lld;lldb;clang-tools-extra" `
llvm-msvc\\llvm
cmake --build build --config ${{ env.BUILD_TYPE }} --verbose
cmake --build build --config ${{ env.BUILD_TYPE }} --target install --verbose
- name: Package llvm
run: |
7z a -v1500m windows-llvm-msvc.zip install
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: windows-llvm-msvc
path: windows-llvm-msvc.zip.00*
- name: Release
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
prerelease: ${{ !startsWith(github.ref, 'refs/tags/v') || contains(github.ref, '-pre') }}
files: windows-llvm-msvc.zip.00*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}