samples: Add scripts for samples building
This pach adds a root gradle project in the samples directory which allows one to build all gradle samples using `./gradlew build` command. It also adds a shell script in the samples directory which can build all samples (excluding tensorflow one) using their build.sh scripts.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
subprojects {
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
if (project.hasProperty("konan.plugin.path")) {
|
||||
classpath files(project.property("konan.plugin.path"))
|
||||
classpath "org.jetbrains.kotlin:kotlin-stdlib:+"
|
||||
} else {
|
||||
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:+"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task buildBash(type: Exec) {
|
||||
commandLine "${projectDir.canonicalPath}/build.sh"
|
||||
workingDir projectDir.canonicalPath
|
||||
}
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
EXCLUDE=()
|
||||
BUILD_SCRIPT="build.sh"
|
||||
|
||||
function isExcluded() {
|
||||
CHECKED="${1}"
|
||||
for VALUE in $EXCLUDE; do
|
||||
if [ "x$CHECKED" == "x$VALUE" ]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return -1
|
||||
}
|
||||
|
||||
for SAMPLE_DIR in *; do
|
||||
if [ -d "$SAMPLE_DIR" ] && [ -e "$SAMPLE_DIR/$BUILD_SCRIPT" ]; then
|
||||
echo
|
||||
echo "======================================================"
|
||||
date
|
||||
echo "Building a sample: $SAMPLE_DIR."
|
||||
if ! isExcluded "$SAMPLE_DIR"; then
|
||||
(cd "$SAMPLE_DIR" && . build.sh && cd $OLD_PWD) || (echo "Cannot build a sample: $SAMPLE_DIR. See log for details." && exit 1)
|
||||
else
|
||||
echo "The sample excluded."
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@@ -1,16 +1,3 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:+"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'konan'
|
||||
|
||||
konanInterop {
|
||||
@@ -27,6 +14,7 @@ konanArtifacts {
|
||||
}
|
||||
|
||||
build {
|
||||
project.ext { outputFile = "${projectDir.canonicalPath}/${file(compileKonanCsvParser.artifactPath).name}" }
|
||||
doLast {
|
||||
copy {
|
||||
from compileKonanCsvParser.artifactPath
|
||||
@@ -35,7 +23,7 @@ build {
|
||||
}
|
||||
}
|
||||
|
||||
void dumpCompilatioTask(Task task) {
|
||||
void dumpCompilationTask(Task task) {
|
||||
println()
|
||||
println("Compilation task: ${task.name}")
|
||||
println("outputDir : ${task.outputDir}")
|
||||
@@ -69,10 +57,16 @@ void dumpInteropTask(Task task) {
|
||||
println("linkFiles : ${task.linkFiles}")
|
||||
}
|
||||
|
||||
task dumpParameters {
|
||||
task dumpParameters(type: DefaultTask) {
|
||||
doLast {
|
||||
dumpCompilatioTask(konanArtifacts['CsvParser'].compilationTask)
|
||||
dumpCompilationTask(konanArtifacts['CsvParser'].compilationTask)
|
||||
dumpInteropTask(konanInterop['stdio'].generateStubsTask)
|
||||
dumpCompilatioTask(konanInterop['stdio'].compileStubsTask)
|
||||
dumpCompilationTask(konanInterop['stdio'].compileStubsTask)
|
||||
}
|
||||
}
|
||||
|
||||
clean {
|
||||
doLast {
|
||||
delete outputFile
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
konan.home=../../dist
|
||||
@@ -1,16 +1,3 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:+"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'konan'
|
||||
|
||||
|
||||
@@ -31,6 +18,7 @@ konanArtifacts {
|
||||
|
||||
|
||||
build {
|
||||
project.ext { outputFile = "${projectDir.canonicalPath}/${file(compileKonanGitChurn.artifactPath).name}" }
|
||||
doLast {
|
||||
copy {
|
||||
from compileKonanGitChurn.artifactPath
|
||||
@@ -39,7 +27,7 @@ build {
|
||||
}
|
||||
}
|
||||
|
||||
void dumpCompilatioTask(Task task) {
|
||||
void dumpCompilationTask(Task task) {
|
||||
println()
|
||||
println("Compilation task: ${task.name}")
|
||||
println("outputDir : ${task.outputDir}")
|
||||
@@ -73,10 +61,16 @@ void dumpInteropTask(Task task) {
|
||||
println("linkFiles : ${task.linkFiles}")
|
||||
}
|
||||
|
||||
task dumpParameters {
|
||||
task dumpParameters(type: DefaultTask) {
|
||||
doLast {
|
||||
dumpCompilatioTask(konanArtifacts['GitChurn'].compilationTask)
|
||||
dumpCompilationTask(konanArtifacts['GitChurn'].compilationTask)
|
||||
dumpInteropTask(konanInterop['libgit2'].generateStubsTask)
|
||||
dumpCompilatioTask(konanInterop['libgit2'].compileStubsTask)
|
||||
dumpCompilationTask(konanInterop['libgit2'].compileStubsTask)
|
||||
}
|
||||
}
|
||||
|
||||
clean {
|
||||
doLast {
|
||||
delete outputFile
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
konan.home=../../dist
|
||||
@@ -1 +0,0 @@
|
||||
konan.home=../..
|
||||
@@ -0,0 +1,2 @@
|
||||
konan.home=../../dist
|
||||
konan.plugin.path=../../tools/gradle-plugin/dist/gradle-plugin.jar
|
||||
@@ -4,7 +4,10 @@
|
||||
applications with the GTK toolkit.
|
||||
|
||||
To build use `./build.sh` script without arguments (or specify `TARGET` variable if cross-compiling).
|
||||
You also may use gradle to build the sample: `../gradlew build`.
|
||||
|
||||
Do not forget to install GTK3.
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
apply plugin: 'konan'
|
||||
|
||||
konanInterop {
|
||||
def includePrefixes = [ '/opt/local/include', '/usr/include', '/usr/local/include' ]
|
||||
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'
|
||||
defFile 'gtk3.def'
|
||||
}
|
||||
}
|
||||
|
||||
konanArtifacts {
|
||||
Gtk3Demo {
|
||||
inputFiles project.fileTree('src')
|
||||
useInterop 'gtk3'
|
||||
linkerOpts "-L/opt/local/lib -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu -lglib-2.0 -lgdk-3.0 -lgtk-3 -lgio-2.0 -lgobject-2.0"
|
||||
}
|
||||
}
|
||||
|
||||
build {
|
||||
project.ext { outputFile = "${projectDir.canonicalPath}/${file(compileKonanGtk3Demo.artifactPath).name}" }
|
||||
doLast {
|
||||
copy {
|
||||
from compileKonanGtk3Demo.artifactPath
|
||||
into projectDir.canonicalPath
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clean {
|
||||
doLast {
|
||||
delete outputFile
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ PATH=../../dist/bin:../../bin:$PATH
|
||||
DIR=.
|
||||
|
||||
IPREFIX_macbook=-I/opt/local/include
|
||||
#IPREFIX_macbook=-I/usr/local/include
|
||||
IPREFIX_linux=-I/usr/include
|
||||
LINKER_ARGS_macbook="-L/opt/local/lib -lglib-2.0 -lgdk-3.0 -lgtk-3 -lgio-2.0 -lgobject-2.0"
|
||||
LINKER_ARGS_linux="-L/usr/lib/x86_64-linux-gnu -lglib-2.0 -lgdk-3 -lgtk-3 -lgio-2.0 -lgobject-2.0"
|
||||
@@ -26,7 +27,8 @@ COMPILER_ARGS=${!var} # add -opt for an optimized build.
|
||||
if [ ! -f $DIR/gtk3.bc ]; then
|
||||
echo "Generating GTK stubs (once), may take few mins depending on the hardware..."
|
||||
cinterop -J-Xmx8g -copt $IPREFIX/atk-1.0 -copt $IPREFIX/gdk-pixbuf-2.0 -copt $IPREFIX/cairo -copt $IPREFIX/pango-1.0 \
|
||||
-copt -I/opt/local/lib/glib-2.0/include -copt -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -copt $IPREFIX/gtk-3.0 -copt $IPREFIX/glib-2.0 -def $DIR/gtk3.def \
|
||||
-copt -I/opt/local/lib/glib-2.0/include -copt -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -copt -I/usr/local/lib/glib-2.0/include \
|
||||
-copt $IPREFIX/gtk-3.0 -copt $IPREFIX/glib-2.0 -def $DIR/gtk3.def \
|
||||
-target $TARGET -o $DIR/gtk3.bc || exit 1
|
||||
fi
|
||||
konanc -target $TARGET $DIR/src -library $DIR/gtk3.bc -linkerArgs "$LINKER_ARGS" -o $DIR/Gtk3Demo.kexe || exit 1
|
||||
|
||||
@@ -1,16 +1,3 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:+"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'konan'
|
||||
|
||||
konanInterop {
|
||||
@@ -28,12 +15,18 @@ konanArtifacts {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
build {
|
||||
project.ext { outputFile = "${projectDir.canonicalPath}/${file(compileKonanCurl.artifactPath).name}" }
|
||||
doLast {
|
||||
copy {
|
||||
from compileKonanCurl.artifactPath
|
||||
into projectDir.canonicalPath
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clean {
|
||||
doLast {
|
||||
delete outputFile
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
konan.home=../../dist
|
||||
@@ -1 +0,0 @@
|
||||
konan.home=../..
|
||||
@@ -1,16 +1,3 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:0.1"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'konan'
|
||||
|
||||
konanInterop {
|
||||
@@ -27,6 +14,7 @@ konanArtifacts {
|
||||
}
|
||||
|
||||
build {
|
||||
project.ext { outputFile = "${projectDir.canonicalPath}/${file(compileKonanEchoServer.artifactPath).name}" }
|
||||
doLast {
|
||||
copy {
|
||||
from compileKonanEchoServer.artifactPath
|
||||
@@ -34,3 +22,9 @@ build {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clean {
|
||||
doLast {
|
||||
delete outputFile
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
konan.home=../../dist
|
||||
@@ -1 +0,0 @@
|
||||
konan.home=../..
|
||||
@@ -1,16 +1,3 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:+"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'konan'
|
||||
|
||||
konanInterop {
|
||||
@@ -36,10 +23,17 @@ konanArtifacts {
|
||||
|
||||
|
||||
build {
|
||||
project.ext { outputFile = "${projectDir.canonicalPath}/${file(compileKonanOpenGlTeapot.artifactPath).name}" }
|
||||
doLast {
|
||||
copy {
|
||||
from compileKonanOpenGlTeapot.artifactPath
|
||||
into projectDir.canonicalPath
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clean {
|
||||
doLast {
|
||||
delete outputFile
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
konan.home=../../dist
|
||||
@@ -1 +0,0 @@
|
||||
konan.home=../..
|
||||
@@ -0,0 +1,8 @@
|
||||
include ':csvparser'
|
||||
include ':gitchurn'
|
||||
include ':gtk'
|
||||
include ':libcurl'
|
||||
include ':nonBlockingEchoServer'
|
||||
include ':opengl'
|
||||
include ':socket'
|
||||
include ':tetris'
|
||||
@@ -1,16 +1,3 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:+"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'konan'
|
||||
|
||||
konanInterop {
|
||||
@@ -27,10 +14,17 @@ konanArtifacts {
|
||||
}
|
||||
|
||||
build {
|
||||
project.ext { outputFile = "${projectDir.canonicalPath}/${file(compileKonanEchoServer.artifactPath).name}" }
|
||||
doLast {
|
||||
copy {
|
||||
from compileKonanEchoServer.artifactPath
|
||||
into projectDir.canonicalPath
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clean {
|
||||
doLast {
|
||||
delete outputFile
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
konan.home=../../dist
|
||||
@@ -1 +0,0 @@
|
||||
konan.home=../..
|
||||
+16
-19
@@ -1,16 +1,3 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:+"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'konan'
|
||||
|
||||
konanInterop {
|
||||
@@ -84,14 +71,24 @@ konanArtifacts {
|
||||
}
|
||||
|
||||
build {
|
||||
project.ext {
|
||||
buildTasks = getTaskDependencies().getDependencies().findAll { task -> task.name.startsWith("compileKonan") }
|
||||
outputFiles = buildTasks.collect { task -> "${projectDir.canonicalPath}/${file(task.artifactPath).name}" }
|
||||
}
|
||||
doLast {
|
||||
getTaskDependencies().getDependencies().forEach() { task ->
|
||||
if (task.name.startsWith("compileKonan")) {
|
||||
copy {
|
||||
from task.artifactPath
|
||||
into projectDir.canonicalPath
|
||||
}
|
||||
buildTasks.forEach() { task ->
|
||||
copy {
|
||||
from task.artifactPath
|
||||
into projectDir.canonicalPath
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clean {
|
||||
doLast {
|
||||
outputFiles.forEach {
|
||||
delete it
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
konan.home=../../dist
|
||||
@@ -1 +0,0 @@
|
||||
konan.home=../..
|
||||
Reference in New Issue
Block a user