Kotlin C++ Groovy C Objective-C++ Swift Other
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Interop Update LLVM to 6.0.1 and WebAssembly target refactoring (#1788) Aug 14, 2018
backend.native Fix for #1880 Aug 16, 2018
buildSrc [build] replace direct urls with cached ones Jul 9, 2018
cmd Update LLVM to 6.0.1 and WebAssembly target refactoring (#1788) Aug 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
extracted [stdlib and samples][rename] konan -> kotlin.native Aug 14, 2018
gradle [build] replace direct urls with cached ones Jul 9, 2018
klib Move KonanBuiltIns to a separate module (#1860) Aug 14, 2018
konan Update LLVM to 6.0.1 and WebAssembly target refactoring (#1788) Aug 14, 2018
libclangext Update LLVM to 6.0.1 and WebAssembly target refactoring (#1788) Aug 14, 2018
licenses Zephyr's copy of Apache license. Feb 12, 2018
llvmDebugInfoC [lldb][python] Synthetic children handling enhancements. Aug 1, 2018
performance [performance] rename konan -> kotlin.native Aug 15, 2018
platformLibs Add libiconv to mingw platform (#1861) Aug 10, 2018
runtime Implemented KType, KCallable.returnType Aug 15, 2018
samples [samples] Fix samples for IDE (#1888) Aug 16, 2018
shared Update LLVM to 6.0.1 and WebAssembly target refactoring (#1788) Aug 14, 2018
tools Update LLVM to 6.0.1 and WebAssembly target refactoring (#1788) Aug 14, 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 Corrected spelling/grammar wherever needed (#1818) Jul 19, 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 Move KonanBuiltIns to a separate module (#1860) Aug 14, 2018
gradle.properties [kotlin compiler][update] 1.2.70-dev-1218 Aug 14, 2018
gradlew build: Use Gradle 4.2 Oct 4, 2017
gradlew.bat Add Gradle wrapper. (#19) Oct 27, 2016
settings.gradle Move KonanBuiltIns to a separate module (#1860) Aug 14, 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.