Skip to content
Kotlin/Native infrastructure
Kotlin Swift C++ C Objective-C Groovy Other
Branch: master
Clone or download

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE Update issue template May 20, 2020
.idea Setup IntelliJ issue navigation from VCS Apr 21, 2020
Interop Get rid of konan.home in the compiler May 20, 2020
backend.native Make sure the class hierarchy is available for IrLazyClasses in inter… Jun 5, 2020
build-tools DFS is a Kotlin object and requires INSTANCE to access its methods Jun 5, 2020
cmd Get rid of konan.home in the compiler May 20, 2020
common Unicode support in Windows console: reading in UTF-16 and converting … Jun 4, 2020
dependencies [DependencyProcessor] Untie from platform-default archive type Mar 3, 2020
dependencyPacker Get rid of konan.home in the compiler May 20, 2020
endorsedLibraries Get rid of konan.home in the compiler May 20, 2020
gradle [build] Create a separate utility module for basic things May 20, 2020
klib Get rid of konan.home in the compiler May 20, 2020
konan Get rid of konan.home in the compiler May 20, 2020
libclangext Update libclangext/build.gradle (#4024) Mar 26, 2020
licenses Fix incorrect path of license file in mimalloc sources May 21, 2020
llvmCoverageMappingC Bumped both bootstrap compiler and usual compiler versions Oct 31, 2019
llvmDebugInfoC [debug][bindings][python] drop `print_this` command. Apr 30, 2020
performance Benchmark for objects allocations (#4216) Jun 4, 2020
platformLibs [Darwin][PlatformLibs] Get rid of OBJC_OLD_DISPATCH_PROTOTYPES May 18, 2020
runtime Better unicode support: use UTF-16 for console input, while piped inp… Jun 4, 2020
samples Update Kotlin version in samples (#4103) Apr 15, 2020
shared Unicode support in Windows console: reading in UTF-16 and converting … Jun 4, 2020
tools Get rid of konan.home in the compiler May 20, 2020
utilities Use Gradle message renderer if the compiler is started from daemon May 20, 2020
.gitignore Adding CompilationDatabase generation (#4091) Apr 22, 2020
.gitmodules Added JB copyright (#417) Mar 30, 2017
CHANGELOG.md [doc][changelog] 1.4.0-M1 initial changelog Apr 23, 2020
COCOAPODS.md Fix typo in COCOAPODS.md (#4020) Mar 25, 2020
CODE_COVERAGE.md [Coverage]Enable code coverage for linux_x64 and mingw_x64 Oct 3, 2019
CONCURRENCY.md Align docs with USE_CYCLIC_GC=0 (ed36f02) May 18, 2020
DEBUGGING.md docs: drop debugging unnecessary title (#2091) Sep 19, 2018
DISTRO_README.md Kotlin/Native samples ported to MPP Gradle DSL (#2261) Oct 26, 2018
FAQ.md Improve Gradle DSL in docs (#3481) Oct 25, 2019
GRADLE_PLUGIN.md Fix typo (#3628) Dec 2, 2019
HACKING.md Changes to support unsigned progressions in ForLoopsLowering. May 19, 2020
IMMUTABILITY.md Proofread Watson (#2055) Sep 13, 2018
INTEROP.md Unify compiler and cinterop flags names (#2915) Apr 30, 2019
IOS_SYMBOLICATION.md Enable light debug information (#4085) Apr 10, 2020
LIBRARIES.md Unify compiler and cinterop flags names (#2915) Apr 30, 2019
LICENSE Synchronize LICENSE with licenses/LICENSE.txt, update the year Apr 10, 2020
MULTIPLATFORM.md fix link in MULTIPLATFORM.md (#2164) Oct 2, 2018
OBJC_INTEROP.md Update suspend support status in OBJC_INTEROP.md May 6, 2020
PLATFORM_LIBS.md Update .md documentation Jan 30, 2019
README.md Update Xcode requirement in README.md Apr 8, 2020
RELEASE_NOTES.md V1.3.60 changelog (#3391) Sep 28, 2019
_nav_reference.yml Add initial documentation for symbolicating iOS crash reports (#3367) Sep 30, 2019
build.gradle [build] Create a separate utility module for basic things May 20, 2020
gradle.properties Bump konanVersion: 1.4.20 Jun 4, 2020
gradlew Update Gradle: 6.0.1 Nov 28, 2019
gradlew.bat Update Gradle: 5.5 Jul 10, 2019
settings.gradle [build] Create a separate utility module for basic things May 20, 2020

README.md

official project version

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 11 (Xcode 11.4 is required to compile Kotlin/Native from sources)
  • on Fedora 26+ yum install ncurses-compat-libs may be needed
  • on recent Ubuntu apt install libncurses5 is needed

To compile from sources use following steps:

First, download dependencies:

./gradlew dependencies:update

Then, build the compiler and libraries:

./gradlew bundle

To build with experimental targets support compile with -Porg.jetbrains.kotlin.native.experimentalTargets.

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

It's possible to include in a composite build both Kotlin compiler and Kotlin/Native Shared simultaneously.

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.

You can’t perform that action at this time.