Minor fixes
This commit is contained in:
@@ -0,0 +1,41 @@
|
|||||||
|
Kotlin/Native #
|
||||||
|
|
||||||
|
_Kotlin/Native_ is a LLVM backend for the Kotlin compiler, runtime
|
||||||
|
implementation and native code generation facility using LLVM toolchain.
|
||||||
|
|
||||||
|
_Kotlin/Native_ is primarily designed to allow compilation for platforms where
|
||||||
|
virtual machines are not desirable or possible (such as iOS, embedded targets),
|
||||||
|
or where developer is willing to produce reasonably-sized self-contained program
|
||||||
|
without need to ship an additional execution runtime.
|
||||||
|
|
||||||
|
To get started with _Kotlin/Native_ take a look at the attached samples.
|
||||||
|
|
||||||
|
* `csvparser` - simple CSV file parser and analyzer
|
||||||
|
* `gitchurn` - program interoperating with `libgit2` for GIT repository analysis
|
||||||
|
* `libcurl` - using of FTP/HTTP/HTTPS client library `libcurl`
|
||||||
|
* `opengl` - OpenGL/GLUT teapot example
|
||||||
|
* `socket` - TCP/IP echo server
|
||||||
|
* `tetris` - Tetris game implementation (using SDL2 for rendering)
|
||||||
|
|
||||||
|
See `README.md` in each sample directory for more information and build instructions.
|
||||||
|
|
||||||
|
_Kotlin/Native_ could be used either as standalone compiler toolchain or as Gradle
|
||||||
|
plugin. See `GRADLE_PLUGIN.md` for more details on how to use this plugin.
|
||||||
|
|
||||||
|
Compile your programs like that:
|
||||||
|
|
||||||
|
export PATH=kotlin-native-<platform>-<version>/bin:$PATH
|
||||||
|
kotlinc hello.kt -o hello
|
||||||
|
|
||||||
|
For an optimized compilation use -opt:
|
||||||
|
|
||||||
|
kotlinc hello.kt -o hello -opt
|
||||||
|
|
||||||
|
To generate interoperability stubs create library definition file
|
||||||
|
(take a look on `samples/tetris/tetris.sdl`) and run `cinterop` tool like this:
|
||||||
|
|
||||||
|
cinterop -def lib.def
|
||||||
|
|
||||||
|
See `INTEROP.md` for more information on how to use C libraries from _Kotlin/Native_.
|
||||||
|
|
||||||
|
See `RELEASE_NOTES.md` for information on supported platforms and current limitations.
|
||||||
@@ -1,4 +1,10 @@
|
|||||||
Q: How do I run my program?
|
Q: How do I run my program?
|
||||||
|
|
||||||
A: Define top level function `fun main(args: Array<String>)`, please ensure it's not
|
A: Define top level function `fun main(args: Array<String>)`, please ensure it's not
|
||||||
in a package.
|
in a package.
|
||||||
|
|
||||||
|
Q: How do I create shared library?
|
||||||
|
|
||||||
|
A: It is not possible at the moment. Currently Kotlin/Native could be used to produce either
|
||||||
|
_Kotlin/Native_ own library format, which can be statically linked with application or
|
||||||
|
or an executable for target.
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
# Kotlin/Native Gradle plugin
|
# Kotlin/Native Gradle plugin
|
||||||
|
|
||||||
#### Overview
|
#### Overview
|
||||||
You may use the Gradle plugin to build Kotlin/Native projects. To use it you need to include the following snippet in
|
You may use the Gradle plugin to build _Kotlin/Native_ projects. To use it you need to include the following snippet in
|
||||||
a build script (see projects in `samples` directory):
|
a build script (see projects in `samples` directory):
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
|
|||||||
+7
-1
@@ -283,9 +283,15 @@ task bundle(type: Tar) {
|
|||||||
exclude 'dependencies'
|
exclude 'dependencies'
|
||||||
into baseName
|
into baseName
|
||||||
}
|
}
|
||||||
|
from(project.rootDir) {
|
||||||
|
include 'DISTRO_README.md'
|
||||||
|
rename {
|
||||||
|
return "README.md"
|
||||||
|
}
|
||||||
|
into baseName
|
||||||
|
}
|
||||||
from(project.rootDir) {
|
from(project.rootDir) {
|
||||||
include 'samples/**'
|
include 'samples/**'
|
||||||
include 'README.md'
|
|
||||||
include 'INTEROP.md'
|
include 'INTEROP.md'
|
||||||
include 'RELEASE_NOTES.md'
|
include 'RELEASE_NOTES.md'
|
||||||
include 'GRADLE_PLUGIN.md'
|
include 'GRADLE_PLUGIN.md'
|
||||||
|
|||||||
@@ -459,9 +459,6 @@ class Game(width: Int, height: Int, val visualizer: GameFieldVisualizer, val use
|
|||||||
private val LOCK_DELAY = 1
|
private val LOCK_DELAY = 1
|
||||||
|
|
||||||
private fun mainLoop() {
|
private fun mainLoop() {
|
||||||
var prevCmd: UserCommand? = null
|
|
||||||
var das = false
|
|
||||||
var dasTicks = 0
|
|
||||||
var attemptsToLock = 0
|
var attemptsToLock = 0
|
||||||
while (!gameOver) {
|
while (!gameOver) {
|
||||||
sleep(1000 / 60) // Refresh rate - 60 frames per second.
|
sleep(1000 / 60) // Refresh rate - 60 frames per second.
|
||||||
@@ -635,7 +632,7 @@ class SDL_Visualizer(val width: Int, val height: Int): GameFieldVisualizer, User
|
|||||||
fieldWidth = width * (CELL_SIZE + MARGIN) + MARGIN + BORDER_WIDTH * 2
|
fieldWidth = width * (CELL_SIZE + MARGIN) + MARGIN + BORDER_WIDTH * 2
|
||||||
fieldHeight = height * (CELL_SIZE + MARGIN) + MARGIN + BORDER_WIDTH * 2
|
fieldHeight = height * (CELL_SIZE + MARGIN) + MARGIN + BORDER_WIDTH * 2
|
||||||
var windowWidth = fieldWidth + INFO_SPACE_WIDTH
|
var windowWidth = fieldWidth + INFO_SPACE_WIDTH
|
||||||
var windowHeight = 0
|
var windowHeight: Int
|
||||||
if (platform == "iOS") {
|
if (platform == "iOS") {
|
||||||
val gamePadHeight = (displayHeight * windowWidth - fieldHeight * displayWidth) / displayWidth
|
val gamePadHeight = (displayHeight * windowWidth - fieldHeight * displayWidth) / displayWidth
|
||||||
windowHeight = fieldHeight + gamePadHeight
|
windowHeight = fieldHeight + gamePadHeight
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ apply plugin: 'konan'
|
|||||||
konanInterop {
|
konanInterop {
|
||||||
sdlMacbook {
|
sdlMacbook {
|
||||||
defFile 'sdl.def'
|
defFile 'sdl.def'
|
||||||
includeDirs '/Library/Frameworks/SDL2.framework/Headers', '/opt/local/include/SDL2', '/usr/local/include/SDL2', "${System.getProperty("user.home")}/Library/Frameworks/SDL2.framework/Headers"
|
includeDirs '/Library/Frameworks/SDL2.framework/Headers', "${System.getProperty("user.home")}/Library/Frameworks/SDL2.framework/Headers"
|
||||||
|
|
||||||
target 'macbook'
|
target 'macbook'
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ konanArtifacts {
|
|||||||
TetrisMacbook {
|
TetrisMacbook {
|
||||||
inputFiles project.file('Tetris.kt')
|
inputFiles project.file('Tetris.kt')
|
||||||
useInterop 'sdlMacbook'
|
useInterop 'sdlMacbook'
|
||||||
linkerOpts "-F ${System.getProperty("user.home")}/Library/Frameworks -F /Library/Frameworks -framework SDL2 -L/usr/local/lib -L/opt/local/lib -lSDL2"
|
linkerOpts "-F ${System.getProperty("user.home")}/Library/Frameworks -F /Library/Frameworks -framework SDL2"
|
||||||
// Use this line instead of the previous one if you've got a 'No SDL-framework' error.
|
// Use this line instead of the previous one if you've got a 'No SDL-framework' error.
|
||||||
//linkerOpts "-L/opt/local/lib -L/usr/local/lib -lSDL2"
|
//linkerOpts "-L/opt/local/lib -L/usr/local/lib -lSDL2"
|
||||||
target 'macbook'
|
target 'macbook'
|
||||||
|
|||||||
Reference in New Issue
Block a user