A template for a Djinni library that can be used in Java/Kotlin on Android, ObjC/Swift on iOS/macOS and C# on Windows.
- ๐งโโ๏ธ Develop your library once in C++, use it in Code written in Java, C++/CLI (.NET 6) or Swift thanks to Djinni.
- ๐จโ๐ฉโ๐ฆโ๐ฆ Can build & bundle binaries for
- macOS, iOS (XCFramework)
- Android (AAR)
- Windows .NET 6.0 (NuGet)
- Linux
- ๐ฃ Dependency Management with Conan
- ๐งถ Easy to use CLI to configure build output for different platforms
- ๐ Building Doxygen docs for all target languages
- Create a new repository using this template. Check it out on your local machine.
- Create a
VERSION
file specifying a temporary version for local development. The build process relies on the existence of either aVERSION
-file (e.g.0.0.1
), or a Git release tag (e.g.v0.0.1
) for determining the library version. - Make sure you understand how to use it in your project & how to build & run for development before you change something.
- Search for all occurrences of "MyDjinniLibrary", "DjinniLibrary", "My" in the project to replace all occurrences of the
template target and/or namespaces. You can ignore anything inside
lib/djinni-generated
, as it will be updated by Djinni automatically.
This template integrates into each build system by providing a package format native to each platform.
- Add the repository to your project
repositories { maven { url "https://maven.pkg.github.com/jothepro/djinni-library-template" } }
- Add the package dependencies to your applications build.gradle file:
dependencies { implementation 'my.djinnilibrary:mydjinnilibrary' }
The NuGet package only works for .NET 6 (Core) Projects!
- Add the Package Source.
https://nuget.pkg.github.com/jothepro/index.json
- In the NuGet Package Manager search for
MyDjinniLibrary
and install the package.
- Add the repository
jothepro/djinni-library-template-swiftpackage
as Package dependency to your XCode project. It contains the XCFramework with the Objective-C binaries. - Add this import to the swift code:
import MyDjinniLibrary
This template is meant to be used in a C++ project on Linux, e.g. together with gtkmm-3.0
.
The binary for Linux consists of just the C++ interface without any wrapper.
- Add the conan remote.
conan remote add djinni_library_template https://gitlab.com/api/v4/projects/27897297/packages/conan
- Add the library as dependency in your conanfile.
[requires] my_djinni_library/1.0.0@jothepro/release
Read Next: Development