Add links to download build #3
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: SteamVR Driver Build & Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build OpenVR Driver (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| build_type: [RelWithDebInfo] | |
| env: | |
| CMAKE_BUILD_TYPE: ${{ matrix.build_type }} | |
| VCPKG_DEFAULT_TRIPLET: x64-windows | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| # --- Windows toolchain & deps --- | |
| - name: Bootstrap vcpkg (Windows) | |
| if: startsWith(matrix.os, 'windows') | |
| run: | | |
| $env:VCPKG_ROOT = "$PWD\vcpkg" | |
| git clone https://github.com/microsoft/vcpkg.git "$env:VCPKG_ROOT" | |
| & "$env:VCPKG_ROOT\bootstrap-vcpkg.bat" | |
| echo "VCPKG_ROOT=$env:VCPKG_ROOT" >> $env:GITHUB_ENV | |
| echo "VCPKG_INSTALLED_DIR=$env:VCPKG_ROOT\installed" >> $env:GITHUB_ENV | |
| shell: pwsh | |
| - name: Install dependencies (Windows) | |
| if: startsWith(matrix.os, 'windows') | |
| run: | | |
| & "$env:VCPKG_ROOT\vcpkg.exe" install libusb[core]:x64-windows | |
| shell: pwsh | |
| # --- Linux deps --- | |
| - name: Install dependencies (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential cmake libusb-1.0-0-dev libx11-dev libxrandr-dev | |
| # --- Configure CMake --- | |
| - name: Configure CMake (Windows) | |
| if: startsWith(matrix.os, 'windows') | |
| run: | | |
| cmake -B build -DRAYNEO_BUILD_EXAMPLES=OFF -DRAYNEO_BUILD_OPENVR_DRIVER=ON -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT\scripts\buildsystems\vcpkg.cmake" | |
| shell: pwsh | |
| - name: Configure CMake (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| cmake -B build -DRAYNEO_BUILD_EXAMPLES=OFF -DRAYNEO_BUILD_OPENVR_DRIVER=ON | |
| # --- Build targets --- | |
| - name: Build (Windows) | |
| if: startsWith(matrix.os, 'windows') | |
| run: | | |
| cmake --build build --config ${{ matrix.build_type }} --target openvr_stub_driver || true | |
| shell: pwsh | |
| - name: Build (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| cmake --build build --config ${{ matrix.build_type }} --target openvr_stub_driver || true | |
| # --- Package raw driver artifacts (Windows) --- | |
| - name: Package OpenVR driver (Windows) | |
| if: startsWith(matrix.os, 'windows') | |
| run: | | |
| $ErrorActionPreference = "SilentlyContinue" | |
| # Find driver DLL | |
| $winDriver = Get-ChildItem -Path "build\openvr_driver" -Filter "driver_rayneo.dll" -Recurse | Select-Object -First 1 | |
| if (-not $winDriver) { | |
| Write-Host "OpenVR Windows driver not found; listing build\openvr_driver" | |
| Get-ChildItem -Path "build\openvr_driver" -Recurse | Format-List | Out-Host | |
| } else { | |
| New-Item -ItemType Directory -Force -Path "openvr_driver_artifacts\rayneo\bin\win64" | Out-Null | |
| Copy-Item $winDriver.FullName "openvr_driver_artifacts\rayneo\bin\win64\driver_rayneo.dll" -Force | |
| Write-Host "Found Windows driver at $($winDriver.FullName)" | |
| } | |
| # Bundle libusb-1.0.dll from vcpkg | |
| $candidates = @() | |
| if ($env:VCPKG_INSTALLED_DIR) { | |
| $candidates += Join-Path $env:VCPKG_INSTALLED_DIR "x64-windows\bin\libusb-1.0.dll" | |
| $candidates += Join-Path $env:VCPKG_INSTALLED_DIR "x64-windows\debug\bin\libusb-1.0.dll" | |
| } | |
| if ($env:VCPKG_ROOT) { | |
| $candidates += Join-Path $env:VCPKG_ROOT "installed\x64-windows\bin\libusb-1.0.dll" | |
| $candidates += Join-Path $env:VCPKG_ROOT "installed\x64-windows\debug\bin\libusb-1.0.dll" | |
| $candidates += Join-Path $env:VCPKG_ROOT "packages\libusb_x64-windows\bin\libusb-1.0.dll" | |
| $candidates += Join-Path $env:VCPKG_ROOT "packages\libusb_x64-windows\debug\bin\libusb-1.0.dll" | |
| } | |
| $winUsb = $null | |
| foreach ($p in $candidates) { if (Test-Path $p) { $winUsb = $p; break } } | |
| if (-not $winUsb -and $env:VCPKG_ROOT) { | |
| $winUsb = Get-ChildItem -Path $env:VCPKG_ROOT -Filter "libusb-1.0.dll" -Recurse | Select-Object -First 1 | ForEach-Object { $_.FullName } | |
| } | |
| if ($winUsb) { | |
| New-Item -ItemType Directory -Force -Path "openvr_driver_artifacts\rayneo\bin\win64" | Out-Null | |
| Copy-Item $winUsb "openvr_driver_artifacts\rayneo\bin\win64\libusb-1.0.dll" -Force | |
| Write-Host "Bundled libusb from $winUsb" | |
| } else { | |
| Write-Host "libusb-1.0.dll not found in vcpkg installation" | |
| } | |
| shell: pwsh | |
| # --- Package raw driver artifacts (Linux) --- | |
| - name: Package OpenVR driver (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| set -e | |
| # Ensure target directory exists before copying driver or libusb | |
| mkdir -p openvr_driver_artifacts/rayneo/bin/linux64 | |
| DRIVER_SO=$(find build/openvr_driver -type f -name driver_rayneo.so -print -quit || true) | |
| if [ -n "$DRIVER_SO" ]; then | |
| cp "$DRIVER_SO" openvr_driver_artifacts/rayneo/bin/linux64/driver_rayneo.so | |
| echo "Found Linux driver at $DRIVER_SO" | |
| else | |
| echo "OpenVR Linux driver not found; listing build/openvr_driver" | |
| ls -R build/openvr_driver || true | |
| fi | |
| # Bundle libusb runtime .so | |
| USB_SO="/usr/lib/x86_64-linux-gnu/libusb-1.0.so.0" | |
| if [ -f "$USB_SO" ]; then | |
| cp "$USB_SO" openvr_driver_artifacts/rayneo/bin/linux64/ | |
| else | |
| USB_SO=$(ldconfig -p | awk '/libusb-1\.0\.so(\.0)?/ {print $NF; exit}' || true) | |
| if [ -n "$USB_SO" ] && [ -f "$USB_SO" ]; then | |
| cp "$USB_SO" openvr_driver_artifacts/rayneo/bin/linux64/ | |
| else | |
| echo "libusb runtime .so not found on system" | |
| fi | |
| fi | |
| - name: Upload OpenVR driver artifacts | |
| if: (matrix.os == 'windows-latest') || (matrix.os == 'ubuntu-latest') | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: openvr-driver-${{ matrix.os }} | |
| path: openvr_driver_artifacts/rayneo/** | |
| assemble: | |
| name: Assemble SteamVR Driver Zip | |
| runs-on: ubuntu-latest | |
| needs: build | |
| outputs: | |
| zip_name: ${{ steps.meta.outputs.zip_name }} | |
| tag: ${{ steps.meta.outputs.tag }} | |
| release_name: ${{ steps.meta.outputs.release_name }} | |
| steps: | |
| - name: Install zip tool | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y zip | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: false | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| - name: Compose names | |
| id: meta | |
| run: | | |
| TS=$(date -u +%Y%m%d-%H%M%S) | |
| SHORT_SHA=$(git rev-parse --short HEAD) | |
| echo "ts=$TS" >> "$GITHUB_OUTPUT" | |
| echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT" | |
| echo "zip_name=steamvr_rayneo_driver-${TS}-${SHORT_SHA}.zip" >> "$GITHUB_OUTPUT" | |
| echo "tag=steamvr-driver-${TS}-${SHORT_SHA}" >> "$GITHUB_OUTPUT" | |
| echo "release_name=SteamVR Driver ${TS}-${SHORT_SHA}" >> "$GITHUB_OUTPUT" | |
| - name: Build combined driver zip | |
| run: | | |
| set -e | |
| ZIP_NAME="${{ steps.meta.outputs.zip_name }}" | |
| mkdir -p steamvr_zip/rayneo/bin/win64 steamvr_zip/rayneo/bin/linux64 | |
| # Manifest: repo first, then artifacts fallback | |
| if [ -f openvr_driver/driver.vrdrivermanifest ]; then | |
| cp openvr_driver/driver.vrdrivermanifest steamvr_zip/rayneo/ | |
| else | |
| MANIFEST_PATH=$(find dist -type f -name driver.vrdrivermanifest -print -quit 2>/dev/null || true) | |
| if [ -n "$MANIFEST_PATH" ]; then | |
| cp "$MANIFEST_PATH" steamvr_zip/rayneo/ | |
| else | |
| echo "WARNING: driver.vrdrivermanifest not found" | |
| fi | |
| fi | |
| # Windows driver | |
| if [ -f dist/openvr-driver-windows-latest/rayneo/bin/win64/driver_rayneo.dll ]; then | |
| cp dist/openvr-driver-windows-latest/rayneo/bin/win64/driver_rayneo.dll steamvr_zip/rayneo/bin/win64/driver_rayneo.dll | |
| else | |
| WIN_DLL=$(find dist -type f -name driver_rayneo.dll -print -quit 2>/dev/null || true) | |
| if [ -n "$WIN_DLL" ]; then | |
| cp "$WIN_DLL" steamvr_zip/rayneo/bin/win64/driver_rayneo.dll || echo "Copy win64 driver failed" | |
| else | |
| echo "WARNING: Windows driver dll not found" | |
| fi | |
| fi | |
| # Windows libusb runtime | |
| WIN_USB_DLL=$(find dist -type f -name 'libusb-1.0.dll' -print -quit 2>/dev/null || true) | |
| if [ -n "$WIN_USB_DLL" ]; then | |
| cp "$WIN_USB_DLL" steamvr_zip/rayneo/bin/win64/libusb-1.0.dll || echo "Copy libusb-1.0.dll failed" | |
| else | |
| echo "WARNING: Windows libusb-1.0.dll not found" | |
| fi | |
| # Linux driver | |
| if [ -f dist/openvr-driver-ubuntu-latest/rayneo/bin/linux64/driver_rayneo.so ]; then | |
| cp dist/openvr-driver-ubuntu-latest/rayneo/bin/linux64/driver_rayneo.so steamvr_zip/rayneo/bin/linux64/ || echo "Linux64 driver missing" | |
| else | |
| LINUX_SO=$(find dist -type f -name driver_rayneo.so -print -quit 2>/dev/null || true) | |
| if [ -n "$LINUX_SO" ]; then | |
| cp "$LINUX_SO" steamvr_zip/rayneo/bin/linux64/driver_rayneo.so || echo "Copy linux64 driver failed" | |
| else | |
| echo "WARNING: Linux driver .so not found" | |
| fi | |
| fi | |
| # Linux libusb runtime | |
| LINUX_USB_SO=$(find dist -type f -regex '.*/libusb-1\.0\.so(\.[0-9]+)?$' -print -quit 2>/dev/null || true) | |
| if [ -n "$LINUX_USB_SO" ]; then | |
| cp "$LINUX_USB_SO" steamvr_zip/rayneo/bin/linux64/ || echo "Copy libusb .so failed" | |
| else | |
| echo "WARNING: Linux libusb .so not found" | |
| fi | |
| (cd steamvr_zip && zip -r "$ZIP_NAME" rayneo) | |
| mkdir -p dist/steamvr_driver | |
| cp "steamvr_zip/$ZIP_NAME" dist/steamvr_driver/ | |
| cp "steamvr_zip/$ZIP_NAME" dist/steamvr_driver/steamvr_rayneo_driver-latest.zip | |
| shell: bash | |
| - name: Upload combined driver zip | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: steamvr_rayneo_driver | |
| path: dist/steamvr_driver/${{ steps.meta.outputs.zip_name }} | |
| release: | |
| name: Create SteamVR Driver Release | |
| runs-on: ubuntu-latest | |
| needs: assemble | |
| steps: | |
| - name: Download steamvr driver artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: steamvr_rayneo_driver | |
| path: dist/steamvr_driver | |
| - name: Create SteamVR Driver Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.assemble.outputs.tag }} | |
| name: ${{ needs.assemble.outputs.release_name }} | |
| body: SteamVR driver build from ${{ github.sha }} at ${{ needs.assemble.outputs.release_name }} | |
| files: | | |
| dist/steamvr_driver/${{ needs.assemble.outputs.zip_name }} | |
| dist/steamvr_driver/steamvr_rayneo_driver-latest.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |