forked from JetBrains/kotlin-native
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
94 lines (77 loc) · 2.51 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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 {
sdlMacbook {
defFile 'sdl.def'
includeDirs '/Library/Frameworks/SDL2.framework/Headers', "${System.getProperty("user.home")}/Library/Frameworks/SDL2.framework/Headers"
target 'macbook'
}
sdlLinux {
defFile 'sdl.def'
includeDirs '/usr/include/SDL2'
target 'linux'
}
sdlIphone {
defFile 'sdl.def'
includeDirs "${project.property("konan.home")}/dependencies/target-sysroot-2-darwin-ios/System/Library/Frameworks/SDL2.framework/Headers"
target 'iphone'
}
sdlRaspberry {
defFile 'sdl.def'
includeDirs "${project.property("konan.home")}/dependencies/target-sysroot-1-raspberrypi/usr/include/SDL2"
target 'raspberrypi'
}
}
konanArtifacts {
TetrisMacbook {
inputFiles project.file('Tetris.kt')
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'
}
TetrisLinux {
inputFiles project.file('Tetris.kt')
useInterop 'sdlLinux'
linkerOpts '-L/usr/lib/x86_64-linux-gnu -lSDL2'
target 'linux'
}
TetrisIphone {
inputFiles project.file('Tetris.kt')
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'
}
TetrisRaspberry {
inputFiles project.file('Tetris.kt')
useInterop 'sdlRaspberry'
linkerOpts '-lSDL2'
target 'raspberrypi'
}
}
build {
doLast {
getTaskDependencies().getDependencies().forEach() { task ->
if (task.name.startsWith("compileKonan")) {
copy {
from task.artifactPath
into projectDir.canonicalPath
}
}
}
}
}