Configuration Reference
The cInterop { } block exposes the CInteropExtension, which controls all aspects of the pipeline.
Top-Level Properties
Property | Type | Default | Description |
|---|---|---|---|
|
|
| Master switch — must be |
|
| (project name) | Overrides the name used for the Rust project directory and C-Interop compilation unit |
|
|
| Directory (relative to the Gradle module) where the Rust project is created |
|
|
| Overrides the Kotlin package name under which the native bindings are exposed |
|
| (auto-detected) | Explicit list of Rust target triples to compile for; if empty the host OS/arch is used |
Target Auto-Detection
When rustTargets is not set, Kreate detects the current host and selects a single target automatically:
Host OS | Host Architecture | Resolved Target |
|---|---|---|
Windows | x86_64 |
|
Linux | x86_64 |
|
Linux | aarch64 |
|
macOS | aarch64 |
|
For cross-compilation or multi-target releases, set rustTargets explicitly.
Rust Target → Kotlin/Native Target Mapping
Each Rust target triple is mapped to a Kotlin/Native target automatically:
Rust Target Triple | Kotlin/Native Target |
|---|---|
|
|
|
|
|
|
|
|
Any other triple causes a GradleException at configuration time.
Definition File Configuration
The defFile { } sub-block configures the .def file generated for Kotlin/Native:
Property | Type | Default | Description |
|---|---|---|---|
|
|
| Name of the generated |
|
|
| Directory name (inside the Rust project) where the |
Per-Platform Native Target Configuration
You can apply additional Kotlin/Native target configuration for each platform family using the mingw { }, linux { }, and macos { } blocks. These receive a KotlinNativeTarget receiver and are executed after Kreate wires the C-Interop compilation:
Generated .def File Format
The GenerateDefinitionFiles task writes a .def file with the following format:
When multiple Rust targets are configured, all their release directories are listed in libraryPaths separated by spaces.
Generated build.rs
The GenerateRustBuildScript task writes the following Rust build script if none exists yet (or if the existing file is empty):
This script runs automatically during cargo build and produces the C header consumed by the .def file.