isle-portable/.github/workflows/ci.yml
David Gow c8284e268d
miniwin: Remove GLEW dependency for OpenGL 1.1
GLEW normally backs directly onto glXGetProcAddress on Linux, which is broken
on non-GLX setups, such as Wayland (but also X11 with EGL, and presumably KMSDRM).

Replace it with manual calls to SDL_GL_GetProcAddress() for the VBO path.

Note, however, that SDL_opengl.h includes "windows.h", so conflicts with the
miniwin implementation, which breaks builds on windows.

In order to work around this, we do what the Direct3D9 implementation does and
push all of the OpenGL calls to a separate file, actual.cpp.

Going forward, it may make sense to load _all_ OpenGL entry points via SDL,
which would allow us to avoid linking directly with libGL/libOpenGL, and
therefore eliminate the separate build dependency altogether, as well as
allowing more runtime configurability as to the OpenGL library to load.

(But that's definitely a bit uglier, and also useful very rarely.)
2025-06-29 21:34:39 +08:00

151 lines
5.5 KiB
YAML

name: CI
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
clang-format:
name: 'clang-format'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run clang-format
run: |
find CONFIG LEGO1 ISLE miniwin -iname '*.h' -o -iname '*.cpp' | xargs \
pipx run "clang-format>=17,<18" \
--style=file \
-i
- name: Check diff
run: |
git diff --exit-code
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.shell || 'sh' }}
strategy:
fail-fast: false
matrix:
include:
- { name: 'Linux', os: 'ubuntu-latest', dx5: false, config: true, build-type: 'Debug', linux: true, werror: true, clang-tidy: true }
- { name: 'MSVC (x86)', os: 'windows-latest', dx5: true, config: false, build-type: 'Debug', msvc: true, werror: false, clang-tidy: false, vc-arch: 'amd64_x86' }
- { name: 'MSVC (x64)', os: 'windows-latest', dx5: false, config: false, build-type: 'Debug', msvc: true, werror: false, clang-tidy: false, vc-arch: 'amd64' }
- { name: 'MSVC (arm64)', os: 'windows-latest', dx5: false, config: false, build-type: 'Debug', msvc: true, werror: false, clang-tidy: false, vc-arch: 'amd64_arm64' }
- { name: 'msys2 mingw32', os: 'windows-latest', dx5: false, config: false, build-type: 'Debug', mingw: true, werror: true, clang-tidy: true, msystem: 'mingw32', msys-env: 'mingw-w64-i686', shell: 'msys2 {0}' }
- { name: 'msys2 mingw64', os: 'windows-latest', dx5: false, config: true, build-type: 'Debug', mingw: true, werror: true, clang-tidy: true, msystem: 'mingw64', msys-env: 'mingw-w64-x86_64', shell: 'msys2 {0}' }
- { name: 'macOS', os: 'macos-latest', dx5: false, config: true, build-type: 'Debug', brew: true, werror: true, clang-tidy: false }
- { name: 'Emscripten', os: 'ubuntu-latest', dx5: false, config: false, build-type: 'Debug', emsdk: true, werror: true, clang-tidy: false, cmake-wrapper: 'emcmake' }
steps:
- name: Setup vcvars
if: ${{ !!matrix.msvc }}
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.vc-arch }}
- name: Set up MSYS2
if: ${{ !!matrix.msystem }}
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
install: >-
${{ matrix.msys-env }}-cc
${{ matrix.msys-env }}-cmake
${{ matrix.msys-env }}-ninja
${{ matrix.msys-env }}-clang-tools-extra
${{ (matrix.config && format('{0}-qt6-base', matrix.msys-env)) || '' }}
- name: Install Linux dependencies (apt-get)
if: ${{ matrix.linux }}
run: |
sudo apt-get update
sudo apt-get install -y \
libx11-dev libxext-dev libxrandr-dev libxrender-dev libxfixes-dev libxi-dev libxinerama-dev \
libxcursor-dev libwayland-dev libxkbcommon-dev wayland-protocols libgl1-mesa-dev qt6-base-dev \
libasound2-dev
- name: Install macOS dependencies (brew)
if: ${{ matrix.brew }}
run: |
brew update
brew install cmake ninja llvm qt6
echo "LLVM_ROOT=$(brew --prefix llvm)/bin" >> $GITHUB_ENV
- name: Setup Emscripten
uses: mymindstorm/setup-emsdk@master
if: ${{ matrix.emsdk }}
- name: Setup ninja
if: ${{ matrix.msvc }}
uses: ashutoshvarma/setup-ninja@master
- uses: actions/checkout@v4
- name: Configure (CMake)
run: |
${{ matrix.cmake-wrapper || '' }} cmake -S . -B build -GNinja \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DISLE_USE_DX5=${{ !!matrix.dx5 }} \
-DISLE_BUILD_CONFIG=${{ matrix.config }} \
-DENABLE_CLANG_TIDY=${{ !!matrix.clang-tidy }} \
-DISLE_WERROR=${{ !!matrix.werror }} \
-Werror=dev
- name: Build (CMake)
run: cmake --build build --verbose
- name: Package (CPack)
run: |
cd build
cpack .
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: '${{ matrix.name }} ${{ matrix.build-type }}'
path: build/dist/isle-*
ncc:
name: 'C++'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "16"
- name: Install python libraries
run: |
pip install -r tools/requirements.txt
- name: Run ncc
run: |
action_headers=$(find LEGO1/lego/legoomni/include/actions \
-name '*.h' -print0 | xargs -0 echo)
python3 tools/ncc/ncc.py \
--clang-lib ${{ env.LLVM_PATH }}/lib/libclang.so \
--recurse \
--style tools/ncc/ncc.style \
--skip tools/ncc/skip.yml \
--definition WINAPI FAR BOOL CALLBACK HWND__=HWND SDLCALL \
--include \
util \
LEGO1 \
LEGO1/omni/include \
LEGO1/lego/legoomni/include \
LEGO1/lego/sources \
--exclude \
LEGO1/omni/include/flic.h \
LEGO1/omni/src/video/flic.cpp \
$action_headers \
--path LEGO1/omni LEGO1/lego/legoomni