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

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.

This commit is contained in:
Tiger Jove 2026-01-04 15:35:55 +01:00 committed by tiger tiger tiger
commit ccb74af7cd
20 changed files with 296 additions and 357 deletions

View file

@ -1,185 +1,46 @@
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: on:
push: push:
branches: ["main"] branches: ["master"]
pull_request: pull_request:
branches: ["*"] branches: ["*"]
paths-ignore: paths-ignore:
- "README.md" - "README.md"
- ".github/ISSUE_TEMPLATE/**" - ".github/ISSUE_TEMPLATE/**"
workflow_dispatch: workflow_dispatch:
jobs: jobs:
build: build:
runs-on: ubuntu-22.04 runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
pkgversion: ${{ steps.version.outputs.pkgversion }}
steps: steps:
- name: checkout repository - uses: actions/checkout@v4
uses: actions/checkout@v4
- name: check raylib version - name: Setup .NET
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 uses: actions/setup-dotnet@v4
with: with:
dotnet-version: | dotnet-version: |
6.0.x
8.0.x 8.0.x
9.0.x
10.0.x
- name: setup dependencies - name: Create NuGet Package
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: 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
run: dotnet pack Raylib-cs -c Release --output nuget 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 - name: upload NuGet Package As Artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:

View file

@ -21,7 +21,6 @@
using System.Numerics; using System.Numerics;
using Raylib_cs;
using static Raylib_cs.Raylib; using static Raylib_cs.Raylib;
namespace Examples.Core; namespace Examples.Core;

View file

@ -5,8 +5,9 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<StartupObject>Examples.Program</StartupObject> <StartupObject>Examples.Program</StartupObject>
<RunWorkingDirectory>$(MSBuildThisFileDirectory)</RunWorkingDirectory> <RunWorkingDirectory>$(MSBuildThisFileDirectory)</RunWorkingDirectory>
<LangVersion>default</LangVersion> <LangVersion>12</LangVersion>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -19,7 +20,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="../Raylib-cs/Raylib-cs.csproj" /> <PackageReference Include="Raylib-cs" Version="8.0.0"/>
<ProjectReference Include="../Raylib-cs.Native/Raylib-cs.Native.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -11,6 +11,7 @@
using System; using System;
using System.Numerics; using System.Numerics;
using Raylib_cs;
using static Raylib_cs.Raylib; using static Raylib_cs.Raylib;
namespace Examples.Shapes; namespace Examples.Shapes;

7
NuGet.config Normal file
View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="LocalRaylibBuild" value="./nuget" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>

View file

@ -13,17 +13,30 @@ C# bindings for raylib, a simple and easy-to-use library to learn videogames pro
Raylib-cs targets net8.0, net10.0 and uses the [official 6.0 release](https://github.com/raysan5/raylib/releases/tag/6.0) Raylib-cs targets net8.0, net10.0 and uses the [official 6.0 release](https://github.com/raysan5/raylib/releases/tag/6.0)
to build the native libraries. to build the native libraries.
### Version 8.0.0 of Raylib-cs supports the following runtimes:
- **browser-wasm** *(raylib-6.0_webassembly)* 🆕
- **linux-x64** *(raylib-6.0_linux_amd64)*
- **osx-arm64** *(raylib-6.0_macos)*
- **osx-x64** *(raylib-6.0_macos)*
- **win-x64** *(raylib-6.0_win64_msvc16)*
- **win-x86** *(raylib-6.0_win32_msvc16)*
The following frameworks are deprecated (fall back to Version 7.x if required):
- net6.0 (end of life)
## Status ## Status
Raylib-cs is passively maintained. Occasional updates may be released from time to time. Pull requests may be Raylib-cs is passively maintained. Occasional updates may be released from time to time. Pull requests may be
accepted if they don't have a large maintainence burden. accepted if they don't have a large maintenance burden.
## Installation - NuGet ## Installation - NuGet
This is the prefered method to get started. This is the preferred method to get started.
1) Pick a folder in which you would like to start a raylib project. For example "MyRaylibCSProj". 1) Pick a folder in which you would like to start a raylib project. For example, "MyRaylibCSProj."
2) Then from a terminal whilst in the directory you just created run the following commands. (Please keep in mind .NET should already be installed on your system). 2) Then from a terminal (for example, a VSCode terminal), whilst in the directory you just created
run the following commands. (Please keep in mind .NET should already be installed on your system)
``` ```
dotnet new console dotnet new console
@ -34,9 +47,11 @@ dotnet add package Raylib-cs
[![NuGet](https://img.shields.io/nuget/dt/raylib-cs)](https://www.nuget.org/packages/Raylib-cs/) [![NuGet](https://img.shields.io/nuget/dt/raylib-cs)](https://www.nuget.org/packages/Raylib-cs/)
If you need to edit Raylib-cs source then you will need to add the bindings as a project (see below). If you need to edit the Raylib-cs source, then you will need to add the bindings as a project (see below).
Remember if you are trying to run the above commands in the terminal that you need to be *inside the intended project directory* (not just inside the solution directory) otherwise the command won't work. If you are new to using NuGet (or you've forgotten) and are trying to run the above command in the command prompt,
remember that you need to be *inside the intended project directory* (not just inside the solution directory);
otherwise the command won't work.
## Installation - Manual ## Installation - Manual
@ -46,9 +61,9 @@ Remember if you are trying to run the above commands in the terminal that you ne
3. Download/build the native libraries for the platforms you want using the [official 6.0 release](https://github.com/raysan5/raylib/releases/tag/6.0). **NOTE: the MSVC version is required for Windows platforms** 3. Download/build the native libraries for the platforms you want using the [official 6.0 release](https://github.com/raysan5/raylib/releases/tag/6.0). **NOTE: the MSVC version is required for Windows platforms**
4. Add the native libraries to your project so they are in the same directory as the executable/can be found in the [search path](https://www.mono-project.com/docs/advanced/pinvoke/). 4. Set up the native libraries, so they are in the same directory as the executable/can be found in the [search path](https://www.mono-project.com/docs/advanced/pinvoke/).
6. Start coding! 5. Start coding!
## Hello, World! ## Hello, World!

View file

@ -1,5 +0,0 @@
namespace Raylib_cs.Native;
internal class Native
{
}

View file

@ -1,71 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk" InitialTargets="ConfigureNative">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<DebugType>none</DebugType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDependencyFile>False</GenerateDependencyFile>
</PropertyGroup>
<Import Project="../Raylib-cs/Build.props" />
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Linux'))">
<NativeExt>so</NativeExt>
<NativePre>lib</NativePre>
<NativeArch>x64</NativeArch>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('OSX'))">
<NativeExt>dylib</NativeExt>
<NativePre>lib</NativePre>
<NativeArch Condition="$(BuildArch) == ''">x86_x64</NativeArch>
<NativeArch Condition="$(BuildArch) != ''">$(BuildArch)</NativeArch>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
<NativeExt>dll</NativeExt>
<NativePre>$(Configuration)/</NativePre>
<NativeArch Condition="$(BuildArch) == ''">x64</NativeArch>
<NativeArch Condition="$(BuildArch) != ''">$(BuildArch)</NativeArch>
</PropertyGroup>
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('OSX')) AND $(NativeArch) == 'arm64'">
<CMakeArgs Include="-D CMAKE_OSX_ARCHITECTURES=arm64" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('OSX')) AND $(NativeArch) == 'x86_64'">
<CMakeArgs Include="-D CMAKE_OSX_ARCHITECTURES=x86_64" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::IsOsPlatform('Windows')) AND $(NativeArch) == 'win32'">
<CMakeArgs Include="-A win32" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::IsOsPlatform('Windows')) AND $(NativeArch) == 'x64'">
<CMakeArgs Include="-A x64" />
</ItemGroup>
<ItemGroup>
<Content Include="$(OutputPath)native/raylib/$(NativePre)raylib.$(NativeExt)" Link="%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" Condition="Exists('$(OutputPath)native/raylib/$(NativePre)raylib.$(NativeExt)')" />
<CMakeArgs Include="-B $(OutputPath)native" />
<CMakeArgs Include="-S $(BaseIntermediateOutputPath)raylib-$(TargetRaylibTag)" />
<CMakeArgs Include="-D CMAKE_BUILD_TYPE=$(Configuration)" />
<CMakeArgs Include="-D BUILD_SHARED_LIBS=ON" />
<CMakeArgs Include="-D BUILD_EXAMPLES=OFF" />
<CMakeArgs Include="-D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded" />
<CMakeArgs Include="-D CMAKE_MINIMUM_REQUIRED_VERSION=3.15" />
<CMakeArgs Include="-D CMAKE_POLICY_DEFAULT_CMP0091=NEW" />
<!-- <CMakeArgs Include="-D GLFW_BUILD_WAYLAND=ON" /> -->
<!-- <CMakeArgs Include="-D GRAPHICS=GRAPHICS_API_OPENGL_43" /> -->
</ItemGroup>
<Target Name="ConfigureNative" Condition="$(SkipLocalBuild) != true">
<DownloadFile SourceUrl="https://github.com/raysan5/raylib/archive/refs/tags/$(TargetRaylibTag).zip" DestinationFolder="$(BaseIntermediateOutputPath)" DestinationFileName="raylib.zip" Condition="!Exists('$(BaseIntermediateOutputPath)raylib.zip')" />
<Unzip SourceFiles="$(BaseIntermediateOutputPath)raylib.zip" DestinationFolder="$(BaseIntermediateOutputPath)" OverwriteReadOnlyFiles="true" Condition="!Exists('$(BaseIntermediateOutputPath)raylib-$(TargetRaylibTag)')" />
<Exec Command="cmake @(CMakeArgs, ' ') $(CMakeExtraArgs)" />
<Exec Command="cmake --build $(OutputPath)native --config $(Configuration)" />
</Target>
</Project>

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net10.0</TargetFrameworks> <TargetFrameworks>net8.0;net10.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>12</LangVersion> <LangVersion>12</LangVersion>
</PropertyGroup> </PropertyGroup>
@ -9,10 +9,13 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
<PackageReference Include="xunit" Version="2.6.2"/> <PackageReference Include="xunit" Version="2.6.2"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4"/> <PackageReference Include="xunit.runner.visualstudio" Version="2.5.4"/>
<PackageReference Include="coverlet.collector" Version="6.0.0" /> <PackageReference Include="coverlet.collector" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Raylib-cs\Raylib-cs.csproj" /> <PackageReference Include="Raylib-cs" Version="8.0.0"/>
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -15,7 +15,7 @@ public static class BlittableHelper
public class RaylibTests public class RaylibTests
{ {
private unsafe void CheckType<T>() where T : unmanaged private static void CheckType<T>() where T : unmanaged
{ {
Assert.True(BlittableHelper.IsBlittable<T>()); Assert.True(BlittableHelper.IsBlittable<T>());
} }

View file

@ -9,8 +9,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Raylib-cs.Tests", "Raylib-c
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Examples", "Examples\Examples.csproj", "{1E2A5986-3F11-457F-AF97-D0C08D0060BA}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Examples", "Examples\Examples.csproj", "{1E2A5986-3F11-457F-AF97-D0C08D0060BA}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Raylib-cs.Native", "Raylib-cs.Native\Raylib-cs.Native.csproj", "{B89AA313-3675-42A3-80BC-6156913E3A27}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -32,9 +30,5 @@ Global
{1E2A5986-3F11-457F-AF97-D0C08D0060BA}.Debug|Any CPU.Build.0 = Debug|Any CPU {1E2A5986-3F11-457F-AF97-D0C08D0060BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E2A5986-3F11-457F-AF97-D0C08D0060BA}.Release|Any CPU.ActiveCfg = Release|Any CPU {1E2A5986-3F11-457F-AF97-D0C08D0060BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1E2A5986-3F11-457F-AF97-D0C08D0060BA}.Release|Any CPU.Build.0 = Release|Any CPU {1E2A5986-3F11-457F-AF97-D0C08D0060BA}.Release|Any CPU.Build.0 = Release|Any CPU
{B89AA313-3675-42A3-80BC-6156913E3A27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B89AA313-3675-42A3-80BC-6156913E3A27}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B89AA313-3675-42A3-80BC-6156913E3A27}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B89AA313-3675-42A3-80BC-6156913E3A27}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View file

@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=macos/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View file

@ -1,54 +1,193 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks> <TargetFrameworks>net8.0;net10.0</TargetFrameworks>
<EnableDefaultItems>false</EnableDefaultItems>
<AssemblyName>Raylib-cs</AssemblyName> <AssemblyName>Raylib-cs</AssemblyName>
<RootNamespace>Raylib_cs</RootNamespace> <RootNamespace>Raylib_cs</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<NoWarn>$(NoWarn);1591</NoWarn>
<LangVersion>12</LangVersion> <LangVersion>12</LangVersion>
<PackageRids>win-x64;win-x86;linux-x64;osx-x64;osx-arm64;browser-wasm</PackageRids>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<Title>Raylib-cs</Title> <NoWarn>$(NoWarn);1591</NoWarn> <!-- missing XML comment on public member -->
<Description>C# bindings for raylib - A simple and easy-to-use library to learn videogames programming</Description> </PropertyGroup>
<PropertyGroup>
<PackageId>Raylib-cs</PackageId>
<Version>8.0.0</Version>
<Description>C# bindings for raylib</Description>
<RepositoryUrl>https://github.com/raylib-cs/raylib-cs/</RepositoryUrl> <RepositoryUrl>https://github.com/raylib-cs/raylib-cs/</RepositoryUrl>
<Authors>raylib-cs</Authors> <Authors>raylib-cs</Authors>
<PackageLicenseExpression>Zlib</PackageLicenseExpression> <PackageLicenseExpression>Zlib</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile> <PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>raylib-cs_64x64.png</PackageIcon> <PackageIcon>raylib-cs_64x64.png</PackageIcon>
<PackageTags>raylib csharp gamedev</PackageTags> <PackageTags>raylib csharp gamedev</PackageTags>
<PackageProjectUrl>https://www.raylib.com/</PackageProjectUrl>
<PackProject>true</PackProject>
<IncludeSymbols>true</IncludeSymbols> <IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat> <SymbolPackageFormat>snupkg</SymbolPackageFormat>
<RepositoryType>git</RepositoryType>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Include="logo/raylib-cs_64x64.png" Pack="true" PackagePath="" /> <!-- Use explicit PackagePath for these to prevent ambiguity -->
<None Include="../README.md" Pack="true" PackagePath="" /> <None Include="logo/raylib-cs_64x64.png" Pack="true" PackagePath="raylib-cs_64x64.png"/>
<None Include="../README.md" Pack="true" PackagePath="README.md"/>
<None Include="Raylib-cs.targets" Pack="true" PackagePath="buildTransitive\Raylib-cs.targets"/>
</ItemGroup> </ItemGroup>
<!-- Import Build Props -->
<Import Project="./Build.props" Condition="Exists('./Build.props')"/>
<PropertyGroup Condition="'$(TargetRaylibTag)' == ''">
<TargetRaylibTag>6.0</TargetRaylibTag>
</PropertyGroup>
<PropertyGroup>
<NativesRoot>$(BaseIntermediateOutputPath)natives/</NativesRoot>
</PropertyGroup>
<Choose>
<When Condition="'$(RuntimeIdentifier)' == 'win-x64'">
<PropertyGroup>
<RaylibPackageName>raylib-$(TargetRaylibTag)_win64_msvc16</RaylibPackageName>
<ArchiveExt>.zip</ArchiveExt>
<LibPattern>raylib.dll</LibPattern>
</PropertyGroup>
</When>
<When Condition="'$(RuntimeIdentifier)' == 'win-x86'">
<PropertyGroup>
<RaylibPackageName>raylib-$(TargetRaylibTag)_win32_msvc16</RaylibPackageName>
<ArchiveExt>.zip</ArchiveExt>
<LibPattern>raylib.dll</LibPattern>
</PropertyGroup>
</When>
<When Condition="'$(RuntimeIdentifier)' == 'linux-x64'">
<PropertyGroup>
<RaylibPackageName>raylib-$(TargetRaylibTag)_linux_amd64</RaylibPackageName>
<ArchiveExt>.tar.gz</ArchiveExt>
<LibPattern>libraylib.so*</LibPattern>
</PropertyGroup>
</When>
<When Condition="'$(RuntimeIdentifier)' == 'osx-x64'">
<PropertyGroup>
<RaylibPackageName>raylib-$(TargetRaylibTag)_macos</RaylibPackageName>
<ArchiveExt>.tar.gz</ArchiveExt>
<LibPattern>libraylib.dylib</LibPattern>
</PropertyGroup>
</When>
<When Condition="'$(RuntimeIdentifier)' == 'osx-arm64'">
<PropertyGroup>
<RaylibPackageName>raylib-$(TargetRaylibTag)_macos</RaylibPackageName>
<ArchiveExt>.tar.gz</ArchiveExt>
<LibPattern>libraylib.dylib</LibPattern>
</PropertyGroup>
</When>
<When Condition="'$(RuntimeIdentifier)' == 'browser-wasm'">
<PropertyGroup>
<RaylibPackageName>raylib-$(TargetRaylibTag)_webassembly</RaylibPackageName>
<ArchiveExt>.zip</ArchiveExt>
<LibPattern>libraylib.web.a</LibPattern>
</PropertyGroup>
</When>
</Choose>
<!-- ================================================================== -->
<!-- TARGET: PACKING -->
<!-- ================================================================== -->
<Target Name="PrepareNativesForPack" BeforeTargets="_GetPackageFiles">
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" /> <_TargetRids Include="$(PackageRids)"/>
</ItemGroup> </ItemGroup>
<Import Project="./Build.props" /> <MSBuild Projects="$(MSBuildThisFileFullPath)"
Targets="_DownloadAndExtractInternal"
Properties="RuntimeIdentifier=%(_TargetRids.Identity);TargetFramework=$(TargetFramework);TargetRaylibTag=$(TargetRaylibTag)"
BuildInParallel="false"/>
<!-- Direct injection into _PackageFiles -->
<ItemGroup> <ItemGroup>
<Content Include="runtimes/**" Link="runtimes/%(RecursiveDir)/%(Filename)%(Extension)"> <_PackageFiles Include="$(NativesRoot)win-x64/raylib-$(TargetRaylibTag)_win64_msvc16/lib/raylib.dll">
<PackagePath>runtimes/</PackagePath> <PackagePath>runtimes/win-x64/native/</PackagePath>
<Pack>true</Pack> <BuildAction>None</BuildAction>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </_PackageFiles>
</Content>
</ItemGroup>
<ItemGroup> <_PackageFiles Include="$(NativesRoot)win-x86/raylib-$(TargetRaylibTag)_win32_msvc16/lib/raylib.dll">
<Compile Include="interop\*.cs" /> <PackagePath>runtimes/win-x86/native/</PackagePath>
<Compile Include="types\*.cs" /> <BuildAction>None</BuildAction>
<Compile Include="types\native\*.cs" /> </_PackageFiles>
<_PackageFiles Include="$(NativesRoot)linux-x64/raylib-$(TargetRaylibTag)_linux_amd64/lib/libraylib.so">
<PackagePath>runtimes/linux-x64/native/</PackagePath>
<BuildAction>None</BuildAction>
</_PackageFiles>
<_PackageFiles Include="$(NativesRoot)osx-x64/raylib-$(TargetRaylibTag)_macos/lib/libraylib.dylib">
<PackagePath>runtimes/osx-x64/native/</PackagePath>
<BuildAction>None</BuildAction>
</_PackageFiles>
<_PackageFiles Include="$(NativesRoot)osx-arm64/raylib-$(TargetRaylibTag)_macos/lib/libraylib.dylib">
<PackagePath>runtimes/osx-arm64/native/</PackagePath>
<BuildAction>None</BuildAction>
</_PackageFiles>
<_PackageFiles Include="$(NativesRoot)browser-wasm/raylib-$(TargetRaylibTag)_webassembly/lib/libraylib.web.a">
<PackagePath>runtimes/browser-wasm/native/raylib.a</PackagePath>
<BuildAction>None</BuildAction>
</_PackageFiles>
</ItemGroup> </ItemGroup>
</Target>
<!-- ================================================================== -->
<!-- TARGET: LOCAL DEVELOPMENT -->
<!-- ================================================================== -->
<Target Name="CopyNativeToOutput" AfterTargets="Build"
Condition="'$(GeneratePackageOnBuild)' != 'true' AND '$(RuntimeIdentifier)' != ''">
<CallTarget Targets="_DownloadAndExtractInternal"/>
<ItemGroup>
<_NativeToCopy Include="$(NativesRoot)$(RuntimeIdentifier)/**/$(LibPattern)"/>
</ItemGroup>
<Copy SourceFiles="@(_NativeToCopy)" DestinationFolder="$(OutputPath)" SkipUnchangedFiles="true"/>
</Target>
<!-- ================================================================== -->
<!-- WORKER: DOWNLOADER -->
<!-- ================================================================== -->
<Target Name="_DownloadAndExtractInternal" Condition="'$(RaylibPackageName)' != ''">
<PropertyGroup>
<_WorkDir>$(NativesRoot)$(RuntimeIdentifier)/</_WorkDir>
<_ArchiveFile>$(_WorkDir)$(RaylibPackageName)$(ArchiveExt)</_ArchiveFile>
<_ExtractMarker>$(_WorkDir).extracted</_ExtractMarker>
</PropertyGroup>
<Message Text="=== _DownloadAndExtractInternal ===" Importance="high"/>
<Message Text="RID = $(RuntimeIdentifier)" Importance="high"/>
<Message Text="Archive = $(_ArchiveFile)" Importance="high"/>
<Message Text="Marker = $(_ExtractMarker)" Importance="high"/>
<MakeDir Directories="$(_WorkDir)"/>
<DownloadFile
SourceUrl="https://github.com/raysan5/raylib/releases/download/$(TargetRaylibTag)/$(RaylibPackageName)$(ArchiveExt)"
DestinationFolder="$(_WorkDir)"
DestinationFileName="$(RaylibPackageName)$(ArchiveExt)"
Condition="!Exists('$(_ArchiveFile)')"
Retries="3"/>
<Message Text="unZIPping" Importance="high" Condition="'$(ArchiveExt)' == '.zip' AND !Exists('$(_ExtractMarker)')"/>
<Unzip SourceFiles="$(_ArchiveFile)"
DestinationFolder="$(_WorkDir)"
OverwriteReadOnlyFiles="true"
Condition="'$(ArchiveExt)' == '.zip' AND !Exists('$(_ExtractMarker)')"/>
<Message Text="unTARing" Importance="high" Condition="'$(ArchiveExt)' == '.tar.gz' AND !Exists('$(_ExtractMarker)')"/>
<Exec Command="tar -xzf &quot;$(RaylibPackageName)$(ArchiveExt)&quot;"
WorkingDirectory="$(_WorkDir)"
Condition="'$(ArchiveExt)' == '.tar.gz' AND !Exists('$(_ExtractMarker)')"/>
<Touch Files="$(_ExtractMarker)" AlwaysCreate="true"/>
<Message Text="Extraction complete" Importance="high"/>
</Target>
</Project> </Project>

View file

@ -0,0 +1,10 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Condition="'$(RuntimeIdentifier)' == 'browser-wasm'">
<!-- WASM build needs explicit native reference due to semi-static linkage (?) -->
<NativeFileReference Include="$(MSBuildThisFileDirectory)..\runtimes\browser-wasm\native\raylib.a"/>
</ItemGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'browser-wasm'">
<EmccFlags>$(EmccFlags) -sUSE_GLFW=3</EmccFlags>
</PropertyGroup>
</Project>

View file

@ -298,19 +298,6 @@ public static unsafe partial class Rlgl
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void DisableVertexAttribute(uint index); public static partial void DisableVertexAttribute(uint index);
/// <summary>Enable attribute state pointer<br/>
/// NOTE: Only available for GRAPHICS_API_OPENGL_11</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlEnableStatePointer")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void EnableStatePointer(int vertexAttribType, void* buffer);
/// <summary>Disable attribute state pointer<br/>
/// NOTE: Only available for GRAPHICS_API_OPENGL_11</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlDisableStatePointer")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void DisableStatePointer(int vertexAttribType);
// Textures state // Textures state
/// <summary>Select and active a texture slot</summary> /// <summary>Select and active a texture slot</summary>

View file

@ -1 +0,0 @@

View file

@ -1 +0,0 @@

View file

@ -1 +0,0 @@