samples: Use reworked DSL in gradle builds

This commit is contained in:
Ilya Matveev
2017-10-17 19:32:38 +03:00
committed by ilmat192
parent d3f9e335fb
commit eea0eb7e9f
14 changed files with 100 additions and 115 deletions
+7 -13
View File
@@ -25,21 +25,17 @@ allprojects {
apply plugin: "konan" apply plugin: "konan"
konanTargets = ["android_arm32", "android_arm64"]
konanArtifacts { konanArtifacts {
PolyhedronArm32 { Polyhedron {
target "android_arm32" baseDir 'Polyhedron'
outputDir 'PolyhedronArm32'
outputName 'libpoly'
}
PolyhedronArm64 {
target "android_arm64"
outputDir 'PolyhedronArm64'
outputName 'libpoly' outputName 'libpoly'
} }
} }
def platforms = ["armeabi-v7a", "arm64-v8a"] def platforms = ["armeabi-v7a", "arm64-v8a"]
def artifacts = ["PolyhedronArm32", "PolyhedronArm64"] def artifacts = ["Polyhedron/armeabi-v7a", "Polyhedron/arm64-v8a"]
apply plugin: "com.android.model.application" apply plugin: "com.android.model.application"
@@ -91,12 +87,10 @@ model {
} }
tasks.matching { it.name == 'preBuild' }.all { tasks.matching { it.name == 'preBuild' }.all {
it.dependsOn 'compileKonanPolyhedronArm32' it.dependsOn 'compileKonan'
it.dependsOn 'compileKonanPolyhedronArm64'
} }
task buildApk(type: DefaultTask) { task buildApk(type: DefaultTask) {
dependsOn "compileKonanPolyhedronArm32" dependsOn "compileKonan"
dependsOn "compileKonanPolyhedronArm64"
dependsOn "assembleDebug" dependsOn "assembleDebug"
} }
+1 -1
View File
@@ -23,4 +23,4 @@ CLANG=${!var}
mkdir -p $DIR/build/clang/ mkdir -p $DIR/build/clang/
$CLANG -std=c++11 -c $DIR/src/main/cpp/MessageChannel.cpp -o $DIR/build/clang/MessageChannel.bc -emit-llvm || exit 1 $CLANG -H -std=c++11 -c $DIR/src/main/cpp/MessageChannel.cpp -o $DIR/build/clang/MessageChannel.bc -emit-llvm || exit 1
+1 -1
View File
@@ -1,5 +1,5 @@
apply plugin: 'konan' apply plugin: 'konan'
konanArtifacts { konanArtifacts {
CsvParser program('CsvParser')
} }
+6 -6
View File
@@ -1,13 +1,13 @@
apply plugin: 'konan' apply plugin: 'konan'
konanInterop { konanArtifacts {
libgit2 { interop('libgit2') {
includeDirs '/opt/local/include', '/usr/include', '/usr/local/include' includeDirs '/opt/local/include', '/usr/include', '/usr/local/include'
} }
}
konanArtifacts { program('GitChurn') {
GitChurn { libraries {
useInterop 'libgit2' artifact 'libgit2'
}
} }
} }
+8 -7
View File
@@ -1,17 +1,18 @@
apply plugin: 'konan' apply plugin: 'konan'
konanInterop { def includePrefixes = [ '/opt/local/include', '/usr/include', '/usr/local/include' ]
def includePrefixes = [ '/opt/local/include', '/usr/include', '/usr/local/include' ]
gtk3 { konanArtifacts {
interop('gtk3') {
includePrefixes.each { 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 "$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' 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'
} }
}
konanArtifacts { program('Gtk3Demo') {
Gtk3Demo { libraries {
useInterop 'gtk3' artifact 'gtk3'
}
} }
} }
+6 -6
View File
@@ -1,13 +1,13 @@
apply plugin: 'konan' apply plugin: 'konan'
konanInterop { konanArtifacts {
libcurl { interop('libcurl') {
includeDirs '/usr/include', '/opt/local/include', '/usr/local/opt/curl/include', '.' includeDirs '/usr/include', '/opt/local/include', '/usr/local/opt/curl/include', '.'
} }
}
konanArtifacts { program('Curl') {
Curl { libraries {
useInterop 'libcurl' artifact 'libcurl'
}
} }
} }
+1 -1
View File
@@ -1,5 +1,5 @@
apply plugin: 'konan' apply plugin: 'konan'
konanArtifacts { konanArtifacts {
EchoServer program('EchoServer')
} }
+3 -3
View File
@@ -1,7 +1,7 @@
apply plugin: 'konan' apply plugin: 'konan'
konanTargets = ['macbook']
konanArtifacts { konanArtifacts {
Window { program('Window')
target "macbook"
}
} }
+3 -3
View File
@@ -1,7 +1,7 @@
apply plugin: 'konan' apply plugin: 'konan'
konanTargets = ["macbook"]
konanArtifacts { konanArtifacts {
OpenGlTeapot { program('OpenGlTeapot')
target "macbook"
}
} }
+2 -2
View File
@@ -1,3 +1,4 @@
// TODO: Uncomment
include ':csvparser' include ':csvparser'
include ':gitchurn' include ':gitchurn'
include ':gtk' include ':gtk'
@@ -7,11 +8,10 @@ include ':opengl'
include ':socket' include ':socket'
include ':tetris' include ':tetris'
include ':tensorflow' include ':tensorflow'
include ':concurrent'
// Android native activity build requires Android SDK. // Android native activity build requires Android SDK.
// So temporary switching off for now, as it breaks the build // So temporary switching off for now, as it breaks the build
// of other samples if SDK is not present. // of other samples if SDK is not present.
//include ':androidNativeActivity' // include ':androidNativeActivity'
include ':objc' include ':objc'
include ':uikit' include ':uikit'
includeBuild '../' includeBuild '../'
+1 -1
View File
@@ -1,5 +1,5 @@
apply plugin: 'konan' apply plugin: 'konan'
konanArtifacts { konanArtifacts {
EchoServer program('EchoServer')
} }
+8 -7
View File
@@ -2,15 +2,16 @@ apply plugin: 'konan'
def tensorflowHome = "${System.getProperty("user.home")}/.konan/third-party/tensorflow" def tensorflowHome = "${System.getProperty("user.home")}/.konan/third-party/tensorflow"
konanInterop { konanArtifacts {
tensorflow { interop('TensorflowInterop') {
defFile "src/main/c_interop/tensorflow.def"
includeDirs "${tensorflowHome}/include" includeDirs "${tensorflowHome}/include"
} }
}
konanArtifacts { program('Tensorflow') {
Tensorflow { libraries {
useInterop "tensorflow" artifact 'TensorflowInterop'
}
linkerOpts "-L${tensorflowHome}/lib -ltensorflow" linkerOpts "-L${tensorflowHome}/lib -ltensorflow"
} }
} }
@@ -29,6 +30,6 @@ task downloadTensorflow(type: Exec) {
commandLine './downloadTensorflow.sh' commandLine './downloadTensorflow.sh'
} }
processTensorflowInterop { compileKonanTensorflowInterop {
dependsOn 'downloadTensorflow' dependsOn 'downloadTensorflow'
} }
+50 -61
View File
@@ -1,79 +1,68 @@
apply plugin: 'konan' apply plugin: 'konan'
konanInterop { konanTargets.clear()
sdlMacbook { konanTargets.addAll(['macbook', 'linux', 'iphone', 'raspberrypi'])
defFile 'src/main/c_interop/sdl.def'
pkg 'sdl'
includeDirs '/Library/Frameworks/SDL2.framework/Headers',
"${System.getProperty("user.home")}/Library/Frameworks/SDL2.framework/Headers",
'/opt/local/include/SDL2',
'/usr/local/include/SDL2'
target 'macbook'
}
sdlLinux {
defFile 'src/main/c_interop/sdl.def'
pkg 'sdl'
includeDirs '/usr/include/SDL2'
target 'linux'
}
sdlIphone {
defFile 'src/main/c_interop/sdl.def'
pkg 'sdl'
includeDirs "${project.property("konan.home")}/dependencies/target-sysroot-2-darwin-ios/System/Library/Frameworks/SDL2.framework/Headers"
target 'iphone'
}
sdlRaspberry {
defFile 'src/main/c_interop/sdl.def'
pkg 'sdl'
includeDirs "${project.property("konan.home")}/dependencies/target-sysroot-1-raspberrypi/usr/include/SDL2"
target 'raspberrypi'
}
}
konanArtifacts { konanArtifacts {
TetrisMacbook {
useInterop 'sdlMacbook' interop ('sdl') {
linkerOpts "-F ${System.getProperty("user.home")}/Library/Frameworks -F /Library/Frameworks -framework SDL2" defFile 'src/main/c_interop/sdl.def'
// Use this line instead of the previous one if you've got a 'No SDL-framework' error. pkg 'sdl'
//linkerOpts "-L/opt/local/lib -L/usr/local/lib -lSDL2"
target 'macbook' 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 'iphone', {
includeDirs "${project.property("konan.home")}/dependencies/target-sysroot-2-darwin-ios/System/Library/Frameworks/SDL2.framework/Headers"
}
target 'raspberrypi', {
includeDirs "${project.property("konan.home")}/dependencies/target-sysroot-1-raspberrypi/usr/include/SDL2"
}
} }
TetrisLinux { program ('tetris') {
useInterop 'sdlLinux' libraries {
linkerOpts '-L/usr/lib/x86_64-linux-gnu -lSDL2' artifact 'sdl'
target 'linux' }
}
TetrisIphone { target 'macbook', {
useInterop 'sdlIphone' linkerOpts "-F ${System.getProperty("user.home")}/Library/Frameworks -F /Library/Frameworks -framework SDL2"
linkerOpts '-framework SDL2 -framework AVFoundation -framework CoreGraphics -framework CoreMotion ' + // Use this line instead of the previous one if you've got a 'No SDL-framework' error.
'-framework Foundation -framework GameController -framework AudioToolbox -framework OpenGLES ' + //linkerOpts "-L/opt/local/lib -L/usr/local/lib -lSDL2"
'-framework QuartzCore -framework UIKit' }
noMain()
target 'iphone'
}
TetrisRaspberry { target 'linux', {
useInterop 'sdlRaspberry' linkerOpts '-L/usr/lib/x86_64-linux-gnu -lSDL2'
linkerOpts '-lSDL2' }
target 'raspberrypi'
target 'iphone', {
linkerOpts '-framework SDL2 -framework AVFoundation -framework CoreGraphics -framework CoreMotion ' +
'-framework Foundation -framework GameController -framework AudioToolbox -framework OpenGLES ' +
'-framework QuartzCore -framework UIKit'
noMain true
}
target 'raspberrypi', {
linkerOpts '-lSDL2'
}
} }
} }
compileKonan { compileKonan {
project.ext {
buildTasks = getTaskDependencies().getDependencies().findAll { task -> task.name.startsWith("compileKonan") }
}
doLast { doLast {
buildTasks.forEach() { task -> konanArtifacts.tetris.forEach() { task ->
copy { copy {
from 'src/main/resources' from 'src/main/resources'
into file(task.artifactPath).parentFile into task.artifact.parentFile
} }
} }
} }
+3 -3
View File
@@ -1,7 +1,7 @@
apply plugin: 'konan' apply plugin: 'konan'
konanTargets = ['iphone']
konanArtifacts { konanArtifacts {
app { program('app')
target "iphone"
}
} }