Git Product home page Git Product logo

forando / kotlin-native Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jetbrains/kotlin-native

0.0 1.0 0.0 87.52 MB

Kotlin/Native infrastructure

License: Apache License 2.0

Kotlin 60.60% C 3.39% Shell 0.13% Java 0.03% C++ 7.42% Groovy 0.73% Pascal 0.01% Batchfile 0.04% JavaScript 0.11% Objective-C 1.00% Objective-C++ 0.77% Python 0.16% HTML 0.03% Swift 25.53% CSS 0.01% CMake 0.02% Dockerfile 0.01%

kotlin-native's Introduction

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 12.0 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.