Skip to content

Instantly share code, notes, and snippets.

View whyoleg's full-sized avatar

Oleg Yukhnevich whyoleg

View GitHub Profile
@aSemy
aSemy / kn_cpp_compilation.md
Last active July 30, 2024 22:06
Kotlin/Native: Compile C++ code to

Kotlin/Native has a utility, run_konan, that can be used to compile C/C++ code.

I've written two Gradle tasks, RunKonanClangTask and RunKonanClangTask, that can be used to compile JoltC. A lot of credit goes to https://github.com/michal-z for writing C wrappers for Jolt!

This Gist is very scrappy, and is missing a lot of information.

  • Kotlin 1.9.0
  • I've only tested it on Windows.
  • The Kotlin target must be set manually - is it possible to make this automatic?
  • While the .konan dir can be retrieved from a KGP util function, the path to konan_run file must be set manually (e.g. kotlin-native-prebuilt-windows-x86_64-1.9.0) - is it possible to make this automatic?