-
Notifications
You must be signed in to change notification settings - Fork 43
/
build.gradle
64 lines (53 loc) · 1.91 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
import org.gradle.internal.jvm.Jvm
plugins {
id 'c'
id 'java'
id 'application'
}
repositories {
mavenCentral()
}
sourceSets.main.java.srcDirs = ["src/main/java"]
sourceSets.test.java.srcDirs = ["src/test/java"]
model {
platforms {
x64 {
architecture "x86_64"
}
}
components {
jpostal(NativeLibrarySpec) {
binaries.all {
def jvmHome = org.gradle.internal.jvm.Jvm.current().javaHome
if (targetPlatform.operatingSystem.macOsX) {
cCompiler.args '-I', "${jvmHome}/include"
cCompiler.args '-I', "${jvmHome}/include/darwin"
cCompiler.args '-mmacosx-version-min=10.9'
linker.args '-mmacosx-version-min=10.9'
linker.args '-stdlib=libc++'
} else if (targetPlatform.operatingSystem.linux) {
cCompiler.args '-I', "${jvmHome}/include"
cCompiler.args '-I', "${jvmHome}/include/linux"
cCompiler.args '-D_FILE_OFFSET_BITS=64'
} else if (targetPlatform.operatingSystem.windows) {
cCompiler.args "-I${jvmHome}/include"
cCompiler.args "-I${jvmHome}/include/win32"
} else if (targetPlatform.operatingSystem.freeBSD) {
cCompiler.args '-I', "${jvmHome}/include"
cCompiler.args '-I', "${jvmHome}/include/freebsd"
}
linker.args '-lpostal' // Link with libpostal
}
}
}
}
classes.dependsOn 'jpostalSharedLibrary'
application {
applicationDefaultJvmArgs = ["-Djava.library.path=" + file("${buildDir}/libs/jpostal/shared").absolutePath]
}
dependencies {
testImplementation 'junit:junit:4.+'
}
tasks.withType(Test) {
systemProperty "java.library.path", file("${buildDir}/libs/jpostal/shared").absolutePath
}