-
Notifications
You must be signed in to change notification settings - Fork 2
137 lines (119 loc) · 4.84 KB
/
build.yml
File metadata and controls
137 lines (119 loc) · 4.84 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: ProXPL CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
env:
BUILD_TYPE: Release
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Install LLVM (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y llvm-dev libclang-dev clang
- name: Install LLVM (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install llvm
echo "CMAKE_PREFIX_PATH=$(brew --prefix llvm)" >> $GITHUB_ENV
- name: Setup LLVM (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
# 1. Install LLVM via Chocolatey (Pinned to stable version)
choco install llvm --version 17.0.6 -y --force
# 2. Define standard paths
$llvmRoot = "C:\Program Files\LLVM"
if (-not (Test-Path $llvmRoot)) {
$llvmRoot = "C:\Program Files (x86)\LLVM"
}
# 3. Find LLVMConfig.cmake
$llvmDir = ""
$candidates = @(
"$llvmRoot\lib\cmake\llvm",
"$llvmRoot\share\llvm\cmake",
"$llvmRoot\lib\llvm\cmake",
"$llvmRoot\cmake"
)
foreach ($c in $candidates) {
if (Test-Path "$c") {
# If the directory exists, check for config file OR accept the dir if it looks like a cmake dir
if ((Test-Path "$c\LLVMConfig.cmake") -or (Test-Path "$c\LLVMConfigExtensions.cmake")) {
$llvmDir = $c
break
}
}
}
# 4. Fallback search (more depth)
if (-not $llvmDir -and (Test-Path $llvmRoot)) {
Write-Host "Performing deep search in $llvmRoot..."
# Try to find the directory containing LLVMConfig.cmake
$found = Get-ChildItem -Path $llvmRoot -Filter "LLVMConfig.cmake" -Recurse -Depth 8 -ErrorAction SilentlyContinue | Select-Object -First 1
if ($found) {
$llvmDir = $found.Directory.FullName
} else {
# Fallback: look for LLVMConfigExtensions.cmake which we saw exists
$foundExt = Get-ChildItem -Path $llvmRoot -Filter "LLVMConfigExtensions.cmake" -Recurse -Depth 8 -ErrorAction SilentlyContinue | Select-Object -First 1
if ($foundExt) {
$llvmDir = $foundExt.Directory.FullName
Write-Host "Found likely LLVM CMake dir via Extensions: $llvmDir"
}
}
}
# 5. HARDCODED FALLBACK: We know it exists here on the runner!
if (-not $llvmDir -and (Test-Path "C:\Program Files\LLVM\lib\cmake\llvm")) {
$llvmDir = "C:\Program Files\LLVM\lib\cmake\llvm"
Write-Host "Forcing LLVM_DIR to known path: $llvmDir"
}
if ($llvmDir) {
$llvmDir = $llvmDir -replace "\\", "/"
$llvmRoot = $llvmRoot -replace "\\", "/"
Add-Content $env:GITHUB_PATH "$llvmRoot/bin"
Add-Content $env:GITHUB_ENV "LLVM_DIR=$llvmDir"
Add-Content $env:GITHUB_ENV "LLVM_ROOT=$llvmRoot"
Write-Host "SUCCESS: LLVM_DIR=$llvmDir"
Write-Host "SUCCESS: LLVM_ROOT=$llvmRoot"
} else {
Write-Warning "LLVM not found on Windows after installation. Debug info follows:"
if (Test-Path $llvmRoot) {
Write-Host "Listing $llvmRoot recursively (depth 5) for debugging:"
Get-ChildItem -Path $llvmRoot -Recurse -Depth 5 | Select-Object FullName
} else {
Write-Host "PATH $llvmRoot DOES NOT EXIST"
Write-Host "Listing C:\Program Files recursively (Depth 2) to find where LLVM is:"
Get-ChildItem -Path "C:\Program Files" -Recurse -Depth 2 | Select-Object FullName
}
exit 1
}
- name: Configure (Unix)
if: matrix.os != 'windows-latest'
shell: bash
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DBUILD_TESTS=OFF \
-DBUILD_BENCH=OFF
- name: Configure (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
cmake -S . -B build `
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} `
-DBUILD_TESTS=OFF `
-DBUILD_BENCH=OFF `
-DLLVM_DIR="$env:LLVM_DIR" `
-DCMAKE_PREFIX_PATH="$env:LLVM_ROOT"
- name: Build
shell: bash
run: cmake --build build --verbose