2
0
mirror of https://github.com/raylib-cs/raylib-cs synced 2025-06-30 19:03:42 -04:00

Enable Targeting .Net 8 (#297)

Fixes #295
This commit is contained in:
Ben Parsons
2025-05-07 17:16:47 +10:00
committed by GitHub
parent ee10f5fa7b
commit f9787a8342
6 changed files with 34 additions and 33 deletions

View File

@ -1,9 +1,9 @@
name: Build
on:
push:
branches: master
branches: ["master"]
pull_request:
branches: "*"
branches: ["*"]
paths-ignore:
- "README.md"
- ".github/ISSUE_TEMPLATE/**"
@ -35,7 +35,9 @@ jobs:
- name: setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
dotnet-version: |
6.0.x
8.0.x
- name: setup dependencies
run: |
@ -81,7 +83,9 @@ jobs:
- name: setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
dotnet-version: |
6.0.x
8.0.x
- name: build projects
run: dotnet build -c Release /p:BuildArch=${{ matrix.arch }}
@ -114,7 +118,9 @@ jobs:
- name: setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
dotnet-version: |
6.0.x
8.0.x
- name: build projects
run: dotnet build -c Release /p:BuildArch=${{ matrix.arch }}
@ -167,7 +173,9 @@ jobs:
- name: setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
dotnet-version: |
6.0.x
8.0.x
- name: create NuGet Package
run: dotnet pack Raylib-cs -c Release --output nuget

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<StartupObject>Examples.Program</StartupObject>
<RunWorkingDirectory>$(MSBuildThisFileDirectory)</RunWorkingDirectory>

View File

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

View File

@ -1,8 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk" InitialTargets="ConfigureNative">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<TargetFramework>netstandard2.1</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<DebugType>none</DebugType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDependencyFile>False</GenerateDependencyFile>
</PropertyGroup>
<Import Project="../Raylib-cs/Build.props" />
@ -44,11 +46,7 @@
</ItemGroup>
<ItemGroup>
<Content
Include="$(OutputPath)native/raylib/$(NativePre)raylib.$(NativeExt)"
Link="%(Filename)%(Extension)"
CopyToOutputDirectory="PreserveNewest"
Condition="Exists('$(OutputPath)native/raylib/$(NativePre)raylib.$(NativeExt)')" />
<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)" />
@ -58,25 +56,16 @@
<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')" />
<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)"
Condition="!Exists('$(BaseIntermediateOutputPath)native/CMakeCache.txt')" />
<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,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>12</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
<PackageReference Include="coverlet.collector" Version="1.3.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4" />
<PackageReference Include="coverlet.collector" Version="6.0.0" />
</ItemGroup>
<ItemGroup>

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<EnableDefaultItems>false</EnableDefaultItems>
<AssemblyName>Raylib-cs</AssemblyName>
<RootNamespace>Raylib_cs</RootNamespace>