82 lines
2.0 KiB
Groovy
82 lines
2.0 KiB
Groovy
import org.gradle.internal.jvm.Jvm
|
|
|
|
plugins {
|
|
id 'java'
|
|
id 'eclipse'
|
|
id 'application'
|
|
id 'cpp'
|
|
}
|
|
application {
|
|
mainClass = 'com.bernard.sboard.SBoard'
|
|
applicationDefaultJvmArgs += ["-Djava.library.path=${projectDir}/build/libs/jlilv/shared/"]
|
|
}
|
|
|
|
println "Building on OS: " + System.properties['os.name']
|
|
println "Using JDK: " + System.properties['java.home']
|
|
|
|
def JNI_CFLAGS = ['-I',System.properties['java.home'] + "/include/",'-I',System.properties['java.home'] + "/include/linux/"]
|
|
def LILV_CFLAGS = ['pkg-config','--cflags','lilv-0'].execute().text.trim()
|
|
def JNI_LDFLAGS = ""
|
|
def LILV_LDFLAGS = ['pkg-config','--libs','lilv-0'].execute().text.trim()
|
|
|
|
println "Using JNI C Flags: " + JNI_CFLAGS
|
|
println "Using LILV C Flags: " + LILV_CFLAGS
|
|
println "Using JNI ld Flags: " + JNI_LDFLAGS
|
|
println "Using LILV ld Flags: " + LILV_LDFLAGS
|
|
|
|
model {
|
|
components {
|
|
jlilv(NativeLibrarySpec) {
|
|
sources {
|
|
cpp {
|
|
source {
|
|
srcDir 'src/main/jni'
|
|
include "**/*.cpp"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
toolChains {
|
|
gcc(Gcc) {
|
|
eachPlatform {
|
|
cppCompiler.withArguments { args ->
|
|
args.add("-O2")
|
|
args.addAll(JNI_CFLAGS)
|
|
args.addAll("$LILV_CFLAGS".split(" "))
|
|
args.addAll(["-I","${projectDir}/build/generated/sources/headers/java/main/"])
|
|
args << "-std=c++11"
|
|
}
|
|
linker.withArguments { args ->
|
|
args << "-O2"
|
|
//args.addAll("$JNI_LDFLAGS".split(" "))
|
|
args.addAll("$LILV_LDFLAGS".split(" "))
|
|
args << "-lstdc++"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
run {
|
|
dependsOn build
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
java {
|
|
srcDir 'src/app/java'
|
|
}
|
|
resources {
|
|
srcDir 'src/app/resources'
|
|
}
|
|
}
|
|
test {
|
|
java {
|
|
srcDir 'src/test/java'
|
|
}
|
|
resources {
|
|
srcDir 'src/test/resources'
|
|
}
|
|
}
|
|
} |