C# / .NET bindings for Yoga, Facebook's embeddable flexbox layout engine.
To build the native library (after cloning the repository and the submodules):
On macOS:
# Optionally add `-G Ninja` to use the Ninja build system
cmake -DCMAKE_BUILD_TYPE=Release -S . -B build
cmake --build buildOn Windows:
cmake -DCMAKE_BUILD_TYPE=Release -S . -B build
cmake --build build --config ReleaseThen just build the C# project. For example, using the .NET CLI:
dotnet buildAlternatively, for the C# project, you can use your favorite .NET IDE.
The test projects assume the native library is built and available in the build directory. To run the tests via the .NET CLI:
dotnet testAlternatively, you can use your favorite .NET IDE.
For now, you can reference the Yoga.NET project in your solution.
You must also ensure that the native library is built and available in the output directory of your project. The Yoga.NET.Interop project expects the native library to be in a specific location relative to the output directory. See the Yoga.NET.Tests project for an example of how to set this up.
In the future, this library will be available on NuGet (both the C# bindings and the native library).
- Yoga.NET: High-level C#-style abstraction layer. It is recommended to use this when possible.
- Yoga.NET.Interop: Low-level Yoga bindings closely matching the C API. You can resort to this when the high-level API is not sufficient.
- Yoga.NET.Tests: Test suite.
This library uses ClangSharpPInvokeGenerator to generate the C# bindings from the Yoga C/C++ API headers (included as a submodule).
dotnet tool restore
cd src/Yoga.NET.Interop
./GenerateBindings.sh