@@ -52,156 +52,42 @@ jobs:
5252 - name : Set up LLVM (Windows)
5353 if : matrix.os == 'windows-latest'
5454 shell : pwsh
55- run : |
56- function Find-LLVM {
57- Write-Host "--- Starting LLVM Detection ---"
58- $possiblePaths = New-Object System.Collections.Generic.List[string]
59- $possiblePaths.Add("C:\Program Files\LLVM")
60- $possiblePaths.Add("C:\Program Files (x86)\LLVM")
61- $possiblePaths.Add("C:\ProgramData\chocolatey\lib\llvm\tools\llvm")
62- $possiblePaths.Add("C:\tools\llvm")
63-
64- if ($env:ProgramFiles) { $possiblePaths.Add((Join-Path $env:ProgramFiles "LLVM")) }
65- if (${env:ProgramFiles(x86)}) { $possiblePaths.Add((Join-Path ${env:ProgramFiles(x86)} "LLVM")) }
66-
67- # Broaden search to ANY LLVM-like folder in Program Files
68- foreach ($pf in @($env:ProgramFiles, ${env:ProgramFiles(x86)}, "C:\Program Files", "C:\Program Files (x86)")) {
69- if ($pf -and (Test-Path $pf)) {
70- Get-ChildItem -Path $pf -Filter "LLVM*" -ErrorAction SilentlyContinue | ForEach-Object { $possiblePaths.Add($_.FullName) }
71- }
72- }
73-
74- $uniquePaths = $possiblePaths | Select-Object -Unique
75- $config = $null
76- $cmake = $null
77-
78- Write-Host "Checking candidate paths..."
79- foreach ($path in $uniquePaths) {
80- if ($path -and (Test-Path $path)) {
81- Write-Host " Checking: $path"
82- if (Test-Path "$path\bin\llvm-config.exe") {
83- $config = "$path\bin\llvm-config.exe"
84- Write-Host " >> Found llvm-config: $config"
85- break
86- }
87- }
88- }
89-
90- if (-not $config) {
91- Write-Host " Checking PATH for llvm-config..."
92- $config = Get-Command llvm-config -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Source
93- if ($config) { Write-Host " >> Found llvm-config in PATH: $config" }
94- }
95-
96- # Search for LLVMConfig.cmake
97- Write-Host "Searching for LLVMConfig.cmake..."
98- foreach ($path in $uniquePaths) {
99- if ($path -and (Test-Path $path)) {
100- $found = Get-ChildItem -Path $path -Filter "LLVMConfig.cmake" -Recurse -Depth 10 -ErrorAction SilentlyContinue | Select-Object -First 1
101- if ($found) {
102- $cmake = $found.FullName
103- Write-Host " >> Found LLVMConfig.cmake: $cmake"
104- break
105- }
106- }
107- }
108-
109- return @{ Config = $config; CMake = $cmake }
110- }
111-
112- $res = Find-LLVM
113- if (-not $res.Config -and -not $res.CMake) {
114- Write-Host "LLVM not initially found. Installing via Chocolatey..."
115- choco install llvm -y --version 17.0.6 --allow-downgrade --limit-output
116-
117- Write-Host "Refreshing PATH..."
118- $env:PATH = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
119-
120- $res = Find-LLVM
121- }
122-
123- if ($res.Config -or $res.CMake) {
124- $llvmRoot = $null
125- $cmakeDir = $null
126- $binDir = $null
127-
128- if ($res.Config) {
129- $binDir = Split-Path -Parent $res.Config
130- $llvmRoot = Split-Path -Parent $binDir
131- try {
132- $cmakeDir = & $res.Config --cmakedir
133- Write-Host "llvm-config reported cmakedir: $cmakeDir"
134- } catch {
135- Write-Host "llvm-config --cmakedir failed. Using fallbacks."
136- }
137- }
138-
139- if (-not $cmakeDir -and $res.CMake) {
140- $cmakeDir = Split-Path -Parent $res.CMake
141- if (-not $llvmRoot) {
142- # Heuristic: lib/cmake/llvm -> root
143- $llvmRoot = $cmakeDir
144- for ($i=0; $i -lt 3; $i++) { $llvmRoot = Split-Path -Parent $llvmRoot }
145- }
146- }
147-
148- # Final check for cmakeDir if still null
149- if (-not $cmakeDir -and $llvmRoot) {
150- $found = Get-ChildItem -Path $llvmRoot -Filter "LLVMConfig.cmake" -Recurse -Depth 6 -ErrorAction SilentlyContinue | Select-Object -First 1
151- if ($found) { $cmakeDir = $found.DirectoryName }
152- }
153-
154- if ($llvmRoot) {
155- Write-Host "Setting GITHUB_ENV: LLVM_DIR=$cmakeDir"
156- Write-Host "Setting GITHUB_ENV: CMAKE_PREFIX_PATH=$llvmRoot"
157- echo "LLVM_DIR=$cmakeDir" >> $env:GITHUB_ENV
158- echo "CMAKE_PREFIX_PATH=$llvmRoot" >> $env:GITHUB_ENV
159- if ($binDir) {
160- Write-Host "Adding to GITHUB_PATH: $binDir"
161- echo "$binDir" >> $env:GITHUB_PATH
162- } elseif (Test-Path "$llvmRoot\bin") {
163- Write-Host "Adding to GITHUB_PATH: $llvmRoot\bin"
164- echo "$llvmRoot\bin" >> $env:GITHUB_PATH
165- }
166- } else {
167- Write-Error "Could not resolve LLVM Root!"
168- exit 1
169- }
170- } else {
171- Write-Host "DUMPING C:\ PROGRAM FILES TO DEBUG:"
172- Get-ChildItem "C:\Program Files" -ErrorAction SilentlyContinue | Select-Object Name
173- Write-Error "Exhaustive LLVM detection failed after installation!"
174- exit 1
175- }
55+ run : ./scripts/setup_llvm_windows.ps1
17656
17757 - name : Configure (Unix)
17858 if : matrix.os != 'windows-latest'
17959 shell : bash
18060 run : |
18161 cmake -S . -B build \
18262 -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
183- -DBUILD_TESTS=OFF \
63+ -DBUILD_TESTS=ON \
18464 -DBUILD_BENCH=OFF
18565
18666 - name : Configure (Windows)
18767 if : matrix.os == 'windows-latest'
18868 shell : pwsh
18969 run : |
19070 Write-Host "LLVM_DIR is: $env:LLVM_DIR"
71+ Write-Host "LLVM_ROOT is: $env:LLVM_ROOT"
19172 Write-Host "CMAKE_PREFIX_PATH is: $env:CMAKE_PREFIX_PATH"
19273 cmake -S . -B build `
19374 -G "Visual Studio 17 2022" -A x64 `
19475 -DLLVM_DIR="$env:LLVM_DIR" `
195- -DCMAKE_PREFIX_PATH="$env:CMAKE_PREFIX_PATH " `
76+ -DCMAKE_PREFIX_PATH="$env:LLVM_ROOT " `
19677 -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} `
197- -DBUILD_TESTS=OFF `
78+ -DBUILD_TESTS=ON `
19879 -DBUILD_BENCH=OFF
19980
200-
20181 - name : Build
20282 shell : bash
20383 run : cmake --build build --config Release --verbose
20484
85+ - name : Run Tests
86+ shell : bash
87+ run : |
88+ cd build
89+ ctest -C Release --output-on-failure
90+
20591 - name : Run Benchmarks
20692 shell : bash
20793 run : |
@@ -231,8 +117,6 @@ jobs:
231117 uses : actions/upload-artifact@v4
232118 with :
233119 name : ProXPL-v1.2.0-${{ matrix.os }}
234- # UPDATED: This will now upload the .exe and the .dll for Windows
235- # For Linux/Mac, it still uploads the single binary.
236120 path : |
237121 ${{ matrix.bin_path }}
238- examples/
122+ examples/
0 commit comments