diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 1463b731..7f634308 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -25,4 +25,29 @@
true
$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
+
+
+ $([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)
+
+
+
+
+
+ win-x64
+ win-arm64
+
+
+
+
+ linux-x64
+ linux-arm64
+
+
+
+
+ osx-x64
+ osx-arm64
+
+
+
diff --git a/src/Flecs.NET.Bindgen/Flecs.NET.Bindgen.csproj b/src/Flecs.NET.Bindgen/Flecs.NET.Bindgen.csproj
index bd7f57ef..eff1b9a1 100644
--- a/src/Flecs.NET.Bindgen/Flecs.NET.Bindgen.csproj
+++ b/src/Flecs.NET.Bindgen/Flecs.NET.Bindgen.csproj
@@ -13,6 +13,28 @@
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
+
+
+
+
+
+
+ $([MSBuild]::Escape('public static class BuildConstants { public const string ZigLibPath = "$(ZigLibPath)"; }'))
+
+
+
+
+
+
diff --git a/src/Flecs.NET.Bindgen/Program.cs b/src/Flecs.NET.Bindgen/Program.cs
index b5e3b15a..d2b23a0a 100644
--- a/src/Flecs.NET.Bindgen/Program.cs
+++ b/src/Flecs.NET.Bindgen/Program.cs
@@ -23,7 +23,11 @@
SuppressedWarnings = { "CS8981" },
- IncludeBuiltInClangHeaders = true,
+ SystemIncludeDirectories =
+ {
+ Path.Combine(BuildConstants.ZigLibPath, "include"),
+ Path.Combine(BuildConstants.ZigLibPath, "libc", "include", "any-macos-any")
+ },
InputFile = GetFlecsHeaderPath(),
OutputFile = GetBindingsOutputPath(),
@@ -33,9 +37,6 @@
GenerateStructEqualityFunctions = true
};
-if (OperatingSystem.IsMacOS())
- bindingOptions.SystemIncludeDirectories.Add(GetMacOsHeaders());
-
BindingGenerator.Generate(bindingOptions);
string GetFlecsHeaderPath([CallerFilePath] string filePath = "")
@@ -47,28 +48,3 @@ string GetBindingsOutputPath([CallerFilePath] string filePath = "")
{
return Path.GetFullPath(Path.Combine(filePath, "..", "..", "Flecs.NET.Bindings", "Flecs.g.cs"));
}
-
-string GetMacOsHeaders()
-{
- using Process process = new()
- {
- StartInfo = new ProcessStartInfo
- {
- FileName = "xcrun",
- Arguments = "--sdk macosx --show-sdk-path",
- RedirectStandardOutput = true,
- UseShellExecute = false,
- CreateNoWindow = true
- }
- };
-
- process.Start();
- process.WaitForExit();
-
- string path = process.StandardOutput.ReadToEnd().Trim();
-
- if (!Directory.Exists(path))
- throw new DirectoryNotFoundException("Couldn't find system headers. Install XCode.");
-
- return path + "/usr/include";
-}
diff --git a/src/Flecs.NET.Native/Flecs.NET.Native.csproj b/src/Flecs.NET.Native/Flecs.NET.Native.csproj
index af81d4ce..10c8fe90 100644
--- a/src/Flecs.NET.Native/Flecs.NET.Native.csproj
+++ b/src/Flecs.NET.Native/Flecs.NET.Native.csproj
@@ -20,10 +20,6 @@
Native libraries for flecs
-
- $([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)
-
-
@@ -40,28 +36,6 @@
-
-
-
-
- win-x64
- win-arm64
-
-
-
-
- linux-x64
- linux-arm64
-
-
-
-
- osx-x64
- osx-arm64
-
-
-
-
$(HostRuntime)