mirror of
https://github.com/par274/sharpemu.git
synced 2026-07-16 01:51:17 +00:00
Make external Vulkan backend optional
This commit is contained in:
@@ -1,93 +0,0 @@
|
||||
# Copyright (C) 2026 SharpEmu Emulator Project
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
name: Test Windows Native Vulkan Backend
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test-windows-native-vulkan:
|
||||
name: Build and test win-x64 native backend
|
||||
runs-on: windows-latest
|
||||
env:
|
||||
DOTNET_NOLOGO: true
|
||||
NUGET_PACKAGES: ${{ github.workspace }}\.nuget\packages
|
||||
NATIVE_BUILD_DIR: ${{ github.workspace }}\artifacts\native\gpu-vulkan
|
||||
PUBLISH_DIR: ${{ github.workspace }}\artifacts\publish\win-x64-native-test
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup .NET SDK
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 10.0.103
|
||||
cache: true
|
||||
cache-dependency-path: |
|
||||
Directory.Packages.props
|
||||
src/**/packages.lock.json
|
||||
|
||||
- name: Install native dependencies
|
||||
shell: pwsh
|
||||
run: |
|
||||
& "$env:VCPKG_INSTALLATION_ROOT\vcpkg.exe" install sdl3[vulkan]:x64-windows vulkan:x64-windows
|
||||
|
||||
- name: Configure native backend
|
||||
shell: pwsh
|
||||
run: |
|
||||
cmake `
|
||||
-S src/SharpEmu.Gpu.Vulkan.Native `
|
||||
-B "$env:NATIVE_BUILD_DIR" `
|
||||
-A x64 `
|
||||
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" `
|
||||
-DVCPKG_TARGET_TRIPLET=x64-windows `
|
||||
-DBUILD_TESTING=ON
|
||||
|
||||
- name: Build native backend and Windows-safe ABI test
|
||||
run: cmake --build "$env:NATIVE_BUILD_DIR" --config Release --target sharpemu_gpu_vulkan_exports_test
|
||||
|
||||
- name: Run native DLL load and ABI test
|
||||
run: ctest --test-dir "$env:NATIVE_BUILD_DIR" -C Release -R sharpemu_gpu_vulkan_exports_test --output-on-failure
|
||||
|
||||
- name: Restore solution
|
||||
run: dotnet restore SharpEmu.slnx --locked-mode
|
||||
|
||||
- name: Build solution
|
||||
run: dotnet build SharpEmu.slnx -c Release --no-restore
|
||||
|
||||
- name: Publish win-x64 emulator
|
||||
run: dotnet publish src/SharpEmu.CLI/SharpEmu.CLI.csproj -c Release -r win-x64 --self-contained true --no-restore -p:PublishDir="${env:PUBLISH_DIR}"
|
||||
|
||||
- name: Verify published native runtime
|
||||
shell: pwsh
|
||||
run: |
|
||||
$required = @(
|
||||
(Join-Path $env:PUBLISH_DIR 'SharpEmu.exe'),
|
||||
(Join-Path $env:PUBLISH_DIR 'sharpemu_gpu_vulkan.dll'),
|
||||
(Join-Path $env:PUBLISH_DIR 'SDL3.dll')
|
||||
)
|
||||
foreach ($path in $required) {
|
||||
if (-not (Test-Path $path)) {
|
||||
throw "Missing published runtime file: $path"
|
||||
}
|
||||
}
|
||||
|
||||
$exports = & dumpbin.exe /nologo /exports (Join-Path $env:PUBLISH_DIR 'sharpemu_gpu_vulkan.dll')
|
||||
foreach ($name in @('se_gpu_abi_version', 'se_gpu_create', 'se_gpu_submit_draw', 'se_gpu_present_bgra')) {
|
||||
if ($exports -notmatch "\b$name\b") {
|
||||
throw "Missing native GPU export: $name"
|
||||
}
|
||||
}
|
||||
|
||||
- name: Upload tested Windows package
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: sharpemu-win-x64-native-backend-test-${{ github.sha }}
|
||||
path: ${{ env.PUBLISH_DIR }}
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
62
.github/workflows/workflow.yml
vendored
62
.github/workflows/workflow.yml
vendored
@@ -96,19 +96,6 @@ jobs:
|
||||
Directory.Packages.props
|
||||
Directory.Build.props
|
||||
|
||||
- name: Install Windows native GPU dependencies
|
||||
shell: pwsh
|
||||
run: |
|
||||
& "$env:VCPKG_INSTALLATION_ROOT\vcpkg.exe" install sdl3[vulkan]:x64-windows vulkan:x64-windows
|
||||
|
||||
cmake `
|
||||
-S src/SharpEmu.Gpu.Vulkan.Native `
|
||||
-B artifacts/native/gpu-vulkan `
|
||||
-A x64 `
|
||||
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" `
|
||||
-DVCPKG_TARGET_TRIPLET=x64-windows `
|
||||
-DBUILD_TESTING=OFF
|
||||
|
||||
- name: Restore solution
|
||||
run: dotnet restore SharpEmu.slnx
|
||||
|
||||
@@ -127,19 +114,6 @@ jobs:
|
||||
- name: Publish win-x64 CLI
|
||||
run: dotnet publish src/SharpEmu.CLI/SharpEmu.CLI.csproj -c Release -r win-x64 --self-contained true --no-restore -p:PublishDir="${env:PUBLISH_DIR}"
|
||||
|
||||
- name: Verify Windows native GPU runtime
|
||||
shell: pwsh
|
||||
run: |
|
||||
$required = @(
|
||||
(Join-Path $env:PUBLISH_DIR 'sharpemu_gpu_vulkan.dll'),
|
||||
(Join-Path $env:PUBLISH_DIR 'SDL3.dll')
|
||||
)
|
||||
foreach ($path in $required) {
|
||||
if (-not (Test-Path $path)) {
|
||||
throw "Missing native GPU runtime: $path"
|
||||
}
|
||||
}
|
||||
|
||||
- name: Create release archive
|
||||
run: |
|
||||
New-Item -ItemType Directory -Path $env:RELEASE_DIR -Force | Out-Null
|
||||
@@ -191,42 +165,6 @@ jobs:
|
||||
Directory.Packages.props
|
||||
Directory.Build.props
|
||||
|
||||
- name: Install Linux native GPU dependencies
|
||||
if: matrix.rid == 'linux-x64'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install --yes \
|
||||
autoconf \
|
||||
autoconf-archive \
|
||||
automake \
|
||||
libegl1-mesa-dev \
|
||||
libibus-1.0-dev \
|
||||
libtool \
|
||||
libltdl-dev \
|
||||
libvulkan-dev \
|
||||
libwayland-dev \
|
||||
libxkbcommon-dev \
|
||||
pkg-config
|
||||
"$VCPKG_INSTALLATION_ROOT/vcpkg" install sdl3[vulkan]:x64-linux
|
||||
cmake \
|
||||
-S src/SharpEmu.Gpu.Vulkan.Native \
|
||||
-B artifacts/native/gpu-vulkan \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" \
|
||||
-DVCPKG_TARGET_TRIPLET=x64-linux \
|
||||
-DBUILD_TESTING=OFF
|
||||
|
||||
- name: Install macOS native GPU dependencies
|
||||
if: matrix.rid == 'osx-x64'
|
||||
run: |
|
||||
brew install sdl3 vulkan-loader vulkan-headers
|
||||
cmake \
|
||||
-S src/SharpEmu.Gpu.Vulkan.Native \
|
||||
-B artifacts/native/gpu-vulkan \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_PREFIX_PATH="$(brew --prefix)" \
|
||||
-DBUILD_TESTING=OFF
|
||||
|
||||
- name: Restore solution
|
||||
run: dotnet restore SharpEmu.slnx
|
||||
|
||||
|
||||
Reference in New Issue
Block a user