Skip to content

Commit

Permalink
Merge pull request #42 from BeanCheeseBurrito/type-safe-queries
Browse files Browse the repository at this point in the history
Implement type-safe query api, upgrade to .NET 8, remove Unity package support
  • Loading branch information
BeanCheeseBurrito committed Sep 14, 2024
2 parents 0b3db41 + 9af4004 commit 92ca952
Show file tree
Hide file tree
Showing 825 changed files with 203,127 additions and 33,850 deletions.
12 changes: 0 additions & 12 deletions Flecs.NET.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Flecs.NET.Benchmarks", "src
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Flecs.NET.Codegen", "src\Flecs.NET.Codegen\Flecs.NET.Codegen.csproj", "{A76AE670-D7DD-47DE-8F5C-DDF7B31C030A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Flecs.NET.Unity", "src\Flecs.NET.Unity\Flecs.NET.Unity.csproj", "{887CF1C6-F681-4228-8568-6A3093A2B07A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Flecs.NET.UnityShims", "src\Flecs.NET.UnityShims\Flecs.NET.UnityShims.csproj", "{9D55605F-6EA8-46B0-8067-D7E67A82606B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -58,13 +54,5 @@ Global
{A76AE670-D7DD-47DE-8F5C-DDF7B31C030A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A76AE670-D7DD-47DE-8F5C-DDF7B31C030A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A76AE670-D7DD-47DE-8F5C-DDF7B31C030A}.Release|Any CPU.Build.0 = Release|Any CPU
{887CF1C6-F681-4228-8568-6A3093A2B07A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{887CF1C6-F681-4228-8568-6A3093A2B07A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{887CF1C6-F681-4228-8568-6A3093A2B07A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{887CF1C6-F681-4228-8568-6A3093A2B07A}.Release|Any CPU.Build.0 = Release|Any CPU
{9D55605F-6EA8-46B0-8067-D7E67A82606B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9D55605F-6EA8-46B0-8067-D7E67A82606B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9D55605F-6EA8-46B0-8067-D7E67A82606B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9D55605F-6EA8-46B0-8067-D7E67A82606B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
5 changes: 0 additions & 5 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,4 @@
<Deterministic Condition="'$(GITHUB_ACTIONS)' == 'true' And '$(Deterministic)' == ''">true</Deterministic>
<AllowedOutputExtensionsInPackageBuildOutputFolder Condition="'$(FlecsPackPdb)' == 'true'">$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>

<PropertyGroup>
<UnityPackageRoot>$(MSBuildThisFileDirectory)..\upm</UnityPackageRoot>
</PropertyGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Flecs.NET.Benchmarks/Flecs.NET.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>$(NoWarn);CS8618</NoWarn>
Expand Down
4 changes: 2 additions & 2 deletions src/Flecs.NET.Bindgen/Flecs.NET.Bindgen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ContinuousIntegrationBuild>false</ContinuousIntegrationBuild>
Expand All @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bindgen.NET" Version="0.1.13"/>
<PackageReference Include="Bindgen.NET" Version="0.1.14"/>
</ItemGroup>

</Project>
14 changes: 5 additions & 9 deletions src/Flecs.NET.Bindgen/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,15 @@
DllFilePaths =
{
"flecs",
"runtimes/linux-x64/native/flecs",
"runtimes/linux-arm64/native/flecs",
"runtimes/osx-x64/native/flecs",
"runtimes/osx-arm64/native/flecs",
"libflecs",
"runtimes/linux-x64/native/libflecs",
"runtimes/linux-arm64/native/libflecs",
"runtimes/osx-x64/native/libflecs",
"runtimes/osx-arm64/native/libflecs",
"runtimes/win-x64/native/flecs",
"runtimes/win-arm64/native/flecs"
},

RemappedDefineConstantsToDllImportPaths =
{
("(UNITY_EDITOR || UNITY_STANDALONE) && !FLECS_UNITY_NDEBUG", "flecs-debug") // Unity specific define
},

SuppressedWarnings = { "CS8981" },

IncludeBuiltInClangHeaders = true,
Expand Down
9 changes: 0 additions & 9 deletions src/Flecs.NET.Bindings/Flecs.NET.Bindings.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,4 @@
<ProjectReference Include="..\Flecs.NET.Native\Flecs.NET.Native.csproj"/>
</ItemGroup>

<ItemGroup>
<UnityArtifacts Include="Flecs.g.cs"/>
<UnityArtifacts Include="FlecsExtensions.g.cs"/>
</ItemGroup>

<Target Name="ExportUnityArtifacts" AfterTargets="Build" Condition="'$(FlecsExportUnityArtifacts)' == 'True' And '$(TargetFramework)' == 'netstandard2.1'">
<Copy SourceFiles="@(UnityArtifacts)" DestinationFolder="$(UnityPackageRoot)\$(AssemblyName)"/>
</Target>

</Project>
32 changes: 19 additions & 13 deletions src/Flecs.NET.Bindings/Flecs.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13794,21 +13794,18 @@ public enum ecs_type_kind_t : uint

public partial class BindgenInternal
{
#if (UNITY_EDITOR || UNITY_STANDALONE) && !FLECS_UNITY_NDEBUG
public const string DllImportPath = "flecs-debug";
#else
public const string DllImportPath = "flecs";
#endif

static BindgenInternal()
{
DllFilePaths = new System.Collections.Generic.List<string>
{
"flecs",
"runtimes/linux-x64/native/flecs",
"runtimes/linux-arm64/native/flecs",
"runtimes/osx-x64/native/flecs",
"runtimes/osx-arm64/native/flecs",
"libflecs",
"runtimes/linux-x64/native/libflecs",
"runtimes/linux-arm64/native/libflecs",
"runtimes/osx-x64/native/libflecs",
"runtimes/osx-arm64/native/libflecs",
"runtimes/win-x64/native/flecs",
"runtimes/win-arm64/native/flecs"
};
Expand Down Expand Up @@ -13862,8 +13859,8 @@ public partial class BindgenInternal

public static bool TryLoad(string path, out System.IntPtr handle)
{
#if NET5_0_OR_GREATER
return System.Runtime.InteropServices.NativeLibrary.TryLoad(path, out handle);
#if NETCOREAPP3_0_OR_GREATER
return System.Runtime.InteropServices.NativeLibrary.TryLoad(path, System.Reflection.Assembly.GetExecutingAssembly(), null, out handle);
#else
handle = System.IntPtr.Zero;
if (IsLinux)
Expand All @@ -13878,7 +13875,7 @@ public static bool TryLoad(string path, out System.IntPtr handle)

public static System.IntPtr GetExport(string symbol)
{
#if NET5_0_OR_GREATER
#if NETCOREAPP3_0_OR_GREATER
return System.Runtime.InteropServices.NativeLibrary.GetExport(LibraryHandle, symbol);
#else
if (IsLinux)
Expand Down Expand Up @@ -13923,6 +13920,14 @@ public static System.IntPtr GetExport(string symbol)

public static void ResolveLibrary()
{
System.IntPtr handle = default;
#if NETCOREAPP3_0_OR_GREATER
foreach (string dllFilePath in DllFilePaths)
{
if (TryLoad(dllFilePath, out handle))
goto Return;
}
#else
string fileExtension;
if (IsLinux)
fileExtension = ".so";
Expand All @@ -13932,12 +13937,12 @@ public static void ResolveLibrary()
fileExtension = ".dll";
else
throw new System.InvalidOperationException("Can't determine native library file extension for the current system.");
System.IntPtr handle = default;
foreach (string dllFilePath in DllFilePaths)
{
string fileName = System.IO.Path.GetFileName(dllFilePath);
string parentDir = $"{dllFilePath}/..";
string searchDir = System.IO.Path.IsPathRooted(dllFilePath) ? System.IO.Path.GetFullPath(parentDir) + "/" : System.IO.Path.GetFullPath(System.AppDomain.CurrentDomain.BaseDirectory + parentDir) + "/";
string exeDir = System.IO.Path.GetFullPath(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)!);
string searchDir = System.IO.Path.IsPathRooted(dllFilePath) ? System.IO.Path.GetFullPath(parentDir) + "/" : System.IO.Path.GetFullPath($"{exeDir}/{parentDir}") + "/";
if (TryLoad($"{searchDir}{fileName}", out handle))
goto Return;
if (TryLoad($"{searchDir}{fileName}{fileExtension}", out handle))
Expand All @@ -13955,6 +13960,7 @@ public static void ResolveLibrary()
goto Return;
}

#endif
#if NET7_0_OR_GREATER
handle = System.Runtime.InteropServices.NativeLibrary.GetMainProgramHandle();
#else
Expand Down
54 changes: 0 additions & 54 deletions src/Flecs.NET.Codegen/CodeFormatter.cs

This file was deleted.

3 changes: 3 additions & 0 deletions src/Flecs.NET.Codegen/Flecs.NET.Codegen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>12</LangVersion>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<Deterministic>true</Deterministic>
</PropertyGroup>

<PropertyGroup>
Expand Down
Loading

0 comments on commit 92ca952

Please sign in to comment.