Skip to content

Commit

Permalink
Disable automatic NativeAOT linking
Browse files Browse the repository at this point in the history
Currently `BindgenInternal.LoadDLLSymbol` do not supports statically linked
libraries so for now disable automatic linking and add comment with explanation.

Signed-off-by: Tomas Slusny <[email protected]>
  • Loading branch information
deathbeam committed Oct 26, 2024
1 parent c20c74b commit 88fe47a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public record struct Velocity(float X, float Y);

**Flecs.NET.Native - Precompiled native libraries**
- 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)
- `$(FlecsStaticLibrary)` is provided for static linking in MSBuild projects
- Packaged with Zig for dependency free cross-compilation everywhere

## NuGet
Expand Down
4 changes: 3 additions & 1 deletion src/Flecs.NET.Native/buildTransitive/Flecs.NET.Native.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<Project>
<PropertyGroup>
<FlecsStaticPath>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)../static/$(RuntimeIdentifier)/native/'))</FlecsStaticPath>
<IsWindowsRuntime Condition="'$(RuntimeIdentifier)' != '' and $(RuntimeIdentifier.StartsWith('win-'))">true</IsWindowsRuntime>
<FlecsStaticPath>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)../static/$(RuntimeIdentifier)/native/'))</FlecsStaticPath>
<FlecsStaticLibrary Condition="'$(IsWindowsRuntime)' == 'true'">$(FlecsStaticPath)flecs.lib</FlecsStaticLibrary>
<FlecsStaticLibrary Condition="'$(IsWindowsRuntime)' != 'true'">$(FlecsStaticPath)libflecs.a</FlecsStaticLibrary>
</PropertyGroup>
</Project>
7 changes: 4 additions & 3 deletions src/Flecs.NET.Native/buildTransitive/Flecs.NET.Native.targets
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project>
<ItemGroup Condition="'$(PublishAot)' == 'true'">
<!-- FIXME: BindgenInternal.LoadDLLSymbol do not supports static linking
<ItemGroup Condition="'$(PublishAot)' == 'true' and Exists('$(FlecsStaticLibrary)')">
<DirectPInvoke Include="flecs"/>
<NativeLibrary Condition="'$(IsWindowsRuntime)' == 'true'" Include="$(FlecsStaticPath)flecs.lib"/>
<NativeLibrary Condition="'$(IsWindowsRuntime)' != 'true'" Include="$(FlecsStaticPath)libflecs.a"/>
<NativeLibrary Include="$(FlecsStaticLibrary)"/>
</ItemGroup>
-->
</Project>

0 comments on commit 88fe47a

Please sign in to comment.