Skip to content

Commit

Permalink
Use include dir from zig toolset not zig submodule
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Slusny <[email protected]>
  • Loading branch information
deathbeam committed Oct 28, 2024
1 parent 59ae616 commit 48e9966
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 33 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
[submodule "lib/raylib"]
path = lib/raylib
url = https://github.com/raysan5/raylib
[submodule "lib/zig"]
path = lib/zig
url = https://github.com/ziglang/zig
[submodule "lib/rres"]
path = lib/rres
url = https://github.com/raysan5/rres
1 change: 0 additions & 1 deletion lib/zig
Submodule zig deleted from 857383
26 changes: 26 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,30 @@
<PackageProjectUrl>https://github.com/deathbeam/Raylib.NET</PackageProjectUrl>
<PackageLicenseExpression>zlib</PackageLicenseExpression>
</PropertyGroup>

<PropertyGroup>
<HostArch>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)</HostArch>
</PropertyGroup>

<!-- As we are cross-compiling, RID != host runtime so we need to determine it for later -->
<Choose>
<When Condition="$([MSBuild]::IsOSPlatform('Windows'))">
<PropertyGroup>
<HostRuntime Condition="'$(HostArch)' == 'X64'">win-x64</HostRuntime>
<HostRuntime Condition="'$(HostArch)' == 'Arm64'">win-arm64</HostRuntime>
</PropertyGroup>
</When>
<When Condition="$([MSBuild]::IsOSPlatform('Linux'))">
<PropertyGroup>
<HostRuntime Condition="'$(HostArch)' == 'X64'">linux-x64</HostRuntime>
<HostRuntime Condition="'$(HostArch)' == 'Arm64'">linux-arm64</HostRuntime>
</PropertyGroup>
</When>
<When Condition="$([MSBuild]::IsOSPlatform('OSX'))">
<PropertyGroup>
<HostRuntime Condition="'$(HostArch)' == 'X64'">osx-x64</HostRuntime>
<HostRuntime Condition="'$(HostArch)' == 'Arm64'">osx-arm64</HostRuntime>
</PropertyGroup>
</When>
</Choose>
</Project>
5 changes: 3 additions & 2 deletions src/Raylib.NET.Bindgen/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Bindgen;

var libPath = "../../lib";
var includePath = args[0];

var transformEnum = (string parent, string name) => parent switch
{
Expand Down Expand Up @@ -53,8 +54,8 @@
LibraryName = "raylib",
SystemIncludeFolders = new[]
{
$"{libPath}/zig/lib/libc/include/generic-musl",
$"{libPath}/zig/lib/libc/include/x86-linux-musl",
$"{includePath}/libc/include/generic-musl",
$"{includePath}/libc/include/x86-linux-musl",
},
IncludeFolders = new[] { $"{libPath}/raylib/src" },
};
Expand Down
7 changes: 6 additions & 1 deletion src/Raylib.NET.Bindgen/Raylib.NET.Bindgen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@

<ItemGroup>
<ProjectReference Include="..\Bindgen\Bindgen.csproj" />

<PackageReference Include="Vezel.Zig.Toolsets.$(HostRuntime)" Version="0.13.0.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<Target Name="RunAfterBuild" AfterTargets="Build" Condition="'$(SkipBindgen)' != 'true'">
<Exec Command="dotnet &quot;$(TargetDir)$(TargetFileName)&quot;" />
<Exec Command="dotnet '$(TargetDir)$(TargetFileName)' '$(ZigLibPath)'" />
</Target>
</Project>
26 changes: 0 additions & 26 deletions src/Raylib.NET.Native/Raylib.NET.Native.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
<Description>Native libraries for Raylib</Description>
</PropertyGroup>

<PropertyGroup>
<HostArch>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)</HostArch>
</PropertyGroup>

<!-- We want 2 separate natives packages for debug and release modes -->
<Choose>
<When Condition="'$(Configuration)' == 'Debug'">
Expand All @@ -37,28 +33,6 @@
</When>
</Choose>

<!-- As we are cross-compiling, RID != host runtime so we need to determine it for later -->
<Choose>
<When Condition="$([MSBuild]::IsOSPlatform('Windows'))">
<PropertyGroup>
<HostRuntime Condition="'$(HostArch)' == 'X64'">win-x64</HostRuntime>
<HostRuntime Condition="'$(HostArch)' == 'Arm64'">win-arm64</HostRuntime>
</PropertyGroup>
</When>
<When Condition="$([MSBuild]::IsOSPlatform('Linux'))">
<PropertyGroup>
<HostRuntime Condition="'$(HostArch)' == 'X64'">linux-x64</HostRuntime>
<HostRuntime Condition="'$(HostArch)' == 'Arm64'">linux-arm64</HostRuntime>
</PropertyGroup>
</When>
<When Condition="$([MSBuild]::IsOSPlatform('OSX'))">
<PropertyGroup>
<HostRuntime Condition="'$(HostArch)' == 'X64'">osx-x64</HostRuntime>
<HostRuntime Condition="'$(HostArch)' == 'Arm64'">osx-arm64</HostRuntime>
</PropertyGroup>
</When>
</Choose>

<!-- Fallback to host runtime when not specified -->
<PropertyGroup>
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == ''">$(HostRuntime)</RuntimeIdentifier>
Expand Down

0 comments on commit 48e9966

Please sign in to comment.