Automatically updated C# bindings for https://github.com/SanderMertens/flecs with native dynamic link libraries. Includes the lower-level unsafe C# "binding" which is 100% automatically generated. The higher level safe "wrapper" is still being worked on.
- Download and install .NET 6.
- Fork the repository using GitHub or clone the repository manually with submodules:
git clone --recurse-submodules https://github.com/flecs-hub/flecs-cs
. - Build the native library by running
library.sh
. To execute.sh
scripts on Windows, use Git Bash which can be installed with Git itself: https://git-scm.com/download/win. Thelibrary.sh
script requires that CMake is installed and in your path. - To setup everything you need: Either (1), add the
src/cs/production/Flecs/Flecs.csproj
C# project to your solution as an existing project and reference it within your own solution, or (2) import the MSBuildflecs.props
file which is located in the root of this directory to your.csproj
file. See the flecs.csproj file for how to import theflecs.props
directly.
Generate binding / wrapper C# code from flecs.h
C header file (automatically done by GitHub actions)
- Download and install .NET 6.
- Fork the repository using GitHub or clone the repository manually with submodules:
git clone --recurse-submodules https://github.com/flecs-hub/flecs-cs
. - Install the lastest version of C2CS tool:
dotnet tool install -g bottlenoselabs.C2CS.Tool
- Use C2CS to extract the abstract syntax trees for either Windows, macOS, or Linux:
cd ./bindgen && c2cs
. It's recommended that you do this once on a Windows machine with C/C++ SDK, once on a macOS machine with XCode / CommandLineTools, and once on a Linux machine with dev tools. For more information on why and how this works see https://github.com/lithiumtoast/c2cs. - Move the resulting abstract syntax trees
.json
files from the previous step in the./bindgen/ast/
directory across machines onto a single machine (any OS). - Use C2CS to generate the C# code from the abstract syntax trees:
cd ./bindgen && write_csharp_code.sh
. If all is well you should now have an updated./src/cs/production/Flecs/flecs.cs
file.
For examples in C#, see ./src/cs/examples, or open up the solution .sln
file in VisualStudio / Rider.
To learn how to use flecs
directly, check out the https://github.com/SanderMertens/flecs#documentation.
For more information on how C# binding / wrapper work, see C2CS
, the tool that generates the binding / wrapper for flecs
and other C libraries.
flecs-cs
is licensed under the MIT License (MIT
) - see the LICENSE file for details.
flecs
itself is licensed under MIT (MIT
) - see https://github.com/SanderMertens/flecs/blob/master/LICENSE for more details.