Skip to content
This repository has been archived by the owner on Oct 8, 2023. It is now read-only.

Upgrade to .NET 7 #107

Merged
merged 9 commits into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/bindgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: "Install .NET"
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
dotnet-version: '7.0.x'
include-prerelease: true

- name: "Install C2CS"
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
- name: "Install .NET"
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
dotnet-version: '7.0.x'
include-prerelease: true

- name: "Install C2CS"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Automatically updated C# bindings for https://github.com/SanderMertens/flecs wit

### From source

1. Download and install [.NET 6](https://dotnet.microsoft.com/download).
1. Download and install [.NET 7](https://dotnet.microsoft.com/download).
2. Fork the repository using GitHub or clone the repository manually with submodules: `git clone --recurse-submodules https://github.com/flecs-hub/flecs-cs`.
3. Build the native library by running `library.sh`. To execute `.sh` scripts on Windows, use Git Bash which can be installed with Git itself: https://git-scm.com/download/win. The `library.sh` script requires that CMake is installed and in your path.
4. To setup everything you need: Either (1), add the `src/cs/production/Flecs/Flecs.csproj` C# project to your solution as an existing project and reference it within your own solution, or (2) import the MSBuild `flecs.props` file which is located in the root of this directory to your `.csproj` file. See the [flecs.csproj](https://github.com/flecs-hub/flecs-cs/blob/main/src/cs/production/Flecs/Flecs.csproj) file for how to import the `flecs.props` directly.
Expand Down
2 changes: 1 addition & 1 deletion ext/flecs
Submodule flecs updated 136 files
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- MSBuild settings -->
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- MSBuild settings -->
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- MSBuild settings -->
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- MSBuild settings -->
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- MSBuild settings -->
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- MSBuild settings -->
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- MSBuild settings -->
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>
Expand Down
15 changes: 15 additions & 0 deletions src/cs/production/Flecs.Bindgen.Runner/Flecs.Bindgen.Runner.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="bottlenoselabs.C2CS.Plugin" Version="4.0.5" />
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" />
</ItemGroup>

</Project>
23 changes: 23 additions & 0 deletions src/cs/production/Flecs.Bindgen.Runner/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using JetBrains.Annotations;
using C2CS;

namespace Flecs.Bindgen.Runner;

[UsedImplicitly]
internal class Program
{
private static int Main(string[] args)
{
var rootFileDirectory = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, "../../../.."));
var bindgenFileDirectory = Path.Combine(rootFileDirectory, "bindgen");
var buildPluginCommand = $"dotnet build \"{rootFileDirectory}/src/cs/production/Flecs.Bindgen/Flecs.Bindgen.csproj\" -p:OutputPath=\"{bindgenFileDirectory}/plugins/Flecs.Bindgen\"";
var shellOutput = buildPluginCommand.ExecuteShell();
if (shellOutput.ExitCode != 0)
{
Console.WriteLine("Error building Flecs.Bindgen plugin C# project.");
return shellOutput.ExitCode;
}

return 0;
}
}
6 changes: 3 additions & 3 deletions src/cs/production/Flecs.Bindgen/Flecs.Bindgen.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<EnableDynamicLoading>true</EnableDynamicLoading>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="bottlenoselabs.C2CS.Plugin" Version="4.0.5">
<PackageReference Include="bottlenoselabs.C2CS.Plugin" Version="4.0.8">
<Private>false</Private>
<ExcludeAssets>runtime</ExcludeAssets>
</PackageReference>
Expand Down
3 changes: 2 additions & 1 deletion src/cs/production/Flecs/Flecs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
<PropertyGroup>
<_IsEnabledSourceCode>false</_IsEnabledSourceCode>
<AssemblyName>Flecs-cs</AssemblyName>
<NoWarn>$(NoWarn);CS8981</NoWarn>
</PropertyGroup>
<Import Project="$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)../../../../flecs.props'))" />

<!-- MSBuild settings -->
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ImplicitUsings>false</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down
6 changes: 5 additions & 1 deletion src/cs/production/Flecs/World.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ public void RegisterComponent<TComponent>(ComponentHooks? hooks = null)
CheckStructLayout(structLayoutAttribute);
var structSize = Unsafe.SizeOf<TComponent>();
var structAlignment = structLayoutAttribute!.Pack;
if (structAlignment == 0)
{
structAlignment = 1;
}

ecs_entity_desc_t entityDesc = default;
entityDesc.name = componentNameC;
Expand Down Expand Up @@ -141,7 +145,7 @@ public void RegisterSystem<TComponent1, TComponent2>(
CallbackIterator callback, string? name = null)
{
ecs_system_desc_t desc = default;
desc.query.filter.name = (Runtime.CString)(name ?? callback.Method.Name);
// desc.query.filter.name = (Runtime.CString)(name ?? callback.Method.Name);
var phase = EcsOnUpdate;
FillSystemDescriptorCommon(ref desc, callback, phase._handle, name);

Expand Down
Loading