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"
konanTargets = ["android_arm32", "android_arm64"]
konanArtifacts {
PolyhedronArm32 {
target "android_arm32"
outputDir 'PolyhedronArm32'
outputName 'libpoly'
}
PolyhedronArm64 {
target "android_arm64"
outputDir 'PolyhedronArm64'
Polyhedron {
baseDir 'Polyhedron'
outputName 'libpoly'
}
}
def platforms = ["armeabi-v7a", "arm64-v8a"]
def artifacts = ["PolyhedronArm32", "PolyhedronArm64"]
def artifacts = ["Polyhedron/armeabi-v7a", "Polyhedron/arm64-v8a"]
apply plugin: "com.android.model.application"
@@ -91,12 +87,10 @@ model {
}
tasks.matching { it.name == 'preBuild' }.all {
it.dependsOn 'compileKonanPolyhedronArm32'
it.dependsOn 'compileKonanPolyhedronArm64'
it.dependsOn 'compileKonan'
}
task buildApk(type: DefaultTask) {
dependsOn "compileKonanPolyhedronArm32"
dependsOn "compileKonanPolyhedronArm64"
dependsOn "compileKonan"
dependsOn "assembleDebug"
}
+1 -1
View File
@@ -23,4 +23,4 @@ CLANG=${!var}
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'
konanArtifacts {
CsvParser
program('CsvParser')
}
+6 -6
View File
@@ -1,13 +1,13 @@
apply plugin: 'konan'
konanInterop {
libgit2 {
konanArtifacts {
interop('libgit2') {
includeDirs '/opt/local/include', '/usr/include', '/usr/local/include'
}
}
konanArtifacts {
GitChurn {
useInterop 'libgit2'
program('GitChurn') {
libraries {
artifact 'libgit2'
}
}
}
+8 -7
View File
@@ -1,17 +1,18 @@
apply plugin: 'konan'
konanInterop {
def includePrefixes = [ '/opt/local/include', '/usr/include', '/usr/local/include' ]
gtk3 {
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'
}
}
konanArtifacts {
Gtk3Demo {
useInterop 'gtk3'
program('Gtk3Demo') {
libraries {
artifact 'gtk3'
}
}
}
+6 -6
View File
@@ -1,13 +1,13 @@
apply plugin: 'konan'
konanInterop {
libcurl {
konanArtifacts {
interop('libcurl') {
includeDirs '/usr/include', '/opt/local/include', '/usr/local/opt/curl/include', '.'
}
}
konanArtifacts {
Curl {
useInterop 'libcurl'
program('Curl') {
libraries {
artifact 'libcurl'
}
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
apply plugin: 'konan'
konanArtifacts {
EchoServer
program('EchoServer')
}
+3 -3
View File
@@ -1,7 +1,7 @@
apply plugin: 'konan'
konanTargets = ['macbook']
konanArtifacts {
Window {
target "macbook"
}
program('Window')
}
+3 -3
View File
@@ -1,7 +1,7 @@
apply plugin: 'konan'
konanTargets = ["macbook"]
konanArtifacts {
OpenGlTeapot {
target "macbook"
}
program('OpenGlTeapot')
}
+2 -2
View File
@@ -1,3 +1,4 @@
// TODO: Uncomment
include ':csvparser'
include ':gitchurn'
include ':gtk'
@@ -7,11 +8,10 @@ include ':opengl'
include ':socket'
include ':tetris'
include ':tensorflow'
include ':concurrent'
// Android native activity build requires Android SDK.
// So temporary switching off for now, as it breaks the build
// of other samples if SDK is not present.
//include ':androidNativeActivity'
// include ':androidNativeActivity'
include ':objc'
include ':uikit'
includeBuild '../'
+1 -1
View File
@@ -1,5 +1,5 @@
apply plugin: 'konan'
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"
konanInterop {
tensorflow {
konanArtifacts {
interop('TensorflowInterop') {
defFile "src/main/c_interop/tensorflow.def"
includeDirs "${tensorflowHome}/include"
}
}
konanArtifacts {
Tensorflow {
useInterop "tensorflow"
program('Tensorflow') {
libraries {
artifact 'TensorflowInterop'
}
linkerOpts "-L${tensorflowHome}/lib -ltensorflow"
}
}
@@ -29,6 +30,6 @@ task downloadTensorflow(type: Exec) {
commandLine './downloadTensorflow.sh'
}
processTensorflowInterop {
compileKonanTensorflowInterop {
dependsOn 'downloadTensorflow'
}
+50 -61
View File
@@ -1,79 +1,68 @@
apply plugin: 'konan'
konanInterop {
sdlMacbook {
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'
}
}
konanTargets.clear()
konanTargets.addAll(['macbook', 'linux', 'iphone', 'raspberrypi'])
konanArtifacts {
TetrisMacbook {
useInterop 'sdlMacbook'
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 'macbook'
interop ('sdl') {
defFile 'src/main/c_interop/sdl.def'
pkg '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 '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 {
useInterop 'sdlLinux'
linkerOpts '-L/usr/lib/x86_64-linux-gnu -lSDL2'
target 'linux'
}
program ('tetris') {
libraries {
artifact 'sdl'
}
TetrisIphone {
useInterop 'sdlIphone'
linkerOpts '-framework SDL2 -framework AVFoundation -framework CoreGraphics -framework CoreMotion ' +
'-framework Foundation -framework GameController -framework AudioToolbox -framework OpenGLES ' +
'-framework QuartzCore -framework UIKit'
noMain()
target 'iphone'
}
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"
}
TetrisRaspberry {
useInterop 'sdlRaspberry'
linkerOpts '-lSDL2'
target 'raspberrypi'
target 'linux', {
linkerOpts '-L/usr/lib/x86_64-linux-gnu -lSDL2'
}
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 {
project.ext {
buildTasks = getTaskDependencies().getDependencies().findAll { task -> task.name.startsWith("compileKonan") }
}
doLast {
buildTasks.forEach() { task ->
konanArtifacts.tetris.forEach() { task ->
copy {
from 'src/main/resources'
into file(task.artifactPath).parentFile
into task.artifact.parentFile
}
}
}
+3 -3
View File
@@ -1,7 +1,7 @@
apply plugin: 'konan'
konanTargets = ['iphone']
konanArtifacts {
app {
target "iphone"
}
program('app')
}