Animus
C++ cross platform CMake template using Djinni
Install / Use
/learn @sgerbino/AnimusREADME
Animus
Animus is a template CMake project that utilizes Djinni to generate Swift, Objective-C and Java bindings for modern C++. This is particularly useful for developing cross-platform mobile applications with common application logic.
The goal is this project is to provide:
- A core library template that can be used in the most native way for the IDE at hand
- In Xcode, we build a framework with a modulemap included; This allows us to use the libraries created with a simple `import' statement, rather than requiring a bridging header
- In Android Studio, we ensure that the CMake file can be consumed by Android Studio's gradle file out-of-the-box
- Support for out of source builds by default
- A modern CMake and C++ cross-platform implementation
Table of contents
Quick start
git clone https://github.com/sgerbino/animus.git
git submodule update --init --recursive
mkdir build
cd build
cmake .. -G Xcode
Usage
Define your core application interface in $PROJECT_SOURCE_DIR/rc/djinni/interface_definition.djinni and implement your interface in C++ in $PROJECT_SOURCE_DIR/src/cpp.
Android
To use an animus based project in Android Studio, open your Android project build.gradle and add the following snippets to the necessary sections.
android {
defaultConfig {
externalNativeBuild {
cmake {
cppFlags "-std=c++14 -fexceptions"
arguments "-DANDROID_STL=c++_static"
}
}
}
externalNativeBuild {
cmake {
path "deps/animus/CMakeLists.txt"
}
}
}
Examples
Apple example
After building the project on macOS, a framework will be generated. Including this in a project will allow you to use your core API from Objective-C and/or Swift.
import Animus
...
var api = Api.createApi(AppleEventLoop(), httpClient: AppleHttp(), threadLauncher: AppleThreadLauncher())
macOS Swift Example
Android example
Coming soon
Directory structure
├── deps/ # third party dependencies
├── rc/ # resources folder
├── src/ # contains hand-written source files in Objective-C, C++, and Java
├── .travis.yml # defines Travis-CI automated builds and regression tests
└── CMakeLists.txt # the top-level CMake build file
License
This project uses the "FreeBSD License" or "Simplified BSD License" making it compatible with both commercial software licenses and the GNU/GPL. For more information see LICENSE.
Related Skills
node-connect
345.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
106.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
