Rewrite samples using new API (#3021)
This commit is contained in:
committed by
Ilya Matveev
parent
c1a4272e7a
commit
16a8fdcf4e
@@ -53,13 +53,13 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
[new Tuple(presets.androidNativeArm32, 'arm32'), new Tuple(presets.androidNativeArm64, 'arm64')].each {
|
||||||
fromPreset(presets.androidNativeArm32, 'arm32')
|
targetFromPreset(it[0], it[1]) {
|
||||||
fromPreset(presets.androidNativeArm64, 'arm64')
|
binaries {
|
||||||
|
executable() {
|
||||||
configure([arm32, arm64]) {
|
entryPoint = 'sample.androidnative.main'
|
||||||
compilations.main.outputKinds 'EXECUTABLE'
|
}
|
||||||
compilations.main.entryPoint 'sample.androidnative.main'
|
}
|
||||||
compilations.main.cinterops {
|
compilations.main.cinterops {
|
||||||
bmpformat
|
bmpformat
|
||||||
}
|
}
|
||||||
@@ -77,24 +77,22 @@ tasks.compileKotlinMetadata.enabled = false
|
|||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
kotlin.targets { targets ->
|
kotlin.targets { targets ->
|
||||||
[arm32, arm64].collect { target ->
|
[arm32, arm64].collect { target ->
|
||||||
target.compilations.main { mainCompilation ->
|
String buildType = 'RELEASE' // Change to 'DEBUG' to include debug symbols.
|
||||||
String buildType = 'RELEASE' // Change to 'DEBUG' to include debug symbols.
|
Object linkTask = binaries.getExecutable(buildType).linkTask
|
||||||
Object linkTask = mainCompilation.getLinkTask('EXECUTABLE', buildType)
|
|
||||||
|
|
||||||
// Rename binary files to 'libpoly.so' and put them to the appropriate location.
|
// Rename binary files to 'libpoly.so' and put them to the appropriate location.
|
||||||
File binaryFile = linkTask.outputFile.get()
|
File binaryFile = binaries.getExecutable(buildType).outputFile
|
||||||
linkTask.doLast {
|
linkTask.doLast {
|
||||||
copy {
|
copy {
|
||||||
from binaryFile
|
from binaryFile
|
||||||
into libsDirMapping[target.targetName]
|
into libsDirMapping[target.targetName]
|
||||||
rename {
|
rename {
|
||||||
'libpoly.so'
|
'libpoly.so'
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.preBuild.dependsOn linkTask
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.preBuild.dependsOn linkTask
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
import groovy.lang.Closure
|
import groovy.lang.Closure
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.Task
|
import org.gradle.api.Task
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinTargetPreset
|
import org.jetbrains.kotlin.gradle.plugin.KotlinTargetPreset
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetPreset
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetPreset
|
||||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||||
@@ -65,16 +65,3 @@ fun defaultHostPreset(
|
|||||||
else
|
else
|
||||||
throw Exception("Host OS '$hostOs' is not supported in Kotlin/Native ${subproject.displayName}.")
|
throw Exception("Host OS '$hostOs' is not supported in Kotlin/Native ${subproject.displayName}.")
|
||||||
}
|
}
|
||||||
|
|
||||||
// A short-cut to add a Kotlin/Native run task.
|
|
||||||
@JvmOverloads
|
|
||||||
fun createRunTask(
|
|
||||||
subproject: Project,
|
|
||||||
name: String,
|
|
||||||
target: KotlinTarget,
|
|
||||||
configureClosure: Closure<Any>? = null
|
|
||||||
): Task {
|
|
||||||
val task = subproject.tasks.create(name, RunKotlinNativeTask::class.java, target)
|
|
||||||
task.configure(configureClosure ?: task.emptyConfigureClosure())
|
|
||||||
return task
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
|
||||||
* that can be found in the license/LICENSE.txt file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import groovy.lang.Closure
|
|
||||||
import org.gradle.api.DefaultTask
|
|
||||||
import org.gradle.api.Task
|
|
||||||
import org.gradle.api.tasks.TaskAction
|
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
open class RunKotlinNativeTask @Inject constructor(
|
|
||||||
private val myTarget: KotlinTarget
|
|
||||||
): DefaultTask() {
|
|
||||||
|
|
||||||
var buildType = "RELEASE"
|
|
||||||
var workingDir: Any = project.projectDir
|
|
||||||
private var myArgs: List<String> = emptyList()
|
|
||||||
private val myEnvironment: MutableMap<String, Any> = mutableMapOf()
|
|
||||||
|
|
||||||
fun args(vararg args: Any) {
|
|
||||||
myArgs = args.map { it.toString() }
|
|
||||||
}
|
|
||||||
|
|
||||||
fun environment(map: Map<String, Any>) {
|
|
||||||
myEnvironment += map
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun configure(configureClosure: Closure<Any>): Task {
|
|
||||||
val task = super.configure(configureClosure)
|
|
||||||
this.dependsOn += myTarget.compilations.main.linkTaskName("EXECUTABLE", buildType)
|
|
||||||
return task
|
|
||||||
}
|
|
||||||
|
|
||||||
@TaskAction
|
|
||||||
fun run() {
|
|
||||||
project.exec {
|
|
||||||
it.executable = myTarget.compilations.main.getBinary("EXECUTABLE", buildType).toString()
|
|
||||||
it.args = myArgs
|
|
||||||
it.environment = myEnvironment
|
|
||||||
it.workingDir(workingDir)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun emptyConfigureClosure() = object : Closure<Any>(this) {
|
|
||||||
override fun call(): RunKotlinNativeTask {
|
|
||||||
return this@RunKotlinNativeTask
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -20,7 +20,5 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
android()
|
||||||
fromPreset(presets.android, 'android')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ apply plugin: 'org.jetbrains.kotlin.multiplatform'
|
|||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
targets {
|
||||||
fromPreset(presets.jvm, 'jvm')
|
jvm()
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from EU is being used.
|
|||||||
|
|
||||||
To build use `../gradlew assemble`.
|
To build use `../gradlew assemble`.
|
||||||
|
|
||||||
To run use `../gradlew runProgram` or execute the program directly:
|
To run use `../gradlew runReleaseExecutableCsvParser` or execute the program directly:
|
||||||
|
|
||||||
./build/bin/csvParser/main/release/executable/csvparser.kexe ./European_Mammals_Red_List_Nov_2009.csv 4 100
|
./build/bin/csvParser/main/release/executable/csvparser.kexe ./European_Mammals_Red_List_Nov_2009.csv 4 100
|
||||||
|
|
||||||
|
|||||||
@@ -6,14 +6,12 @@ plugins {
|
|||||||
def hostPreset = MPPTools.defaultHostPreset(project)
|
def hostPreset = MPPTools.defaultHostPreset(project)
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
targetFromPreset(hostPreset, 'csvParser') {
|
||||||
fromPreset(hostPreset, 'csvParser') {
|
binaries {
|
||||||
compilations.main.outputKinds 'EXECUTABLE'
|
executable() {
|
||||||
compilations.main.entryPoint 'sample.csvparser.main'
|
entryPoint = 'sample.csvparser.main'
|
||||||
|
runTask.args './European_Mammals_Red_List_Nov_2009.csv', 4, 100
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MPPTools.createRunTask(project, 'runProgram', kotlin.targets.csvParser) {
|
|
||||||
args './European_Mammals_Red_List_Nov_2009.csv', 4, 100
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,7 @@ built by [libcurl sample](../libcurl) so you need to run it first.
|
|||||||
|
|
||||||
To build use `../gradlew assemble`.
|
To build use `../gradlew assemble`.
|
||||||
|
|
||||||
To run use `../gradlew runProgram` or execute the program directly:
|
To run use `../gradlew runReleaseExecutableCurl` or execute the program directly:
|
||||||
|
|
||||||
./build/bin/curl/main/release/executable/curl.kexe 'https://www.jetbrains.com/'
|
./build/bin/curl/main/release/executable/curl.kexe 'https://www.jetbrains.com/'
|
||||||
|
|
||||||
|
|||||||
+10
-15
@@ -12,14 +12,16 @@ repositories {
|
|||||||
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64, kotlin.presets.mingwX64])
|
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64, kotlin.presets.mingwX64])
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
targetFromPreset(hostPreset, 'curl') {
|
||||||
fromPreset(hostPreset, 'curl') {
|
binaries {
|
||||||
compilations.main.outputKinds 'EXECUTABLE'
|
executable() {
|
||||||
compilations.main.entryPoint 'sample.curl.main'
|
entryPoint = 'sample.curl.main'
|
||||||
|
if (presets.mingwX64 == hostPreset) {
|
||||||
if (presets.mingwX64 == hostPreset) {
|
// Add lib path to `libcurl` and its dependencies:
|
||||||
// Add lib path to `libcurl` and its dependencies:
|
linkerOpts += ["-L${MPPTools.mingwPath()}/lib".toString()]
|
||||||
compilations.main.linkerOpts "-L${MPPTools.mingwPath()}/lib"
|
runTask.environment('PATH': "${MPPTools.mingwPath()}/bin".toString())
|
||||||
|
}
|
||||||
|
runTask.args('https://www.jetbrains.com/')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,13 +35,6 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MPPTools.createRunTask(project, 'runProgram', kotlin.targets.curl) {
|
|
||||||
if (kotlin.presets.mingwX64 == hostPreset) {
|
|
||||||
environment 'PATH': "${MPPTools.mingwPath()}/bin"
|
|
||||||
}
|
|
||||||
args 'https://www.jetbrains.com/'
|
|
||||||
}
|
|
||||||
|
|
||||||
// The code snippet below is needed to make all compile tasks depend on publication of
|
// The code snippet below is needed to make all compile tasks depend on publication of
|
||||||
// "libcurl" library. So that to the time of compilation the library will already be
|
// "libcurl" library. So that to the time of compilation the library will already be
|
||||||
// in Maven repo and will be successfully resolved as a dependency of this project.
|
// in Maven repo and will be successfully resolved as a dependency of this project.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
To build use `../gradlew assemble`.
|
To build use `../gradlew assemble`.
|
||||||
|
|
||||||
To run use `../gradlew runProgram` or execute the program directly:
|
To run use `../gradlew runReleaseExecutableEchoServer` or execute the program directly:
|
||||||
|
|
||||||
./build/bin/echoServer/main/release/executable/echoServer.kexe 3000 &
|
./build/bin/echoServer/main/release/executable/echoServer.kexe 3000 &
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,12 @@ def hostPreset = MPPTools.defaultHostPreset(project)
|
|||||||
def raspberryPiPresets = [kotlin.presets.linuxArm32Hfp, kotlin.presets.linuxArm64]
|
def raspberryPiPresets = [kotlin.presets.linuxArm32Hfp, kotlin.presets.linuxArm64]
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
targetFromPreset(hostPreset, 'echoServer') {
|
||||||
fromPreset(hostPreset, 'echoServer') {
|
binaries {
|
||||||
compilations.main.outputKinds 'EXECUTABLE'
|
executable() {
|
||||||
compilations.main.entryPoint 'sample.echoserver.main'
|
entryPoint = 'sample.echoserver.main'
|
||||||
|
runTask.args(3000)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
raspberryPiPresets.each { preset ->
|
raspberryPiPresets.each { preset ->
|
||||||
@@ -31,7 +33,3 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MPPTools.createRunTask(project, 'runProgram', kotlin.targets.echoServer) {
|
|
||||||
args 3000
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ not have MSYS2-MinGW64 installed - install it first as described in http://www.m
|
|||||||
|
|
||||||
To build use `../gradlew assemble`.
|
To build use `../gradlew assemble`.
|
||||||
|
|
||||||
To run use `../gradlew runProgram` or execute the program directly:
|
To run use `../gradlew runReleaseExecutableGitChurn` or execute the program directly:
|
||||||
|
|
||||||
./build/bin/gitChurn/main/release/executable/gitchurn.kexe ../../
|
./build/bin/gitChurn/main/release/executable/gitchurn.kexe ../../
|
||||||
|
|
||||||
|
|||||||
@@ -6,35 +6,31 @@ plugins {
|
|||||||
def hostPreset = MPPTools.defaultHostPreset(project)
|
def hostPreset = MPPTools.defaultHostPreset(project)
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
targetFromPreset(hostPreset, 'gitChurn') {
|
||||||
fromPreset(hostPreset, 'gitChurn') {
|
binaries {
|
||||||
compilations.main.outputKinds 'EXECUTABLE'
|
executable() {
|
||||||
compilations.main.entryPoint 'sample.gitchurn.main'
|
entryPoint = 'sample.gitchurn.main'
|
||||||
compilations.main.cinterops {
|
if (presets.mingwX64 == hostPreset) {
|
||||||
libgit2 {
|
linkerOpts = ["-L${MPPTools.mingwPath()}/lib".toString()]
|
||||||
switch (hostPreset) {
|
runTask.environment('PATH', "${MPPTools.mingwPath()}/bin".toString())
|
||||||
case presets.macosX64:
|
|
||||||
includeDirs.headerFilterOnly '/opt/local/include', '/usr/local/include'
|
|
||||||
break
|
|
||||||
case presets.linuxX64:
|
|
||||||
includeDirs.headerFilterOnly '/usr/include'
|
|
||||||
break
|
|
||||||
case presets.mingwX64:
|
|
||||||
includeDirs.headerFilterOnly "${MPPTools.mingwPath()}/include"
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
runTask.args(project.getRootProject().getRootDir().toString() + '/..')
|
||||||
}
|
}
|
||||||
if (presets.mingwX64 == hostPreset) {
|
}
|
||||||
compilations.main.linkerOpts "-L${MPPTools.mingwPath()}/lib"
|
compilations.main.cinterops {
|
||||||
|
libgit2 {
|
||||||
|
switch (hostPreset) {
|
||||||
|
case presets.macosX64:
|
||||||
|
includeDirs.headerFilterOnly '/opt/local/include', '/usr/local/include'
|
||||||
|
break
|
||||||
|
case presets.linuxX64:
|
||||||
|
includeDirs.headerFilterOnly '/usr/include'
|
||||||
|
break
|
||||||
|
case presets.mingwX64:
|
||||||
|
includeDirs.headerFilterOnly "${MPPTools.mingwPath()}/include"
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MPPTools.createRunTask(project, 'runProgram', kotlin.targets.gitChurn) {
|
|
||||||
if (kotlin.presets.mingwX64 == hostPreset) {
|
|
||||||
environment 'PATH': "${MPPTools.mingwPath()}/bin"
|
|
||||||
}
|
|
||||||
args project.getRootProject().getRootDir().toString() + '/..'
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ This example shows how one could implement global shared state using interop mec
|
|||||||
|
|
||||||
To build use `../gradlew assemble`.
|
To build use `../gradlew assemble`.
|
||||||
|
|
||||||
To run use `../gradlew runProgram` or execute the program directly:
|
To run use `../gradlew runReleaseExecutableGlobalState` or execute the program directly:
|
||||||
|
|
||||||
./build/bin/globalState/main/release/executable/globalState.kexe
|
./build/bin/globalState/main/release/executable/globalState.kexe
|
||||||
|
|||||||
@@ -6,15 +6,14 @@ plugins {
|
|||||||
def hostPreset = MPPTools.defaultHostPreset(project)
|
def hostPreset = MPPTools.defaultHostPreset(project)
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
targetFromPreset(hostPreset, 'globalState') {
|
||||||
fromPreset(hostPreset, 'globalState') {
|
binaries {
|
||||||
compilations.main.outputKinds 'EXECUTABLE'
|
executable() {
|
||||||
compilations.main.entryPoint 'sample.globalstate.main'
|
entryPoint = 'sample.globalstate.main'
|
||||||
compilations.main.cinterops {
|
|
||||||
global
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
compilations.main.cinterops {
|
||||||
|
global
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MPPTools.createRunTask(project, 'runProgram', kotlin.targets.globalState)
|
|
||||||
@@ -5,7 +5,7 @@ org.gradle.parallel=true
|
|||||||
|
|
||||||
# Pin Kotlin version:
|
# Pin Kotlin version:
|
||||||
# CHANGE_VERSION_WITH_RELEASE
|
# CHANGE_VERSION_WITH_RELEASE
|
||||||
kotlin_version=1.3.40-dev-2451
|
kotlin_version=1.3.40-eap-40
|
||||||
|
|
||||||
# Use custom Kotlin/Native home:
|
# Use custom Kotlin/Native home:
|
||||||
org.jetbrains.kotlin.native.home=../../dist
|
org.jetbrains.kotlin.native.home=../../dist
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ To build use `../gradlew assemble`.
|
|||||||
|
|
||||||
Do not forget to install GTK3. See bellow.
|
Do not forget to install GTK3. See bellow.
|
||||||
|
|
||||||
To run on Mac also install XQuartz X server (https://www.xquartz.org/), and then `../gradlew runProgram` or execute the program directly:
|
To run on Mac also install XQuartz X server (https://www.xquartz.org/), and then `../gradlew runReleaseExecutableGtk` or execute the program directly:
|
||||||
|
|
||||||
./build/bin/gtk/main/release/executable/gtk.kexe
|
./build/bin/gtk/main/release/executable/gtk.kexe
|
||||||
|
|
||||||
|
|||||||
+39
-43
@@ -6,51 +6,47 @@ plugins {
|
|||||||
def hostPreset = MPPTools.defaultHostPreset(project)
|
def hostPreset = MPPTools.defaultHostPreset(project)
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
targetFromPreset(hostPreset, 'gtk') {
|
||||||
fromPreset(hostPreset, 'gtk') {
|
binaries {
|
||||||
compilations.main.outputKinds 'EXECUTABLE'
|
executable() {
|
||||||
compilations.main.entryPoint 'sample.gtk.main'
|
entryPoint = 'sample.gtk.main'
|
||||||
compilations.main.cinterops {
|
if (presets.mingwX64 == hostPreset) {
|
||||||
gtk3 {
|
linkerOpts += ["-L${MPPTools.mingwPath()}/lib".toString()]
|
||||||
switch (hostPreset) {
|
runTask.environment('PATH', "${MPPTools.mingwPath()}/bin".toString())
|
||||||
case presets.macosX64:
|
|
||||||
case presets.linuxX64:
|
|
||||||
['/opt/local/include',
|
|
||||||
'/usr/include',
|
|
||||||
'/usr/local/include'
|
|
||||||
].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'
|
|
||||||
break
|
|
||||||
case presets.mingwX64:
|
|
||||||
includeDirs "${MPPTools.mingwPath()}/include/atk-1.0",
|
|
||||||
"${MPPTools.mingwPath()}/include/gdk-pixbuf-2.0",
|
|
||||||
"${MPPTools.mingwPath()}/include/cairo",
|
|
||||||
"${MPPTools.mingwPath()}/include/pango-1.0",
|
|
||||||
"${MPPTools.mingwPath()}/include/gtk-3.0",
|
|
||||||
"${MPPTools.mingwPath()}/include/glib-2.0",
|
|
||||||
"${MPPTools.mingwPath()}/lib/glib-2.0/include"
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (presets.mingwX64 == hostPreset) {
|
}
|
||||||
compilations.main.linkerOpts "-L${MPPTools.mingwPath()}/lib"
|
compilations.main.cinterops {
|
||||||
|
gtk3 {
|
||||||
|
switch (hostPreset) {
|
||||||
|
case presets.macosX64:
|
||||||
|
case presets.linuxX64:
|
||||||
|
['/opt/local/include',
|
||||||
|
'/usr/include',
|
||||||
|
'/usr/local/include'
|
||||||
|
].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'
|
||||||
|
break
|
||||||
|
case presets.mingwX64:
|
||||||
|
includeDirs "${MPPTools.mingwPath()}/include/atk-1.0",
|
||||||
|
"${MPPTools.mingwPath()}/include/gdk-pixbuf-2.0",
|
||||||
|
"${MPPTools.mingwPath()}/include/cairo",
|
||||||
|
"${MPPTools.mingwPath()}/include/pango-1.0",
|
||||||
|
"${MPPTools.mingwPath()}/include/gtk-3.0",
|
||||||
|
"${MPPTools.mingwPath()}/include/glib-2.0",
|
||||||
|
"${MPPTools.mingwPath()}/lib/glib-2.0/include"
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MPPTools.createRunTask(project, 'runProgram', kotlin.targets.gtk) {
|
|
||||||
if (kotlin.presets.mingwX64 == hostPreset) {
|
|
||||||
environment 'PATH': "${MPPTools.mingwPath()}/bin"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -16,13 +16,14 @@ String packageName = 'kotlinx.interop.wasm.dom'
|
|||||||
String jsinteropKlibFileName = Paths.get(buildDir.toString(), 'klib', "$packageName-jsinterop.klib").toString()
|
String jsinteropKlibFileName = Paths.get(buildDir.toString(), 'klib', "$packageName-jsinterop.klib").toString()
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
targetFromPreset(presets.wasm32, 'html5Canvas') {
|
||||||
fromPreset(presets.wasm32, 'html5Canvas') {
|
binaries {
|
||||||
compilations.main.outputKinds 'EXECUTABLE'
|
executable() {
|
||||||
compilations.main.entryPoint 'sample.html5canvas.main'
|
entryPoint = 'sample.html5canvas.main'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fromPreset(presets.jvm, 'httpServer')
|
|
||||||
}
|
}
|
||||||
|
jvm('httpServer')
|
||||||
sourceSets {
|
sourceSets {
|
||||||
html5CanvasMain {
|
html5CanvasMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ each individual connection handler is written in simple linear manner.
|
|||||||
|
|
||||||
To build use `../gradlew assemble`.
|
To build use `../gradlew assemble`.
|
||||||
|
|
||||||
To run use `../gradlew runProgram` or execute the program directly:
|
To run use `../gradlew runReleaseExecutableNonBlockingEchoServer` or execute the program directly:
|
||||||
|
|
||||||
./build/bin/nonBlockingEchoServer/main/release/executable/nonBlockingEchoServer.kexe 3000 &
|
./build/bin/nonBlockingEchoServer/main/release/executable/nonBlockingEchoServer.kexe 3000 &
|
||||||
|
|
||||||
|
|||||||
@@ -6,14 +6,12 @@ plugins {
|
|||||||
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64])
|
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64])
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
targetFromPreset(hostPreset, 'nonBlockingEchoServer') {
|
||||||
fromPreset(hostPreset, 'nonBlockingEchoServer') {
|
binaries {
|
||||||
compilations.main.outputKinds 'EXECUTABLE'
|
executable() {
|
||||||
compilations.main.entryPoint 'sample.nbechoserver.main'
|
entryPoint = 'sample.nbechoserver.main'
|
||||||
|
runTask.args(3000)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MPPTools.createRunTask(project, 'runProgram', kotlin.targets.nonBlockingEchoServer) {
|
|
||||||
args 3000
|
|
||||||
}
|
|
||||||
@@ -6,12 +6,11 @@ plugins {
|
|||||||
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64])
|
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64])
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
targetFromPreset(hostPreset, 'objc') {
|
||||||
fromPreset(hostPreset, 'objc') {
|
binaries {
|
||||||
compilations.main.outputKinds 'EXECUTABLE'
|
executable() {
|
||||||
compilations.main.entryPoint 'sample.objc.main'
|
entryPoint = 'sample.objc.main'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MPPTools.createRunTask(project, 'runProgram', kotlin.targets.objc)
|
|
||||||
@@ -5,7 +5,7 @@ MacOS shall work as is.
|
|||||||
|
|
||||||
To build use `../gradlew assemble`.
|
To build use `../gradlew assemble`.
|
||||||
|
|
||||||
To run use `../gradlew runProgram` or execute the program directly:
|
To run use `../gradlew runReleaseExecutableOpengl` or execute the program directly:
|
||||||
|
|
||||||
./build/bin/opengl/main/release/executable/opengl.kexe
|
./build/bin/opengl/main/release/executable/opengl.kexe
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,11 @@ plugins {
|
|||||||
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64])
|
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64])
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
targetFromPreset(hostPreset, 'opengl') {
|
||||||
fromPreset(hostPreset, 'opengl') {
|
binaries {
|
||||||
compilations.main.outputKinds 'EXECUTABLE'
|
executable() {
|
||||||
compilations.main.entryPoint 'sample.opengl.main'
|
entryPoint = 'sample.opengl.main'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MPPTools.createRunTask(project, 'runProgram', kotlin.targets.opengl)
|
|
||||||
@@ -6,18 +6,15 @@ plugins {
|
|||||||
def hostPreset = MPPTools.defaultHostPreset(project)
|
def hostPreset = MPPTools.defaultHostPreset(project)
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
targetFromPreset(hostPreset, 'symbolication') {
|
||||||
fromPreset(hostPreset, 'symbolication') {
|
binaries {
|
||||||
compilations.main.outputKinds 'EXECUTABLE'
|
executable() {
|
||||||
compilations.main.entryPoint 'symbolication.main'
|
entryPoint = 'symbolication.main'
|
||||||
compilations.main.cinterops {
|
}
|
||||||
coreSymbolication {
|
}
|
||||||
}
|
compilations.main.cinterops {
|
||||||
|
coreSymbolication {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MPPTools.createRunTask(project, 'runProgram', kotlin.targets.symbolication) {
|
|
||||||
//args "./test.kexe.dSYM/Contents/Resources/DWARF/test.kexe"
|
|
||||||
}
|
|
||||||
@@ -20,7 +20,7 @@ To build use `../gradlew assemble`.
|
|||||||
|
|
||||||
Then run
|
Then run
|
||||||
|
|
||||||
../gradlew runProgram
|
../gradlew runReleaseExecutableTensorflow
|
||||||
|
|
||||||
Alternatively you can run the artifact directly through
|
Alternatively you can run the artifact directly through
|
||||||
|
|
||||||
|
|||||||
@@ -8,15 +8,18 @@ def tensorflowHome = "${MPPTools.kotlinNativeDataPath()}/third-party/tensorflow"
|
|||||||
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64])
|
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64])
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
targetFromPreset(hostPreset, 'tensorflow') {
|
||||||
fromPreset(hostPreset, 'tensorflow') {
|
binaries {
|
||||||
compilations.main.outputKinds 'EXECUTABLE'
|
executable() {
|
||||||
compilations.main.entryPoint 'sample.tensorflow.main'
|
entryPoint = 'sample.tensorflow.main'
|
||||||
compilations.main.linkerOpts "-L$tensorflowHome/lib", '-ltensorflow'
|
linkerOpts += ["-L$tensorflowHome/lib".toString(), '-ltensorflow']
|
||||||
compilations.main.cinterops {
|
runTask.environment('LD_LIBRARY_PATH', "$tensorflowHome/lib".toString())
|
||||||
tensorflow {
|
runTask.environment('DYLD_LIBRARY_PATH', "$tensorflowHome/lib".toString())
|
||||||
includeDirs "$tensorflowHome/include"
|
}
|
||||||
}
|
}
|
||||||
|
compilations.main.cinterops {
|
||||||
|
tensorflow {
|
||||||
|
includeDirs "$tensorflowHome/include"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,10 +29,4 @@ task downloadTensorflow(type: Exec) {
|
|||||||
workingDir projectDir
|
workingDir projectDir
|
||||||
commandLine './downloadTensorflow.sh'
|
commandLine './downloadTensorflow.sh'
|
||||||
}
|
}
|
||||||
tasks[kotlin.targets.tensorflow.compilations.main.cinterops.tensorflow.interopProcessingTaskName].dependsOn downloadTensorflow
|
tasks[kotlin.targets.tensorflow.compilations.main.cinterops.tensorflow.interopProcessingTaskName].dependsOn downloadTensorflow
|
||||||
|
|
||||||
|
|
||||||
MPPTools.createRunTask(project, 'runProgram', kotlin.targets.tensorflow) {
|
|
||||||
environment 'LD_LIBRARY_PATH': "$tensorflowHome/lib"
|
|
||||||
environment 'DYLD_LIBRARY_PATH': "$tensorflowHome/lib"
|
|
||||||
}
|
|
||||||
@@ -15,7 +15,7 @@ To build Tetris application for your host platform use `../gradlew assemble`.
|
|||||||
|
|
||||||
Note that SDL2 must be installed on the host.
|
Note that SDL2 must be installed on the host.
|
||||||
|
|
||||||
Now you can run the game using `../gradlew runProgram` or directly with
|
Now you can run the game using `../gradlew runReleaseExecutableTetris` or directly with
|
||||||
|
|
||||||
./build/bin/tetris/main/release/executable/tetris.kexe
|
./build/bin/tetris/main/release/executable/tetris.kexe
|
||||||
|
|
||||||
|
|||||||
+53
-56
@@ -6,56 +6,59 @@ File winCompiledResourceFile = file("$buildDir/compiledWindowsResources/Tetris.r
|
|||||||
def hostPreset = determinePreset()
|
def hostPreset = determinePreset()
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
targetFromPreset(hostPreset, 'tetris') {
|
||||||
fromPreset(hostPreset, 'tetris') {
|
binaries {
|
||||||
compilations.main.outputKinds 'EXECUTABLE'
|
executable() {
|
||||||
compilations.main.entryPoint 'sample.tetris.main'
|
entryPoint = 'sample.tetris.main'
|
||||||
|
switch (hostPreset) {
|
||||||
switch (hostPreset) {
|
case presets.macosX64:
|
||||||
case presets.macosX64:
|
linkerOpts += ['-L/opt/local/lib', '-L/usr/local/lib', '-lSDL2']
|
||||||
compilations.main.linkerOpts '-L/opt/local/lib', '-L/usr/local/lib', '-lSDL2'
|
break
|
||||||
break
|
case presets.linuxX64:
|
||||||
case presets.linuxX64:
|
linkerOpts += ['-L/usr/lib64', '-L/usr/lib/x86_64-linux-gnu', '-lSDL2']
|
||||||
compilations.main.linkerOpts '-L/usr/lib64', '-L/usr/lib/x86_64-linux-gnu', '-lSDL2'
|
break
|
||||||
break
|
case presets.mingwX86:
|
||||||
case presets.mingwX86:
|
case presets.mingwX64:
|
||||||
case presets.mingwX64:
|
linkerOpts += [winCompiledResourceFile.path,
|
||||||
compilations.main.linkerOpts winCompiledResourceFile.path,
|
"-L${MPPTools.mingwPath(hostPreset)}/lib".toString(),
|
||||||
"-L${MPPTools.mingwPath(hostPreset)}/lib",
|
'-Wl,-Bstatic',
|
||||||
'-Wl,-Bstatic',
|
'-lstdc++',
|
||||||
'-lstdc++',
|
'-static',
|
||||||
'-static',
|
'-lSDL2',
|
||||||
'-lSDL2',
|
'-limm32',
|
||||||
'-limm32',
|
'-lole32',
|
||||||
'-lole32',
|
'-loleaut32',
|
||||||
'-loleaut32',
|
'-lversion',
|
||||||
'-lversion',
|
'-lwinmm',
|
||||||
'-lwinmm',
|
'-lsetupapi',
|
||||||
'-lsetupapi',
|
'-mwindows']
|
||||||
'-mwindows'
|
break
|
||||||
break
|
case presets.linuxArm32Hfp:
|
||||||
case presets.linuxArm32Hfp:
|
linkerOpts += ['-lSDL2']
|
||||||
compilations.main.linkerOpts '-lSDL2'
|
break
|
||||||
break
|
}
|
||||||
|
runTask.workingDir(project.provider {
|
||||||
|
kotlin.targets.tetris.binaries.getExecutable(buildType).outputDirectory
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
compilations.main.cinterops {
|
|
||||||
sdl {
|
compilations.main.cinterops {
|
||||||
switch (hostPreset) {
|
sdl {
|
||||||
case presets.macosX64:
|
switch (hostPreset) {
|
||||||
includeDirs '/opt/local/include/SDL2', '/usr/local/include/SDL2'
|
case presets.macosX64:
|
||||||
break
|
includeDirs '/opt/local/include/SDL2', '/usr/local/include/SDL2'
|
||||||
case presets.linuxX64:
|
break
|
||||||
includeDirs '/usr/include/SDL2'
|
case presets.linuxX64:
|
||||||
break
|
includeDirs '/usr/include/SDL2'
|
||||||
case presets.mingwX86:
|
break
|
||||||
case presets.mingwX64:
|
case presets.mingwX86:
|
||||||
includeDirs "${MPPTools.mingwPath(hostPreset)}/include/SDL2"
|
case presets.mingwX64:
|
||||||
break
|
includeDirs "${MPPTools.mingwPath(hostPreset)}/include/SDL2"
|
||||||
case presets.linuxArm32Hfp:
|
break
|
||||||
includeDirs "${MPPTools.kotlinNativeDataPath()}/dependencies/target-sysroot-1-raspberrypi/usr/include/SDL2"
|
case presets.linuxArm32Hfp:
|
||||||
break
|
includeDirs "${MPPTools.kotlinNativeDataPath()}/dependencies/target-sysroot-1-raspberrypi/usr/include/SDL2"
|
||||||
}
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,16 +85,10 @@ if ((hostPreset == kotlin.presets.mingwX86) || (hostPreset == kotlin.presets.min
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MPPTools.createRunTask(project, 'runProgram', kotlin.targets.tetris) {
|
|
||||||
workingDir = project.provider {
|
|
||||||
kotlin.targets.tetris.compilations.main.getBinary('EXECUTABLE', buildType).parentFile
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
kotlin.targets.tetris.compilations.main { mainCompilation ->
|
kotlin.targets.tetris.compilations.main { mainCompilation ->
|
||||||
def linkTasks = ['RELEASE', 'DEBUG']
|
def linkTasks = ['RELEASE', 'DEBUG']
|
||||||
.collect { mainCompilation.findLinkTask('EXECUTABLE', it) }
|
.collect { kotlin.targets.tetris.binaries.getExecutable(it).linkTask }
|
||||||
.findAll { it != null }
|
.findAll { it != null }
|
||||||
|
|
||||||
def compileWindowsResourcesTask = tasks.findByName('compileWindowsResources')
|
def compileWindowsResourcesTask = tasks.findByName('compileWindowsResources')
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ will download and unzip the [MNIST dataset](https://en.wikipedia.org/wiki/MNIST_
|
|||||||
|
|
||||||
Then run
|
Then run
|
||||||
|
|
||||||
../gradlew runProgram
|
../gradlew runReleaseExecutableTorch
|
||||||
|
|
||||||
Alternatively you can run the artifact directly through
|
Alternatively you can run the artifact directly through
|
||||||
|
|
||||||
|
|||||||
+14
-16
@@ -8,15 +8,19 @@ def torchHome = "${MPPTools.kotlinNativeDataPath()}/third-party/torch"
|
|||||||
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64])
|
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64])
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
targetFromPreset(hostPreset, 'torch') {
|
||||||
fromPreset(hostPreset, 'torch') {
|
binaries {
|
||||||
compilations.main.outputKinds 'EXECUTABLE'
|
executable() {
|
||||||
compilations.main.entryPoint 'sample.torch.main'
|
entryPoint = 'sample.torch.main'
|
||||||
compilations.main.linkerOpts "-L$torchHome/lib", '-lATen'
|
linkerOpts += ["-L$torchHome/lib".toString(), '-lATen']
|
||||||
compilations.main.cinterops {
|
runTask.dependsOn 'downloadMNIST'
|
||||||
torch {
|
runTask.environment('LD_LIBRARY_PATH', "$torchHome/lib".toString())
|
||||||
includeDirs "$torchHome/include", "$torchHome/include/TH"
|
runTask.environment('DYLD_LIBRARY_PATH', "$torchHome/lib".toString())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
compilations.main.cinterops {
|
||||||
|
torch {
|
||||||
|
includeDirs "$torchHome/include", "$torchHome/include/TH"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,10 +35,4 @@ tasks[kotlin.targets.torch.compilations.main.cinterops.torch.interopProcessingTa
|
|||||||
task downloadMNIST(type: Exec) {
|
task downloadMNIST(type: Exec) {
|
||||||
workingDir projectDir
|
workingDir projectDir
|
||||||
commandLine './downloadMNIST.sh'
|
commandLine './downloadMNIST.sh'
|
||||||
}
|
}
|
||||||
|
|
||||||
MPPTools.createRunTask(project, 'runProgram', kotlin.targets.torch) {
|
|
||||||
dependsOn downloadMNIST
|
|
||||||
environment 'LD_LIBRARY_PATH': "$torchHome/lib"
|
|
||||||
environment 'DYLD_LIBRARY_PATH': "$torchHome/lib"
|
|
||||||
}
|
|
||||||
@@ -6,49 +6,50 @@ plugins {
|
|||||||
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64, kotlin.presets.mingwX64])
|
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.macosX64, kotlin.presets.linuxX64, kotlin.presets.mingwX64])
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
targetFromPreset(hostPreset, 'videoPlayer') {
|
||||||
fromPreset(hostPreset, 'videoPlayer') {
|
binaries {
|
||||||
compilations.main.outputKinds 'EXECUTABLE'
|
executable() {
|
||||||
compilations.main.entryPoint 'sample.videoplayer.main'
|
entryPoint = 'sample.videoplayer.main'
|
||||||
|
|
||||||
switch (hostPreset) {
|
switch (hostPreset) {
|
||||||
case presets.macosX64:
|
case presets.macosX64:
|
||||||
compilations.main.linkerOpts '-L/opt/local/lib', '-L/usr/local/lib'
|
linkerOpts += ['-L/opt/local/lib', '-L/usr/local/lib']
|
||||||
break
|
break
|
||||||
case presets.linuxX64:
|
case presets.linuxX64:
|
||||||
compilations.main.linkerOpts '-L/usr/lib/x86_64-linux-gnu', '-L/usr/lib64'
|
linkerOpts += ['-L/usr/lib/x86_64-linux-gnu', '-L/usr/lib64']
|
||||||
break
|
break
|
||||||
case presets.mingwX64:
|
case presets.mingwX64:
|
||||||
compilations.main.linkerOpts "-L${MPPTools.mingwPath()}/lib"
|
linkerOpts += ["-L${MPPTools.mingwPath()}/lib".toString()]
|
||||||
break
|
break
|
||||||
}
|
|
||||||
|
|
||||||
compilations.main.cinterops {
|
|
||||||
ffmpeg {
|
|
||||||
switch (hostPreset) {
|
|
||||||
case presets.macosX64:
|
|
||||||
includeDirs.headerFilterOnly '/opt/local/include', '/usr/local/include'
|
|
||||||
break
|
|
||||||
case presets.linuxX64:
|
|
||||||
includeDirs.headerFilterOnly '/usr/include', '/usr/include/x86_64-linux-gnu', '/usr/include/ffmpeg'
|
|
||||||
break
|
|
||||||
case presets.mingwX64:
|
|
||||||
includeDirs "${MPPTools.mingwPath()}/include"
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
sdl {
|
}
|
||||||
switch (hostPreset) {
|
}
|
||||||
case presets.macosX64:
|
|
||||||
includeDirs '/opt/local/include/SDL2', '/usr/local/include/SDL2'
|
compilations.main.cinterops {
|
||||||
break
|
ffmpeg {
|
||||||
case presets.linuxX64:
|
switch (hostPreset) {
|
||||||
includeDirs '/usr/include/SDL2'
|
case presets.macosX64:
|
||||||
break
|
includeDirs.headerFilterOnly '/opt/local/include', '/usr/local/include'
|
||||||
case presets.mingwX64:
|
break
|
||||||
includeDirs "${MPPTools.mingwPath()}/include/SDL2"
|
case presets.linuxX64:
|
||||||
break
|
includeDirs.headerFilterOnly '/usr/include', '/usr/include/x86_64-linux-gnu', '/usr/include/ffmpeg'
|
||||||
}
|
break
|
||||||
|
case presets.mingwX64:
|
||||||
|
includeDirs "${MPPTools.mingwPath()}/include"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sdl {
|
||||||
|
switch (hostPreset) {
|
||||||
|
case presets.macosX64:
|
||||||
|
includeDirs '/opt/local/include/SDL2', '/usr/local/include/SDL2'
|
||||||
|
break
|
||||||
|
case presets.linuxX64:
|
||||||
|
includeDirs '/usr/include/SDL2'
|
||||||
|
break
|
||||||
|
case presets.mingwX64:
|
||||||
|
includeDirs "${MPPTools.mingwPath()}/include/SDL2"
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
To build use `..\gradlew assemble`.
|
To build use `..\gradlew assemble`.
|
||||||
|
|
||||||
To run use `..\gradlew runProgram` or execute the program directly:
|
To run use `..\gradlew runReleaseExecutableWin32` or execute the program directly:
|
||||||
|
|
||||||
`.\build\exe\main\release\MessageBox.exe`.
|
`.\build\exe\main\release\MessageBox.exe`.
|
||||||
|
|||||||
@@ -6,13 +6,12 @@ plugins {
|
|||||||
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.mingwX64])
|
def hostPreset = MPPTools.defaultHostPreset(project, [kotlin.presets.mingwX64])
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
targetFromPreset(hostPreset, 'win32') {
|
||||||
fromPreset(hostPreset, 'win32') {
|
binaries {
|
||||||
compilations.main.outputKinds 'EXECUTABLE'
|
executable() {
|
||||||
compilations.main.entryPoint 'sample.win32.main'
|
entryPoint = 'sample.win32.main'
|
||||||
compilations.main.linkerOpts '-Wl,--subsystem,windows'
|
linkerOpts += ['-Wl,--subsystem,windows']
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MPPTools.createRunTask(project, 'runProgram', kotlin.targets.win32)
|
|
||||||
|
|||||||
@@ -38,6 +38,6 @@ computation results. Afterwards, worker execution termination is requested with
|
|||||||
|
|
||||||
To build use `../gradlew assemble`.
|
To build use `../gradlew assemble`.
|
||||||
|
|
||||||
To run use `../gradlew runProgram` or execute the program directly:
|
To run use `../gradlew runReleaseExecutableWorkers` or execute the program directly:
|
||||||
|
|
||||||
./build/bin/workers/main/release/executable/workers.kexe
|
./build/bin/workers/main/release/executable/workers.kexe
|
||||||
|
|||||||
@@ -6,12 +6,11 @@ plugins {
|
|||||||
def hostPreset = MPPTools.defaultHostPreset(project)
|
def hostPreset = MPPTools.defaultHostPreset(project)
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
targetFromPreset(hostPreset, 'workers') {
|
||||||
fromPreset(hostPreset, 'workers') {
|
binaries {
|
||||||
compilations.main.outputKinds 'EXECUTABLE'
|
executable() {
|
||||||
compilations.main.entryPoint 'sample.workers.main'
|
entryPoint = 'sample.workers.main'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MPPTools.createRunTask(project, 'runProgram', kotlin.targets.workers)
|
|
||||||
Reference in New Issue
Block a user