[samples] Switch to the new DSL in some samples
This commit is contained in:
committed by
Ilya Matveev
parent
b876fdb5bc
commit
e491ef45c4
@@ -1,15 +1,11 @@
|
||||
subprojects {
|
||||
buildscript {
|
||||
repositories {
|
||||
maven {
|
||||
url 'https://cache-redirector.jetbrains.com/maven-central'
|
||||
}
|
||||
maven {
|
||||
url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies"
|
||||
}
|
||||
maven {
|
||||
url "https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_13M1_Compiler),number:1.3-M1-eap-77,branch:default:any/artifacts/content/maven/"
|
||||
}
|
||||
maven { url 'https://cache-redirector.jetbrains.com/maven-central' }
|
||||
maven { url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" }
|
||||
maven {
|
||||
url "https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_13M1_Compiler),number:1.3-M1-eap-77,branch:default:any/artifacts/content/maven/"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -4,16 +4,11 @@
|
||||
A sample data [European Mammals Red List for 2009](https://data.europa.eu/euodp/en/data/dataset?res_format=CSV)
|
||||
from EU is being used.
|
||||
|
||||
To build use `../gradlew build` or `./build.sh`.
|
||||
To build use `../gradlew assemble` or `./build.sh`.
|
||||
|
||||
To run use `../gradlew run`
|
||||
Now you can run artifact directly
|
||||
|
||||
To change run arguments, change property runArgs in gradle.propeties file
|
||||
or pass `-PrunArgs="./European_Mammals_Red_List_Nov_2009.csv 4 100"` to gradle run.
|
||||
|
||||
Alternatively you can run artifact directly
|
||||
|
||||
./build/konan/bin/<target>/CsvParser.kexe ./European_Mammals_Red_List_Nov_2009.csv 4 100
|
||||
./build/exe/main/release/csvparser.kexe ./European_Mammals_Red_List_Nov_2009.csv 4 100
|
||||
|
||||
It will print number of all unique entries in fifth column
|
||||
(Family, zero-based index) in first 100 rows of the CSV file.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
apply plugin: 'konan'
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.native'
|
||||
|
||||
konanArtifacts {
|
||||
program('CsvParser')
|
||||
components.main {
|
||||
outputKinds = [ EXECUTABLE ]
|
||||
}
|
||||
@@ -4,15 +4,10 @@ This example shows how to communicate with libcurl, HTTP/HTTPS/FTP/etc client li
|
||||
depend on an artifact published in a maven repository. The sample depends on a library
|
||||
built by [libcurl sample](../libcurl) so you need to run it first.
|
||||
|
||||
To build use `../gradlew build`.
|
||||
To build use `../gradlew assemble`.
|
||||
|
||||
To run use `../gradlew run`.
|
||||
Now you can run the client directly
|
||||
|
||||
To change run arguments, change property runArgs in gradle.propeties file
|
||||
or pass `-PrunArgs="https://www.jetbrains.com"` to gradle run.
|
||||
|
||||
Alternatively you can run artifact directly
|
||||
|
||||
./build/konan/bin/<platform>/Curl.kexe https://www.jetbrains.com
|
||||
./build/exe/main/release/<platform>/curl.kexe https://www.jetbrains.com
|
||||
|
||||
It will perform HTTP get and print out the data obtained.
|
||||
|
||||
+10
-17
@@ -1,14 +1,8 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
maven {
|
||||
url 'https://cache-redirector.jetbrains.com/maven-central'
|
||||
}
|
||||
maven {
|
||||
url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies"
|
||||
}
|
||||
maven {
|
||||
url "https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_13M1_Compiler),number:1.3-M1-eap-77,branch:default:any/artifacts/content/maven/"
|
||||
}
|
||||
maven { url 'https://cache-redirector.jetbrains.com/maven-central' }
|
||||
maven { url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" }
|
||||
maven { url "https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_13M1_Compiler),number:1.3-M1-eap-77,branch:default:any/artifacts/content/maven/" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -16,9 +10,7 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'konan'
|
||||
|
||||
konan.targets = ['macbook', 'linux']
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.native'
|
||||
|
||||
def localMavenRepo="file://${new File(System.properties['user.home'] as String)}/.m2-kotlin-native"
|
||||
|
||||
@@ -28,10 +20,11 @@ repositories {
|
||||
}
|
||||
}
|
||||
|
||||
konanArtifacts {
|
||||
program('Curl') {
|
||||
dependencies {
|
||||
artifactCurl 'org.jetbrains.kotlin.native:libcurl:1.0'
|
||||
}
|
||||
components.main {
|
||||
targets = ['macos_x64', 'linux_x64']
|
||||
outputKinds = [ EXECUTABLE ]
|
||||
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin.native:libcurl:1.0'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
konan.home=../../dist
|
||||
konan.plugin.version=+
|
||||
runArgs=https://www.jetbrains.com
|
||||
konan.plugin.version=+
|
||||
@@ -1,3 +1,23 @@
|
||||
import org.konan.libcurl.*
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
org.konan.libcurl.main(args)
|
||||
}
|
||||
if (args.size == 0)
|
||||
return help()
|
||||
|
||||
val curl = CUrl(args[0])
|
||||
curl.header += {
|
||||
println("[H] $it")
|
||||
}
|
||||
|
||||
curl.body += {
|
||||
println("[B] $it")
|
||||
}
|
||||
|
||||
curl.fetch()
|
||||
curl.close()
|
||||
}
|
||||
|
||||
fun help() {
|
||||
println("ERROR: missing URL command line argument")
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
package org.konan.libcurl
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
if (args.size == 0)
|
||||
return help()
|
||||
|
||||
val curl = CUrl(args[0])
|
||||
curl.header += {
|
||||
println("[H] $it")
|
||||
}
|
||||
|
||||
curl.body += {
|
||||
println("[B] $it")
|
||||
}
|
||||
|
||||
curl.fetch()
|
||||
curl.close()
|
||||
}
|
||||
|
||||
fun help() {
|
||||
println("ERROR: missing URL command line argument")
|
||||
}
|
||||
|
||||
@@ -3,15 +3,10 @@
|
||||
This example shows how one could perform statistics on Git repository.
|
||||
libgit2 is required for this to work (`apt-get install libgit2-dev`).
|
||||
|
||||
To build use `../gradlew build` or `./build.sh`.
|
||||
To build use `../gradlew assemble` or `./build.sh`.
|
||||
|
||||
To run use `../gradlew run`.
|
||||
Now you can run the program directly
|
||||
|
||||
To change run arguments, change property runArgs in gradle.propeties file
|
||||
or pass `-PrunArgs="../../"` to gradle run.
|
||||
|
||||
Alternatively you can run artifact directly
|
||||
|
||||
./build/konan/bin/<target>/GitChurn.kexe ../../
|
||||
./build/exe/main/release/<platform>/gitchurn.kexe ../../
|
||||
|
||||
It will print most frequently modified (by number of commits) files in repository.
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
apply plugin: 'konan'
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.native'
|
||||
|
||||
konan.targets = ['macbook', 'linux']
|
||||
components.main {
|
||||
targets = ['macos_x64', 'linux_x64']
|
||||
outputKinds = [EXECUTABLE]
|
||||
|
||||
konanArtifacts {
|
||||
interop('libgit2') {
|
||||
target('linux') {
|
||||
includeDirs.headerFilterOnly '/usr/include'
|
||||
}
|
||||
dependencies {
|
||||
cinterop('libgit2') {
|
||||
target('linux') {
|
||||
includeDirs.headerFilterOnly '/usr/include'
|
||||
}
|
||||
|
||||
target('macbook') {
|
||||
includeDirs.headerFilterOnly '/opt/local/include', '/usr/local/include'
|
||||
}
|
||||
}
|
||||
|
||||
program('GitChurn') {
|
||||
libraries {
|
||||
artifact 'libgit2'
|
||||
target('macbook') {
|
||||
includeDirs.headerFilterOnly '/opt/local/include', '/usr/local/include'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
runArgs=../../
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
This example shows how one could implement global shared state using interop mechanisms.
|
||||
|
||||
To build use `../gradlew build`.
|
||||
To build use `../gradlew assemble`.
|
||||
|
||||
To run use `./build/konan/bin/<platform>/Globals.exe`.
|
||||
To run use `./build/exe/main/release/<platform>/globalState.kexe`.
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
apply plugin: 'konan'
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.native'
|
||||
|
||||
konan.targets = ['macbook', 'linux', 'mingw']
|
||||
components.main {
|
||||
targets = ['macos_x64', 'linux_x64', 'mingw_x64']
|
||||
outputKinds = [EXECUTABLE]
|
||||
|
||||
konanArtifacts {
|
||||
interop('global') {
|
||||
defFile 'src/main/c_interop/global.def'
|
||||
dependencies {
|
||||
cinterop('global')
|
||||
}
|
||||
|
||||
program('Globals') {
|
||||
libraries {
|
||||
artifact 'global'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,18 +3,14 @@
|
||||
This example shows how one may use _Kotlin/Native_ to build GUI
|
||||
applications with the GTK toolkit.
|
||||
|
||||
To build use `../gradlew build` or `./build.sh [-I=/include/path]`.
|
||||
To build use `../gradlew assemble` or `./build.sh [-I=/include/path]`.
|
||||
|
||||
Do not forget to install GTK3. See bellow.
|
||||
|
||||
On Mac use `port install gtk3`, on Debian flavours of Linux - `apt-get install libgtk-3-dev`.
|
||||
To run on Mac also install XQuartz X server (https://www.xquartz.org/), and then
|
||||
|
||||
../gradlew run
|
||||
|
||||
Alternatively you can run artifact directly
|
||||
|
||||
./build/konan/bin/<platform>/Gtk3Demo.kexe
|
||||
./build/exe/main/release/<platform>/gtk.kexe
|
||||
|
||||
Dialog box with the button will be shown, and application will print message
|
||||
and terminate on button click.
|
||||
|
||||
+10
-16
@@ -1,23 +1,17 @@
|
||||
apply plugin: 'konan'
|
||||
|
||||
konan {
|
||||
targets = ['macbook', 'linux']
|
||||
jvmArgs = ['-Xmx8g']
|
||||
}
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.native'
|
||||
|
||||
def includePrefixes = [ '/opt/local/include', '/usr/include', '/usr/local/include' ]
|
||||
|
||||
konanArtifacts {
|
||||
interop('gtk3') {
|
||||
includePrefixes.each {
|
||||
includeDirs "$it/atk-1.0", "$it/gdk-pixbuf-2.0", "$it/cairo", "$it/pango-1.0", "$it/gtk-3.0", "$it/glib-2.0"
|
||||
}
|
||||
includeDirs '/opt/local/lib/glib-2.0/include', '/usr/lib/x86_64-linux-gnu/glib-2.0/include', '/usr/local/lib/glib-2.0/include'
|
||||
}
|
||||
components.main {
|
||||
targets = ['macos_x64', 'linux_x64']
|
||||
outputKinds = [EXECUTABLE]
|
||||
|
||||
program('Gtk3Demo') {
|
||||
libraries {
|
||||
artifact 'gtk3'
|
||||
dependencies {
|
||||
cinterop('gtk3') {
|
||||
includePrefixes.each {
|
||||
includeDirs "$it/atk-1.0", "$it/gdk-pixbuf-2.0", "$it/cairo", "$it/pango-1.0", "$it/gtk-3.0", "$it/glib-2.0"
|
||||
}
|
||||
includeDirs '/opt/local/lib/glib-2.0/include', '/usr/lib/x86_64-linux-gnu/glib-2.0/include', '/usr/local/lib/glib-2.0/include'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
konan.jvmArgs=-Xmx8g
|
||||
@@ -4,7 +4,7 @@ This example shows how to build and publish an interop library to communicate wi
|
||||
HTTP/HTTPS/FTP/etc client library. Debian-like distros may need to
|
||||
`apt-get install libcurl4-openssl-dev`.
|
||||
|
||||
To build use `../gradlew build`
|
||||
To build use `../gradlew assemble`
|
||||
|
||||
To publish the library into a local repo use `../gradlew publish`
|
||||
|
||||
|
||||
@@ -1,29 +1,36 @@
|
||||
apply plugin: 'konan'
|
||||
|
||||
konan.targets = ['macbook', 'linux']
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.native'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
group 'org.jetbrains.kotlin.native'
|
||||
version '1.0'
|
||||
|
||||
konanArtifacts {
|
||||
interop('libcurl') {
|
||||
target('linux') {
|
||||
includeDirs.headerFilterOnly '/usr/include'
|
||||
}
|
||||
target('macbook') {
|
||||
includeDirs.headerFilterOnly '/opt/local/include', '/usr/local/include'
|
||||
}
|
||||
pom {
|
||||
withXml {
|
||||
def root = asNode()
|
||||
root.appendNode('name', 'libcurl interop library')
|
||||
root.appendNode('description', 'A library providing interoperability with host libcurl')
|
||||
// Native component
|
||||
components.main {
|
||||
targets = ['macos_x64', 'linux_x64']
|
||||
|
||||
dependencies {
|
||||
cinterop('libcurl-interop') {
|
||||
defFile 'src/main/c_interop/libcurl.def'
|
||||
|
||||
target('linux_x64') {
|
||||
includeDirs.headerFilterOnly '/usr/include'
|
||||
}
|
||||
target('macos_x64') {
|
||||
includeDirs.headerFilterOnly '/opt/local/include', '/usr/local/include'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pom {
|
||||
withXml {
|
||||
def root = asNode()
|
||||
root.appendNode('name', 'libcurl interop library')
|
||||
root.appendNode('description', 'A library providing interoperability with host libcurl')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'maven-publish'
|
||||
// Publishing
|
||||
def localMavenRepo="file://${new File(System.properties['user.home'] as String)}/.m2-kotlin-native"
|
||||
|
||||
task cleanLocalRepo(type: Delete) {
|
||||
@@ -31,20 +38,9 @@ task cleanLocalRepo(type: Delete) {
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications{
|
||||
libcurl(MavenPublication) {
|
||||
artifact sourceJar{
|
||||
classifier "source"
|
||||
}
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
url = localMavenRepo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task sourceJar(type: Jar) {
|
||||
from project.files('src/main')
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
runArgs=https://www.jetbrains.com
|
||||
@@ -7,18 +7,11 @@ are being suspended and resumed whenever relevant.
|
||||
Thus, while server can process multiple connections concurrently,
|
||||
each individual connection handler is written in simple linear manner.
|
||||
|
||||
To build use `../gradlew build` or `./build.sh`.
|
||||
To build use `../gradlew assemble` or `./build.sh`.
|
||||
|
||||
Run the server:
|
||||
Now you can run the server
|
||||
|
||||
../gradlew run
|
||||
|
||||
To change run arguments, change property runArgs in gradle.propeties file
|
||||
or pass `-PrunArgs="3000"` to gradle run.
|
||||
|
||||
Alternatively you can run artifact directly
|
||||
|
||||
./build/konan/bin/<platform>/EchoServer.kexe 3000 &
|
||||
./build/exe/main/release/<platform>/EchoServer.kexe 3000 &
|
||||
|
||||
Test the server by connecting to it, for example with telnet:
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
apply plugin: 'konan'
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.native'
|
||||
|
||||
konan.targets = ['macbook', 'linux']
|
||||
|
||||
konanArtifacts {
|
||||
program('EchoServer')
|
||||
}
|
||||
components.main {
|
||||
targets = ['macos_x64', 'linux_x64']
|
||||
outputKinds = [EXECUTABLE]
|
||||
baseName = 'EchoServer'
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
apply plugin: 'konan'
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.native'
|
||||
|
||||
konan.targets = ['macbook']
|
||||
|
||||
konanArtifacts {
|
||||
program('Window')
|
||||
components.main {
|
||||
targets = ['macos_x64']
|
||||
outputKinds = [EXECUTABLE]
|
||||
baseName = 'Window'
|
||||
}
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
# OpenGL application
|
||||
|
||||
This example shows interaction with OpenGL library, to render classical 3D test model. Linux build requires `apt-get install freeglut3-dev` or similar,
|
||||
This example shows interaction with OpenGL library, to render classical 3D test model. Linux build requires `apt-get install freeglut3-dev` or similar,
|
||||
MacOS shall work as is.
|
||||
|
||||
To build use `../gradlew build` or `./build.sh`.
|
||||
To build use `../gradlew assemble` or `./build.sh`.
|
||||
|
||||
To run use `../gradlew run`
|
||||
|
||||
Alternatively you can run artifact directly
|
||||
Now you can run the application
|
||||
|
||||
./build/konan/bin/<platform>/OpenGlTeapot.kexe
|
||||
./build/exe/main/release/OpenGlTeapot.kexe
|
||||
|
||||
It will render 3D model of teapot. Feel free to experiment with it, the whole power of OpenGL
|
||||
is at your hands.
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
apply plugin: 'konan'
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.native'
|
||||
|
||||
konan.targets = ["macbook"]
|
||||
|
||||
konanArtifacts {
|
||||
program('OpenGlTeapot')
|
||||
components.main {
|
||||
targets = ['macos_x64']
|
||||
outputKinds = [EXECUTABLE]
|
||||
baseName = 'OpenGlTeapot'
|
||||
}
|
||||
|
||||
|
||||
@@ -2,16 +2,9 @@
|
||||
|
||||
To build use `../gradlew build` or `./build.sh`.
|
||||
|
||||
Run the server:
|
||||
Now you can run the server
|
||||
|
||||
../gradlew run
|
||||
|
||||
To change run arguments, change property runArgs in gradle.propeties file
|
||||
or pass `-PrunArgs="3000"` to gradle run.
|
||||
|
||||
Alternatively you can run artifact directly
|
||||
|
||||
./build/konan/bin/<platform>/EchoServer.kexe 3000 &
|
||||
./build/exe/main/release/EchoServer.kexe 3000 &
|
||||
|
||||
Test the server by conecting to it, for example with telnet:
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
apply plugin: 'konan'
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.native'
|
||||
|
||||
konanArtifacts {
|
||||
program('EchoServer')
|
||||
components.main {
|
||||
outputKinds = [EXECUTABLE]
|
||||
baseName = 'EchoServer'
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
runArgs=3000
|
||||
@@ -13,28 +13,18 @@ use `apt-get install libsdl2-dev`.
|
||||
For Windows - `pacman -S mingw-w64-x86_64-SDL2` in MinGW64 console, if you do
|
||||
not have MSYS2-MinGW64 installed - install it first as described in http://www.msys2.org
|
||||
|
||||
To build Tetris application for your host platform (Mac or Linux) use `../gradlew build`.
|
||||
To build Tetris application for your host platform (Mac or Linux) use `../gradlew assemble`.
|
||||
|
||||
Aleternatively for Mac and Linux `./build.sh`.
|
||||
|
||||
For Windows use `build.bat`.
|
||||
|
||||
This task builds the sample for your host platform. Note that SDL2 must be installed on the host.
|
||||
Note that SDL2 must be installed on the host.
|
||||
|
||||
To run it on the host use `../gradlew run`
|
||||
|
||||
Alternatively you can run artifact directly
|
||||
|
||||
./build/konan/bin/Tetris${target}/Tetris${target}.kexe
|
||||
|
||||
For cross-compilation to iOS (on Mac host) use gradle property
|
||||
|
||||
konan.build.targets=iphone
|
||||
|
||||
For cross-compilation to Raspberry Pi (on Linux host) use
|
||||
|
||||
konan.build.targets=raspberrypi
|
||||
Now you can run the game
|
||||
|
||||
./build/exe/main/release/<platform>/tetris.[kexe|exe]
|
||||
|
||||
During build process compilation script creates interoperability bindings to SDL2, using SDL C headers,
|
||||
and then compiles an application with the produced bindings.
|
||||
|
||||
|
||||
+56
-54
@@ -1,59 +1,63 @@
|
||||
apply plugin: 'konan'
|
||||
|
||||
konan.targets = ['macbook', 'linux', 'raspberrypi', 'mingw']
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.native'
|
||||
|
||||
def konanUserDir = System.getenv("KONAN_DATA_DIR") ?: "${System.getProperty("user.home")}/.konan"
|
||||
def resFile = file("$buildDir/konan/res/Tetris.res")
|
||||
|
||||
konanArtifacts {
|
||||
components.main {
|
||||
targets = ['macos_x64', 'linux_x64', 'raspberrypi', 'mingw_x64']
|
||||
outputKinds = [EXECUTABLE]
|
||||
baseName = 'tetris'
|
||||
|
||||
interop ('sdl') {
|
||||
defFile 'src/main/c_interop/sdl.def'
|
||||
packageName 'sdl'
|
||||
|
||||
target 'macbook', {
|
||||
includeDirs '/Library/Frameworks/SDL2.framework/Headers',
|
||||
"${System.getProperty("user.home")}/Library/Frameworks/SDL2.framework/Headers",
|
||||
'/opt/local/include/SDL2',
|
||||
'/usr/local/include/SDL2'
|
||||
}
|
||||
|
||||
target 'linux', {
|
||||
includeDirs '/usr/include/SDL2'
|
||||
}
|
||||
|
||||
target 'raspberrypi', {
|
||||
includeDirs "$konanUserDir/dependencies/target-sysroot-1-raspberrypi/usr/include/SDL2"
|
||||
}
|
||||
|
||||
target 'mingw', {
|
||||
includeDirs "${System.getenv("MINGW64_DIR")?:"c:/msys64/mingw64"}/include/SDL2"
|
||||
}
|
||||
target 'macbook', {
|
||||
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.
|
||||
//linkerOpts "-L/opt/local/lib -L/usr/local/lib -lSDL2"
|
||||
}
|
||||
|
||||
program ('tetris') {
|
||||
libraries {
|
||||
artifact 'sdl'
|
||||
}
|
||||
target 'linux', {
|
||||
linkerOpts '-L/usr/lib64 -L/usr/lib/x86_64-linux-gnu -lSDL2'
|
||||
}
|
||||
|
||||
target 'macbook', {
|
||||
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.
|
||||
//linkerOpts "-L/opt/local/lib -L/usr/local/lib -lSDL2"
|
||||
}
|
||||
target 'raspberrypi', {
|
||||
linkerOpts '-lSDL2'
|
||||
}
|
||||
|
||||
target 'linux', {
|
||||
linkerOpts '-L/usr/lib64 -L/usr/lib/x86_64-linux-gnu -lSDL2'
|
||||
}
|
||||
target 'mingw', {
|
||||
linkerOpts "$resFile -L${System.getenv("MINGW64_DIR")?:"c:/msys64/mingw64"}/lib -Wl,-Bstatic -lstdc++ -static -lSDL2 -limm32 -lole32 -loleaut32 -lversion -lwinmm -mwindows"
|
||||
}
|
||||
|
||||
target 'raspberrypi', {
|
||||
linkerOpts '-lSDL2'
|
||||
}
|
||||
dependencies {
|
||||
cinterop('sdl') {
|
||||
packageName 'sdl'
|
||||
target 'macos_x64', {
|
||||
includeDirs '/Library/Frameworks/SDL2.framework/Headers',
|
||||
"${System.getProperty("user.home")}/Library/Frameworks/SDL2.framework/Headers",
|
||||
'/opt/local/include/SDL2',
|
||||
'/usr/local/include/SDL2'
|
||||
}
|
||||
|
||||
target 'mingw', {
|
||||
linkerOpts "$resFile -L${System.getenv("MINGW64_DIR")?:"c:/msys64/mingw64"}/lib -Wl,-Bstatic -lstdc++ -static -lSDL2 -limm32 -lole32 -loleaut32 -lversion -lwinmm -mwindows"
|
||||
dependsOn 'windowsResources'
|
||||
inputs.file resFile
|
||||
target 'linux_x64', {
|
||||
includeDirs '/usr/include/SDL2'
|
||||
}
|
||||
|
||||
target 'raspberrypi', {
|
||||
includeDirs "$konanUserDir/dependencies/target-sysroot-1-raspberrypi/usr/include/SDL2"
|
||||
}
|
||||
|
||||
target 'mingw_x64', {
|
||||
includeDirs "${System.getenv("MINGW64_DIR") ?: "c:/msys64/mingw64"}/include/SDL2"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assemble {
|
||||
doLast {
|
||||
components.withType(KotlinNativeExecutable.class).all { binary ->
|
||||
copy {
|
||||
from 'src/main/resources'
|
||||
into binary.runtimeFile.asFile.get().parentFile
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,13 +75,11 @@ task windowsResources (type: Exec) {
|
||||
outputs.file resFile
|
||||
}
|
||||
|
||||
compileKonan {
|
||||
doLast {
|
||||
konanArtifacts.tetris.forEach() { task ->
|
||||
copy {
|
||||
from 'src/main/resources'
|
||||
into task.artifact.parentFile
|
||||
}
|
||||
}
|
||||
}
|
||||
project.tasks.matching {
|
||||
name == 'compileDebugMingw_x64KotlinNative' ||
|
||||
name == 'compileReleaseMingw_x64KotlinNative'
|
||||
}.all {
|
||||
dependsOn 'windowsResources'
|
||||
inputs.file resFile
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ ffmpeg and SDL2 is needed for that to work, i.e.
|
||||
apt install libsdl2-dev
|
||||
pacman -S mingw-w64-x86_64-SDL2 mingw-w64-x86_64-ffmpeg
|
||||
|
||||
To build use `../gradlew build`.
|
||||
To build use `../gradlew assemble`.
|
||||
|
||||
To run use `./build/konan/bin/<platform>/Player.kexe file.mp4`.
|
||||
To run use `./build/exe/main/release/<platform>/Player.kexe file.mp4`.
|
||||
|
||||
|
||||
|
||||
@@ -1,60 +1,54 @@
|
||||
apply plugin: 'konan'
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.native'
|
||||
|
||||
konan.targets = ['macbook', 'linux', 'mingw']
|
||||
components.main {
|
||||
targets = ['macos_x64', 'linux_x64', 'mingw_x64']
|
||||
outputKinds = [EXECUTABLE]
|
||||
baseName = 'Player'
|
||||
|
||||
konanArtifacts {
|
||||
interop('ffmpeg') {
|
||||
defFile 'src/main/c_interop/ffmpeg.def'
|
||||
dependencies {
|
||||
cinterop('ffmpeg') {
|
||||
target 'macos_x64', {
|
||||
includeDirs.headerFilterOnly '/opt/local/include', '/usr/local/include'
|
||||
}
|
||||
|
||||
target 'linux', {
|
||||
includeDirs.headerFilterOnly '/usr/include', '/usr/include/x86_64-linux-gnu', '/usr/include/ffmpeg'
|
||||
target 'linux_x64', {
|
||||
includeDirs.headerFilterOnly '/usr/include', '/usr/include/x86_64-linux-gnu', '/usr/include/ffmpeg'
|
||||
}
|
||||
|
||||
target 'mingw_x64', {
|
||||
includeDirs 'C:/msys64/mingw64/include'
|
||||
}
|
||||
}
|
||||
|
||||
target 'macbook', {
|
||||
includeDirs.headerFilterOnly '/opt/local/include', '/usr/local/include'
|
||||
}
|
||||
cinterop ('sdl') {
|
||||
target 'macos_x64', {
|
||||
includeDirs '/Library/Frameworks/SDL2.framework/Headers',
|
||||
"${System.getProperty("user.home")}/Library/Frameworks/SDL2.framework/Headers",
|
||||
'/opt/local/include/SDL2',
|
||||
'/usr/local/include/SDL2'
|
||||
}
|
||||
|
||||
target 'mingw', {
|
||||
includeDirs 'C:/msys64/mingw64/include'
|
||||
target 'linux_x64', {
|
||||
includeDirs '/usr/include/SDL2'
|
||||
}
|
||||
|
||||
target 'mingw_x64', {
|
||||
includeDirs 'C:/msys64/mingw64/include/SDL2'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interop ('sdl') {
|
||||
defFile 'src/main/c_interop/sdl.def'
|
||||
|
||||
target 'macbook', {
|
||||
includeDirs '/Library/Frameworks/SDL2.framework/Headers',
|
||||
"${System.getProperty("user.home")}/Library/Frameworks/SDL2.framework/Headers",
|
||||
'/opt/local/include/SDL2',
|
||||
'/usr/local/include/SDL2'
|
||||
}
|
||||
|
||||
target 'linux', {
|
||||
includeDirs '/usr/include/SDL2'
|
||||
}
|
||||
|
||||
target 'mingw', {
|
||||
includeDirs 'C:/msys64/mingw64/include/SDL2'
|
||||
}
|
||||
target 'macos_x64', {
|
||||
linkerOpts "-F ${System.getProperty("user.home")}/Library/Frameworks", "-F /Library/Frameworks",
|
||||
"-L/opt/local/lib", "-L/usr/local/lib"
|
||||
}
|
||||
|
||||
program('Player') {
|
||||
libraries {
|
||||
artifact 'ffmpeg'
|
||||
artifact 'sdl'
|
||||
}
|
||||
target 'linux_x64', {
|
||||
linkerOpts '-L/usr/lib/x86_64-linux-gnu', '-L/usr/lib64'
|
||||
}
|
||||
|
||||
target 'macbook', {
|
||||
linkerOpts "-F ${System.getProperty("user.home")}/Library/Frameworks", "-F /Library/Frameworks",
|
||||
"-L/opt/local/lib", "-L/usr/local/lib"
|
||||
}
|
||||
|
||||
target 'linux', {
|
||||
linkerOpts '-L/usr/lib/x86_64-linux-gnu', '-L/usr/lib64'
|
||||
}
|
||||
|
||||
target 'mingw', {
|
||||
linkerOpts '-LC:/msys64/mingw64/lib'
|
||||
}
|
||||
target 'mingw_x64', {
|
||||
linkerOpts '-LC:/msys64/mingw64/lib'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# WIN32 Hello World
|
||||
|
||||
To build use `..\gradlew build` or `build.bat`.
|
||||
To build use `..\gradlew assemble` or `build.bat`.
|
||||
|
||||
To run use `..\gradlew run` or `MessageBox.exe`.
|
||||
To run use `.\build\exe\main\release\MessageBox.exe`.
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
apply plugin: 'konan'
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.native'
|
||||
|
||||
konan.targets = ['mingw']
|
||||
components.main {
|
||||
targets = ['mingw_x64']
|
||||
outputKinds = [EXECUTABLE]
|
||||
baseName = 'MessageBox'
|
||||
|
||||
konanArtifacts {
|
||||
program('MessageBox') {
|
||||
target('mingw_x64') {
|
||||
linkerOpts "-Wl,--subsystem,windows"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,6 @@ Then it continues execution, and waits on future objects encapsulating the
|
||||
computation results. Afterwards, worker execution termination is requested with the
|
||||
`requestTermination()` operation.
|
||||
|
||||
To build use `./build.sh`.
|
||||
To build use `./build.sh` or `./gradlew assemble`
|
||||
|
||||
To run use `./build/konan/bin/Worker.kexe`
|
||||
To run use `./build/exe/main/release/workers.kexe`
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
apply plugin: 'konan'
|
||||
apply plugin: 'org.jetbrains.kotlin.platform.native'
|
||||
|
||||
konanArtifacts {
|
||||
program('Workers')
|
||||
components.main {
|
||||
outputKinds = [ EXECUTABLE ]
|
||||
}
|
||||
Reference in New Issue
Block a user