Gir.Core is a C# wrapper for GObject-based libraries like GTK for user interfaces.
This project aims to provide a complete set of APIs for writing rich cross-platform user interfaces and multimedia programs. It is built upon the well-established GObject Introspection framework for language bindings.
- Idiomatic C#: An API which feels natural to C# developers (including the async/await feature).
- Simplicity: Memory management is handled automatically, greatly simplifying the C-API.
- Complete API: Support for the entire GTK and GStreamer stack, enabling feature-rich applications which deeply integrate with the OS.
- Declarative UI: A declarative syntax for creating GTK UIs (See the DeclarativeUI Sample). User interfaces may also be created the traditional way and/or with GtkBuilder XML.
- Extensibility: Allows 3rd party developers to write bindings for other GObject-based libraries, achieving full interoperability between them.
We are currently in a period of heavy iteration over the core internals of the project. The code is under heavy development and not ready for production. There are some pre release nuget packages available for testing purposes. Feel free to visit the nuget organization to get an overview.
Library | Description | Level of Support |
---|---|---|
GTK 3 | UI-Toolkit | Partial |
GTK 4 | UI-Toolkit | Partial |
GStreamer | Multimedia Framework | Partial |
Cairo | Graphics Library | Partial |
Pango | Font/Text Library | Partial |
Gio | Library for high level application functionality | Partial |
GdkPixbuf | Image loading in various formats | Partial |
libshumate | Library to display maps | Planned |
WebKitGTK | Browser Engine | Planned |
JavaScriptCore | JavaScript engine for WebKit | Planned |
Anyone who wants to help is very welcome. If you want to start working on the project, take a look at our Good First Issues or get in touch by starting a Discussion.
We have a matrix room for discussing gir.core. Please join if you'd like to help (or just want to chat!)
https://matrix.to/#/#gircore:matrix.org?via=matrix.org
To generate the bindings locally follow these steps. Make sure to initialise submodules with --recursive
otherwise the gir-files
directory will not be loaded properly.
$ git clone --recursive https://github.com/gircore/gir.core.git
$ cd gir.core/src
$ dotnet fsi GenerateLibs.fsx
If you want to build using Windows please see the accompanying documentation.
If you want to clean the Libs folder of all generated files run:
$ dotnet fsi CleanLibs.fsx
To use the newly generated libraries in your project just add a reference to the csproj file of the project you want to use, e.g:
$ dotnet add reference [RepoPath]/Libs/Gtk/Gtk.csproj
The folder structure in this repository is organized as follows:
- src/GirTool: The tool to generate the bindings.
- src/Generation/GirLoader: A library for reading and resolving GObject Introspection repositories.
- src/Generation/GirModel: An interface based definition of the GObject data model. Used by the loader and generator to have a common understanding of the GObject data model.
- src/Generation/Generator: Code generator generates C# code from GObject Introspection data.
- src/Integration: Optional source generators to reduce boilerplate code in your projects.
- src/Libs: Contains manually written code for libraries. The generator outputs code here.
- src/Samples: Example programs using GTK, GStreamer, and others.
- src/Extensions: Auxilary libraries which extend the core libraries.
- src/Tests: Unit and Integration tests.
- ext/gir-files: Introspection data from gircore/gir-files.
The code in the library folder is not complete because most of the code is generated when the GirTool is run.
Gir.Core is licensed under the terms of the MIT-License. Please see the license file for further information.
The Gir.Core logo is built upon the original GTK logo by Andreas Nilsson which is licensed under the GNU Free Documentation License and was relicensed under CC BY-SA 3.0. Therefore the Gir.Core logo is licensed under the CC BY-SA 3.0, too.