The Silk.NET Contributors Guide
Welcome to the Silk.NET project! We're so glad you want to help us create the best native interoperation experience that .NET has ever seen.
This contributors guide covers many topics about Silk.NET's internals in great detail to help anyone pick up any part of the codebase and hit the ground running.
Table of Contents
Getting Started
Prerequisites
To get started, first clone Silk.NET using git clone https://github.com/dotnet/Silk.NET --depth 1
. Your development
environment will need the latest production-ready .NET SDK, so make sure you've installed that from
get.dot.net. We also recommend installing NUKE using dotnet tool install -g NUKE.GlobalTool
to
enable our auxiliary build commands/utilities, but this is optional and in fact can be accessed using the
./build.sh
/.\build.cmd
/.\build.ps1
scripts in place of nuke
in usages in this guide without installing the tool.
If you'd like to build and/or work with the mobile support in Silk.NET, you'll need to install the workloads using
dotnet workload restore
. It is highly likely you need to prefix this with sudo
on macOS and Linux. In addition,
you'll need to install the Android SDK with API 34 and API 35 support to ensure a successful build. Furthermore, on
macOS you will need Xcode installed with the iOS platform installed. Alternatively, if you don't want to work with our
mobile support, you can disable it for your local builds using nuke disable-platforms --platforms android ios
for
example. The acceptable values for --platforms
are any valid platform identifiers (i.e. right-hand side of the -
of
a TargetFramework
, without platform version information).
We automatically disable iOS support on Linux, as these workloads are only available on Windows and macOS. For more
information about the NUKE utilities, consult the Build System documentation or use nuke --help
.
Building from Source
Assuming you've got the prerequisites installed, dotnet build
! Or dotnet pack
to produce all the NuPkgs in
artifacts/pkg
.
To learn more about the build system, see the Build System documentation. It is intentionally
designed to be as compatible as possible with the regular dotnet build
system such that you can use the built-in
utilities of your favourite IDE.
Regenerating Bindings
You can regenerate bindings using NUKE with nuke regenerate-bindings
, but this isn't recommended. A full regeneration
of Silk.NET takes a long time and has the potential to touch the vast majority of the files that make up Silk.NET and/or
create loads of unrelated changes in your working tree. Instead, it is preferred to run SilkTouch manually using a
command like
dotnet run --project sources/SilkTouch/SilkTouch/Silk.NET.SilkTouch.csproj -c Release -- generator.json -s Job1 -s Job2 ...
where the values for the -s
arguments are replaced with the job names (the keys of the Jobs
dictionary in
generator.json
e.g. SDL
, OpenGL
, etc).
For more information on SilkTocuh arguments, consult the SilkTouch User Guide or use
dotnet run --project sources/SilkTouch/SilkTouch/Silk.NET.SilkTouch.csproj -- --help
.
📄️ Build System
Silk.NET strives to use vanilla dotnet build as much as possible, and that is the case for building Silk.NET itself.
📄️ Contribution Process
You can contribute to Silk.NET with issues and PRs. Simply filing issues for problems you encounter is a great way to contribute. Contributing code is also greatly appreciated.