Skip to content

Commit

Permalink
Merge pull request #58 from deathbeam/rework-natives
Browse files Browse the repository at this point in the history
Rework how natives are built and add emscripten support
  • Loading branch information
BeanCheeseBurrito authored Oct 26, 2024
2 parents 25eab70 + 5229403 commit c20c74b
Show file tree
Hide file tree
Showing 11 changed files with 231 additions and 243 deletions.
57 changes: 44 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
echo "FlecsVersionSuffix=build.$(git rev-list --count HEAD)" >> $GITHUB_ENV
fi
- name: Setup Osx Environment
- name: Setup IOS SDK
if: matrix.os == 'macos-13'
shell: bash
run: |
Expand All @@ -66,6 +66,12 @@ jobs:
echo "IOS_SDK=$IOS_SDK" >> $GITHUB_ENV
echo "IOS_SIMULATOR_SDK=$IOS_SIMULATOR_SDK" >> $GITHUB_ENV
- name: Setup Emscripten SDK
if: matrix.os == 'macos-13'
uses: mymindstorm/setup-emsdk@v14
with:
actions-cache-folder: 'emsdk-cache'

- name: Restore Dependencies
shell: bash
run: dotnet restore
Expand All @@ -77,27 +83,52 @@ jobs:
- name: Build Projects
shell: bash
run: |
if [ '${{ matrix.os }}' == 'macos-13' ]; then
dotnet build -c Debug --property:IosSdkPath=$IOS_SDK --property:IosSimulatorSdkPath=$IOS_SIMULATOR_SDK
dotnet build -c Release --property:IosSdkPath=$IOS_SDK --property:IosSimulatorSdkPath=$IOS_SIMULATOR_SDK
else
dotnet build -c Debug
dotnet build -c Release
fi
dotnet build -c Debug
dotnet build -c Release
- name: Build Natives
shell: bash
if: matrix.os == 'macos-13'
working-directory: src/Flecs.NET.Native
run: |
dotnet build -c Debug -r linux-x64
dotnet build -c Release -r linux-x64
dotnet build -c Debug -r linux-arm64
dotnet build -c Release -r linux-arm64
dotnet build -c Debug -r osx-x64
dotnet build -c Release -r osx-x64
dotnet build -c Debug -r osx-arm64
dotnet build -c Release -r osx-arm64
dotnet build -c Debug -r win-x64
dotnet build -c Release -r win-x64
dotnet build -c Debug -r win-arm64
dotnet build -c Release -r win-arm64
dotnet build -c Debug -r browser-wasm
dotnet build -c Release -r browser-wasm
dotnet build -c Debug -r iossimulator-x64
dotnet build -c Release -r iossimulator-x64
dotnet build -c Debug -r iossimulator-arm64
dotnet build -c Release -r iossimulator-arm64
dotnet build -c Debug -r ios-arm64
dotnet build -c Release -r ios-arm64
- name: Run Tests
shell: bash
run: dotnet test --no-build
run: dotnet test -p:SkipNatives=true

- name: Pack Nuget Packages
shell: bash
run: |
if [ '${{ github.event.inputs.nuget-registry }}' == 'NuGet' ]; then
dotnet pack --property:VersionSuffix=$FlecsVersionSuffix -c Debug
dotnet pack --property:VersionSuffix=$FlecsVersionSuffix -c Release
dotnet pack --property:VersionSuffix=$FlecsVersionSuffix -p:SkipNatives=true -c Debug
dotnet pack --property:VersionSuffix=$FlecsVersionSuffix -p:SkipNatives=true -c Release
else
dotnet pack --property:VersionSuffix=$FlecsVersionSuffix --property:FlecsPackPdb=true -c Debug
dotnet pack --property:VersionSuffix=$FlecsVersionSuffix --property:FlecsPackPdb=true -c Release
dotnet pack --property:VersionSuffix=$FlecsVersionSuffix --property:FlecsPackPdb=true -p:SkipNatives=true -c Debug
dotnet pack --property:VersionSuffix=$FlecsVersionSuffix --property:FlecsPackPdb=true -p:SkipNatives=true -c Release
fi
- name: Upload Artifacts
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public record struct Velocity(float X, float Y);
- Fully blittable interface with no runtime marshalling

**Flecs.NET.Native - Precompiled native libraries**
- Provides both shared and static libraries for Windows, MacOS, and Linux
- Provides both shared and static libraries for Windows, MacOS, Linux, iOS, and WASM
- Static libraries are automatically linked for NativeAOT builds (`$(FlecsStaticPath)` available for manual linking for other targets)
- Packaged with Zig for dependency free cross-compilation everywhere

## NuGet
Expand Down Expand Up @@ -172,8 +173,6 @@ Reference the project and import the native libraries. You should now be able to
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<Import Project="PATH/Flecs.NET/src/Flecs.NET.Native/Flecs.NET.Native.targets" />

<ItemGroup>
<ProjectReference Include="PATH/Flecs.NET/src/Flecs.NET/Flecs.NET.csproj" />
</ItemGroup>
Expand Down
2 changes: 0 additions & 2 deletions src/Flecs.NET.Benchmarks/Flecs.NET.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
<NoWarn>$(NoWarn);CS8618</NoWarn>
</PropertyGroup>

<Import Project="../Flecs.NET.Native/Flecs.NET.Native.targets"/>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.12"/>
<ProjectReference Include="../Flecs.NET/Flecs.NET.csproj"/>
Expand Down
2 changes: 0 additions & 2 deletions src/Flecs.NET.Examples/Flecs.NET.Examples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
<DefineConstants>$(DefineConstants);$(Example)</DefineConstants>
</PropertyGroup>

<Import Project="../Flecs.NET.Native/Flecs.NET.Native.targets"/>

<ItemGroup>
<ProjectReference Include="../Flecs.NET/Flecs.NET.csproj"/>
</ItemGroup>
Expand Down
Loading

0 comments on commit c20c74b

Please sign in to comment.