-
Notifications
You must be signed in to change notification settings - Fork 6
87 lines (77 loc) · 3.67 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: build
concurrency:
group: build-${{ github.head_ref }}
cancel-in-progress: true
on:
push:
branches:
- main
tags-ignore:
- llvmorg-*
pull_request:
branches:
- main
jobs:
build:
name: Build llvm on Windows
runs-on: windows-2022
strategy:
matrix:
rtlib: ["MultiThreadedDLL"]
steps:
- name: Install dependency
uses: crazy-max/ghaction-chocolatey@v1
with:
args: install ninja vswhere 7zip.install
- name: Upgrade dependency
uses: crazy-max/ghaction-chocolatey@v1
with:
args: upgrade llvm
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 26100
- name: Download libxml2
run: |
Invoke-WebRequest -Uri http://xmlsoft.org/sources/win32/libxml2-2.7.8.win32.zip -OutFile libxml2-2.7.8.win32.zip
Expand-Archive -Path libxml2-2.7.8.win32.zip -DestinationPath .
- name: Checkout by pushing tags
run: git clone --branch llvmorg-19.1.6 --depth 1 /~https://github.com/llvm/llvm-project.git
- name: Build llvm stage 1
run: |
$vsPath = (vswhere -latest -property installationPath)
Import-Module (Join-Path $vsPath "Common7\Tools\Microsoft.VisualStudio.DevShell.dll")
Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation -DevCmdArguments "-arch=x64 -host_arch=x64 -winsdk=10.0.26100.0"
$Env:CC = "clang-cl"
$Env:CXX = "clang-cl"
$cmake_sys_ver = "10.0.26100.0"
$libxml2 = "$pwd\\libxml2-2.7.8.win32"
cmake -Bbuild -GNinja "-DCMAKE_SYSTEM_VERSION=$cmake_sys_ver" -DCMAKE_MSVC_RUNTIME_LIBRARY=${{ matrix.rtlib }} -DCMAKE_BUILD_TYPE=Release -DCPACK_GENERATOR=ZIP "-DCMAKE_INSTALL_PREFIX=$pwd\\prefix" -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_ENABLE_PROJECTS="lld;clang;clang-tools-extra" -DLLVM_ENABLE_DIA_SDK=OFF -DLIBXML2_INCLUDE_DIR="$libxml2\\include\\libxml2" -DLIBXML2_LIBRARY="$libxml2\\lib\\libxml2_a.lib" llvm-project\\llvm
cmake --build build --target package
Expand-Archive -Path build/*.zip -DestinationPath "$pwd"
Remove-Item -Recurse -Force build
- name: Build llvm stage 2
run: |
$vsPath = (vswhere -latest -property installationPath)
Import-Module (Join-Path $vsPath "Common7\Tools\Microsoft.VisualStudio.DevShell.dll")
Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation -DevCmdArguments "-arch=x64 -host_arch=x64 -winsdk=10.0.26100.0"
$Env:CC = "$pwd\\LLVM-19.1.6-win64\\bin\\clang-cl.exe"
$Env:CXX = "$pwd\\LLVM-19.1.6-win64\\bin\\clang-cl.exe"
$cmake_sys_ver = "10.0.26100.0"
$libxml2 = "$pwd\\libxml2-2.7.8.win32"
cmake -Bbuild -GNinja "-DCMAKE_SYSTEM_VERSION=$cmake_sys_ver" -DCMAKE_MSVC_RUNTIME_LIBRARY=${{ matrix.rtlib }} -DCMAKE_BUILD_TYPE=Release -DCPACK_GENERATOR=ZIP "-DCMAKE_INSTALL_PREFIX=$pwd\\prefix" -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_ENABLE_PROJECTS="lld;clang;clang-tools-extra" -DLLVM_ENABLE_DIA_SDK=OFF -DLIBXML2_INCLUDE_DIR="$libxml2\\include\\libxml2" -DLIBXML2_LIBRARY="$libxml2\\lib\\libxml2_a.lib" llvm-project\\llvm
cmake --build build --target package
- name: Repack zip package
run: |
$name = (Get-Item build/LLVM-*.zip).Name
$basename = (Get-Item build/LLVM-*.zip).BaseName
Remove-Item -Recurse -Force "$basename"
Expand-Archive -Path "build/$name" -DestinationPath "$pwd"
Remove-Item "build/$name"
7z a -mx=9 -tzip -mtm=off -mtc=off -mta=off "build/$name" "$basename"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: llvm-${{ matrix.rtlib }}
path: build/*.zip
retention-days: 14
compression-level: 0