Merge branch 'fix-ci-build' #67
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |