Watch
2
0
Fork
You've already forked raylib-cs
0

WASM support, using official binaries (#341)

* chg: New build system that uses the officially distributed binaries, bumped version to 8.0.0, simplified git workflow, removed deprecated OpenGL 1.1 functionality.

* chg: Modernize CI workflow, enable SourceLink

- Bump workflow actions to latest majors (Node 24); drop deprecated softprops/action-gh-release@v1
- Trigger push builds on main instead of master
- Create local nuget feed dir before pack (fixes NU1301)
- Enable Microsoft.SourceLink.GitHub for debugging symbols (ref PR #340)

* fix: centralized version data in Directory.build.props, and fixed various interop details that had incorrect function signatures

* chore: updated readme

* fix: version the native extract marker and chain download via DependsOnTargets

The .extracted marker now includes the raylib package name, so bumping
TargetRaylibTag re-extracts the new archive instead of silently keeping
(and packing/copying) the previous version's files.

_PrepareNativeLibrary and _StageWasmNative now depend directly on
_DownloadAndExtractInternal instead of CallTarget-ing it; dependency
targets run in the same project instance, so the resolved properties
(RaylibPackageName etc.) propagate naturally.

* fix: let the binding build for browser-wasm on both net8.0 and net10.0

The net8-era wasm workload (Microsoft.NET.Runtime.WebAssembly.Sdk 8.0.x,
auto-imported for RID browser-wasm) treats every browser-wasm project as
a wasm app: it forces OutputType=Exe after project evaluation (CS5001
for a classlib) and hooks its app-bundle build after Build, which errors
because a library has no assemblies to bundle. Opt Raylib-cs out via
DisableAutoWasmBuildApp (props time, before the workload defaults its
trigger) and pin OutputType back to Library in Directory.Build.targets
(evaluated after the workload props, so the assignment wins). net10's
wasm SDK needs neither workaround.

* chore: readme updated

* chg: simplifying build logic - a simple line in the documentation should save us the code here

* fix: Wrong signature of FrameBufferComplete

* chore: readme update

* feat: samples default to local project reference, and can optionally use the nuget package

* fix: Examples.csproj runs the download task when building locally
This commit is contained in:
tiger tiger tiger 2026-07-20 19:39:19 +02:00 committed by GitHub
commit 565f0912ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 403 additions and 364 deletions

View file

@ -1,4 +1,8 @@
name: Build
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET
on:
push:
branches: ["main"]
@ -7,186 +11,46 @@ on:
paths-ignore:
- "README.md"
- ".github/ISSUE_TEMPLATE/**"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.version.outputs.version }}
pkgversion: ${{ steps.version.outputs.pkgversion }}
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v4
- uses: actions/checkout@v7
- name: check raylib version
id: version
shell: bash
run: |
echo "version=$(sed -n 's/.*<TargetRaylibTag>\(.*\)<\/TargetRaylibTag>.*/\1/p' Raylib-cs/Build.props)">> ${GITHUB_OUTPUT}
echo "pkgversion=$(sed -n 's/.*<PackageVersion>\(.*\)<\/PackageVersion>.*/\1/p' Raylib-cs/Build.props)">> ${GITHUB_OUTPUT}
build-linux:
runs-on: ubuntu-22.04
needs: build
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: setup dotnet
uses: actions/setup-dotnet@v4
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
6.0.x
8.0.x
9.0.x
10.0.x
- name: setup dependencies
run: |
sudo apt-get update
sudo apt-get install \
libasound2-dev \
libx11-dev \
libxrandr-dev \
libxi-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
libxcursor-dev \
libxinerama-dev
- name: Prepare local NuGet source
run: mkdir -p nuget
- name: build projects
run: dotnet build -c Release
- name: run tests
run: dotnet test Raylib-cs.Tests -c Release
- name: upload build
uses: actions/upload-artifact@v4
with:
name: linux-x64
path: Raylib-cs.Native/bin/Release/native/raylib/libraylib.so
if-no-files-found: error
build-osx:
runs-on: macos-latest
needs: build
strategy:
matrix:
name: [arm64, x64]
include:
- name: arm64
arch: arm64
- name: x64
arch: x86_64
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
- name: build projects
run: dotnet build -c Release /p:BuildArch=${{ matrix.arch }}
- name: run tests
run: dotnet test Raylib-cs.Tests -c Release
- name: upload build
uses: actions/upload-artifact@v4
with:
name: osx-${{ matrix.name }}
path: Raylib-cs.Native/bin/Release/native/raylib/libraylib.dylib
if-no-files-found: error
build-windows:
runs-on: windows-latest
needs: build
strategy:
matrix:
name: [x86, x64]
include:
- name: x86
arch: win32
- name: x64
arch: x64
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
- name: build projects
run: dotnet build -c Release /p:BuildArch=${{ matrix.arch }}
- name: run tests
run: dotnet test Raylib-cs.Tests -c Release
- name: upload build
uses: actions/upload-artifact@v4
with:
name: win-${{ matrix.name }}
path: Raylib-cs.Native/bin/Release/native/raylib/Release/raylib.dll
if-no-files-found: error
build-publish:
runs-on: ubuntu-22.04
needs:
- build-linux
- build-osx
- build-windows
steps:
- name: checkout repository
uses: actions/checkout@v4
- uses: actions/download-artifact@v4.1.7
with:
name: linux-x64
path: Raylib-cs/runtimes/linux-x64/native
- uses: actions/download-artifact@v4.1.7
with:
name: osx-arm64
path: Raylib-cs/runtimes/osx-arm64/native
- uses: actions/download-artifact@v4.1.7
with:
name: osx-x64
path: Raylib-cs/runtimes/osx-x64/native
- uses: actions/download-artifact@v4.1.7
with:
name: win-x86
path: Raylib-cs/runtimes/win-x86/native
- uses: actions/download-artifact@v4.1.7
with:
name: win-x64
path: Raylib-cs/runtimes/win-x64/native
- name: setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
- name: create NuGet Package
- name: Create NuGet Package
run: dotnet pack Raylib-cs -c Release --output nuget
- name: Restore + Install Built Package
run: |
dotnet restore
- name: Run Tests
run: |
dotnet test --verbosity normal
- name: upload NuGet Package As Artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
path: nuget/*
- name: upload NuGet Package As Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v3
if: startsWith(github.ref, 'refs/tags/')
with:
files: nuget/*