Skip to content

Commit

Permalink
feat: allow installing specific Mesa3D release (#22)
Browse files Browse the repository at this point in the history
Co-authored-by: Eric Larson <[email protected]>
  • Loading branch information
RobPasMue and larsoner authored Dec 2, 2024
1 parent 58b621b commit 83c78fd
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ jobs:
matrix:
os: [macos-14, macos-13, ubuntu-24.04, ubuntu-22.04, ubuntu-20.04, windows-2019, windows-2022]
qt: [""]
mesa: [""]
include:
- os: ubuntu-20.04
qt: "pyqt5"
- os: ubuntu-24.04
qt: "pyqt6"
- os: windows-latest
qt: "pyqt6"
mesa: "latest"
- os: ubuntu-latest
qt: "pyside6"
runs-on: ${{ matrix.os }}
Expand All @@ -34,6 +36,7 @@ jobs:
uses: ./
with:
qt: ${{ matrix.qt != '' }}
mesa3d-release: ${{ matrix.mesa || '24.3.0' }}
- uses: actions/setup-python@v5
with:
python-version: "3.12"
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ jobs:
- `pyvista` (default `true`): set to `false` if you don't want to set env
vars to use PyVista in offscreen mode.

- `mesa3d-release` (default `24.3.0`): set to a specific release to install
that version of Mesa3D. This is only applicable for Windows. For example,
to install Mesa3D 21.2.5:
```yml
- uses: pyvista/setup-headless-display-action@v3
with:
mesa3d-release: 21.2.5
```
You can also use `latest` to use the latest release version.

### 🖼️ PyVista Example

```yml
Expand Down
19 changes: 19 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ inputs:
description: "Install libraries required for Qt on Linux"
required: false
default: false
mesa3d-release:
description: |
Mesa3D release to install (by default, the latest release is installed).
This is only used on Windows.
required: false
default: "24.3.0"
branding:
icon: "monitor"
color: "blue"
Expand Down Expand Up @@ -55,6 +61,19 @@ runs:
mesa-utils \
x11-utils
- name: Determine OpenGL version to install on Windows
if: runner.os == 'Windows'
shell: bash
run: |
if [ "${{ inputs.mesa3d-release }}" == "latest" ]; then
echo "Fetching latest Mesa3D release version..."
export MESA3D_VERSION=$(curl -s https://api.github.com/repos/pal1000/mesa-dist-win/releases/latest | grep -o '"tag_name": ".*"' | sed 's/"tag_name": "\(.*\)"/\1/')
else
echo "Using specified Mesa3D release version..."
export MESA3D_VERSION=${{ inputs.mesa3d-release }}
fi
echo "MESA3D_VERSION=${MESA3D_VERSION}" | tee -a $GITHUB_ENV
- name: Install OpenGL on Windows
if: runner.os == 'Windows'
shell: cmd
Expand Down
16 changes: 12 additions & 4 deletions windows/install_opengl.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
#!/bin/bash
set -exo pipefail
ls -alt /C/Windows/System32/opengl32.dll
VER="24.2.7"
NAME="mesa3d-${VER}-release-msvc"
curl -LO https://github.com/pal1000/mesa-dist-win/releases/download/${VER}/${NAME}.7z

# Check if MESA3D_VERSION variable is set
if [ -z "${MESA3D_VERSION}" ]; then
echo "MESA3D_VERSION is not set. Required to install Mesa3D..."
exit 1
fi

NAME="mesa3d-${MESA3D_VERSION}-release-msvc"
curl -LO https://github.com/pal1000/mesa-dist-win/releases/download/${MESA3D_VERSION}/${NAME}.7z
7z x ${NAME}.7z -o./${NAME}
mv -v ${NAME}/x64/* /C/Windows/System32/
# Run systemwidedeploy.cmd file: option 1) Install OpenGL drivers & 7) Update system-wide deployment
cmd.exe //c "${NAME}\systemwidedeploy.cmd 1"
cmd.exe //c "${NAME}\systemwidedeploy.cmd 7"
rm -Rf ${NAME}
# takeown "/f" "C:\Windows\System32\opengl32.dll"
# icacls "C:\Windows\System32\opengl32.dll" /grant "$USERNAME:F"
Expand Down

0 comments on commit 83c78fd

Please sign in to comment.