Kotlin C++ Groovy C Objective-C++ Swift Other
Switch branches/tags
Clone or download
Permalink
Failed to load latest commit information.
Interop Add toKString() from short array Jun 30, 2018
backend.native Fixed bug in post-inline lowering Jul 18, 2018
buildSrc [build] replace direct urls with cached ones Jul 9, 2018
cmd Make run_konan compatible with msys (#1683) Jun 14, 2018
common Moved clang flags out of the root build.gardle. Jul 12, 2017
contrib WebAssembly effort (#721) Jul 14, 2017
dependencies [build] replace direct urls with cached ones Jul 9, 2018
gradle [build] replace direct urls with cached ones Jul 9, 2018
klib [libraries] Move SearchPathResolver into shared May 11, 2018
konan 32-bit iOS support (#1708) Jun 21, 2018
libclangext [build][gradle] switch to gradle-4.7 May 21, 2018
licenses Zephyr's copy of Apache license. Feb 12, 2018
llvmDebugInfoC Fix synthetic childern print Jul 16, 2018
performance Marked global mutable state in the benchmark as thread local Jul 18, 2018
platformLibs [build] replace direct urls with cached ones Jul 9, 2018
runtime Fix Random.nextInt with bound that returned negative values Jul 12, 2018
samples Better reading to buffer in example. Jul 12, 2018
shared [util][no-java] added File.equals/.hashCode Jul 11, 2018
tools [gradle][experimental] publish the per component pom into variant gen… Jul 18, 2018
utilities [libraries] Move SearchPathResolver into shared May 11, 2018
.gitignore samples: Port android build to stable android gradle plugin Nov 13, 2017
.gitmodules Added JB copyright (#417) Mar 30, 2017
CHANGELOG.md v0.8 preparations. (#1762) Jul 5, 2018
CONCURRENCY.md Fix typos in CONCURRENCY.md (#1714) Jun 23, 2018
DEBUGGING.md Docs update Nov 3, 2017
DISTRO_README.md v0.5 preparations. (#1135) Dec 15, 2017
FAQ.md FAQ: Question headings (#1776) Jul 8, 2018
GRADLE_PLUGIN.md [gradle-plugin] Publish the plugin to plugin portal (#1789) Jul 12, 2018
HACKING.md Add documentation for KONAN_DATA_DIR variable Apr 5, 2018
IMMUTABILITY.md Freeze objects by default, stdlib improvements. (#1743) Jul 3, 2018
INTEROP.md Add very basic documentation for interop with Swift/Objective-C (#1482) Apr 18, 2018
LIBRARIES.md Add documentation for KONAN_DATA_DIR variable Apr 5, 2018
LICENSE Add missing LICENSE file Apr 28, 2017
MULTIPLATFORM.md Add a link to the MPP sample repo in the MPP doc (#1494) May 28, 2018
OBJC_INTEROP.md Add note about singletons to OBJC_INTEROP.md Jun 6, 2018
PLATFORM_LIBS.md Fix typos and remove some TODOs Dec 18, 2017
README.md Documentation tweaks. Jun 28, 2018
RELEASE_NOTES.md v0.8 preparations. (#1762) Jul 5, 2018
RELEASE_PROCESS.md [readme] Fix URL rendering in RELEASE_PROCESS.md Feb 22, 2018
build.gradle [gradle-plugin] Publish the plugin to plugin portal (#1789) Jul 12, 2018
gradle.properties [kotlin compiler][update] 1.2.70-dev-402 Jul 17, 2018
gradlew build: Use Gradle 4.2 Oct 4, 2017
gradlew.bat Add Gradle wrapper. (#19) Oct 27, 2016
settings.gradle [build][warning] enable GRADLE_METADATA to avoid konan gradle plugins… May 9, 2018

README.md

official project

Kotlin/Native

Kotlin/Native is an LLVM backend for the Kotlin compiler, runtime implementation, and native code generation facility using the LLVM toolchain.

Kotlin/Native is primarily designed to allow compilation for platforms where virtual machines are not desirable or possible (such as iOS or embedded targets), or where a developer is willing to produce a reasonably-sized self-contained program without the need to ship an additional execution runtime.

Prerequisites:

  • install JDK for your platform, instead of JRE. The build requires tools.jar, which is not included in JRE;
  • on macOS install Xcode 9.4.1
  • on Fedora 26+ yum install ncurses-compat-libs may be needed

To compile from sources use following steps:

First, download dependencies:

./gradlew dependencies:update

Then, build the compiler and libraries:

./gradlew bundle

The build can take about an hour on a Macbook Pro. To run a shorter build with only the host compiler and libraries, run:

./gradlew dist distPlatformLibs

To include Kotlin compiler in composite build and build against it, use the kotlinProjectPath project property:

./gradlew dist -PkotlinProjectPath=path/to/kotlin/project

After that, you should be able to compile your programs like this:

export PATH=./dist/bin:$PATH
kotlinc hello.kt -o hello

For an optimized compilation, use -opt:

kotlinc hello.kt -o hello -opt

For tests, use:

./gradlew backend.native:tests:run

To generate interoperability stubs, create a library definition file (refer to samples/tetris/.../sdl.def), and run the cinterop tool like this:

cinterop -def lib.def

See the provided samples and INTEROP.md for more details.

The Interop tool generates a library in the .klib library format. See LIBRARIES.md for more details on this file format.