Giter VIP home page Giter VIP logo

deiufy / kotlin-native Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jetbrains/kotlin-native

1.0 1.0 0.0 74.12 MB

Kotlin/Native infrastructure

License: Apache License 2.0

C 2.16% C++ 14.56% Kotlin 77.25% JavaScript 0.31% Java 0.01% Swift 0.98% Objective-C 0.18% Groovy 2.32% Shell 0.19% Batchfile 0.12% Pascal 0.03% Python 0.22% HTML 0.08% Objective-C++ 1.50% Dockerfile 0.05% CSS 0.03%

kotlin-native's Introduction

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 10.2
  • 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

To include Kotlin/Native Shared in a composite build and build against it, use the sharedProjectPath project property:

./gradlew dist -PsharedProjectPath=path/to/kotlin/native/shared

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.

kotlin-native's People

Contributors

alefas avatar alejes avatar alexander-gorshenev avatar alexanderprendota avatar b1ggdave avatar ddolovov avatar dead-off avatar dsavvinov avatar e5l avatar eabatalov avatar homuroll avatar ilmat192 avatar ilya-g avatar jonnyzzz avatar kikitux avatar konstantinanisimov avatar matklad avatar maxmedvedev avatar msink avatar olonho avatar pavelpunegov avatar romanart avatar sandwwraith avatar sbogolepov avatar soywiz avatar stefma avatar svyatoslavscherbina avatar udalov avatar vvlevchenko avatar yole avatar

Stargazers

 avatar

Watchers

 avatar

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.