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 Don't use fields for non-strict interop enum constants Aug 30, 2018
backend.native Improve code by implicit integer coercion for literals and const vals Aug 30, 2018
buildSrc Fix error reporting in TeamCity: don't create a TestCase for each tes… Aug 29, 2018
cmd KLIB reader: uniform API for obtaining module descriptors from Kotlin… Aug 25, 2018
common Copyright update. (#1944) Aug 27, 2018
dependencies Copyright update. (#1944) Aug 27, 2018
extracted Enable implicit integer coercion for interop libraries Aug 30, 2018
gradle [compiler][update] 1.3-M2-eap-33 / build: 1.3-M1-eap-77 Aug 21, 2018
klib Copyright update. (#1944) Aug 27, 2018
konan Copyright update. (#1944) Aug 27, 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] added repository of bootstrap compiler Aug 22, 2018
platformLibs Add Accelerate framework to macOS. (#1961) Aug 29, 2018
runtime Use NSNumber subclasses for Kotlin numbers when producing framework (#… Aug 29, 2018
samples Improve code by implicit integer coercion for literals and const vals Aug 30, 2018
shared [dependencies] Add timeout for dependency extraction (#1947) Aug 28, 2018
tools [gradle-plugin] Support static and shared libraries (#1942) Aug 28, 2018
utilities Copyright update. (#1944) Aug 27, 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.9 preparations. (#1962) Aug 29, 2018
CONCURRENCY.md Concurrent API update. (#1949) Aug 29, 2018
DEBUGGING.md Docs update Nov 3, 2017
DISTRO_README.md v0.5 preparations. (#1135) Dec 15, 2017
FAQ.md Gross stdlib cleanup (part 2) (#1924) Aug 24, 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 v0.9 preparations. (#1962) Aug 29, 2018
INTEROP.md v0.9 preparations. (#1962) Aug 29, 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 KLIB reader: uniform API for obtaining module descriptors from Kotlin… Aug 25, 2018
gradle.properties Update kotlin-compiler.jar to 1.3-M2-release-200 Aug 30, 2018
gradlew build: Use Gradle 4.2 Oct 4, 2017
gradlew.bat Add Gradle wrapper. (#19) Oct 27, 2016
settings.gradle KLIB reader: uniform API for obtaining module descriptors from Kotlin… Aug 25, 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.