-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
179 lines (159 loc) · 4.46 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
import org.gradle.internal.os.OperatingSystem;
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.gradle:osdetector-gradle-plugin:1.4.0'
}
}
repositories {
maven {
url "${System.getProperty('user.home')}/releases/maven/development"
}
maven {
url = "http://first.wpi.edu/FRC/roborio/maven/release"
}
mavenCentral()
}
apply plugin: 'com.google.osdetector'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'cpp'
def java_home = System.properties['java.home']
def cudaPath = "/usr/local/cuda/"
def useCuda = file(cudaPath).exists()
model {
repositories {
libs(PrebuiltLibraries) {
def opencvIncludeDir = "lib/opencv/include"
def staticLibExtension = osdetector.os == "windows" ? "lib" : "a"
def opencvLibPath = "lib/opencv/${osdetector.os}/${osdetector.arch}"
opencv_imgproc {
headers.srcDir opencvIncludeDir
binaries.withType(StaticLibraryBinary){
staticLibraryFile = file("${opencvLibPath}/libopencv_imgproc.${staticLibExtension}")
}
}
opencv_core {
headers.srcDir opencvIncludeDir
binaries.withType(StaticLibraryBinary){
staticLibraryFile = file("${opencvLibPath}/libopencv_core.${staticLibExtension}")
}
}
opencv_cudaimgproc {
headers.srcDir opencvIncludeDir
binaries.withType(StaticLibraryBinary){
staticLibraryFile = file("${opencvLibPath}/libopencv_cudaimgproc.${staticLibExtension}")
}
}
opencv_cudafilters {
headers.srcDir opencvIncludeDir
binaries.withType(StaticLibraryBinary){
staticLibraryFile = file("${opencvLibPath}/libopencv_cudafilters.${staticLibExtension}")
}
}
if (useCuda) {
cudart {
binaries.withType(StaticLibraryBinary){
staticLibraryFile = file("${cudaPath}/lib/libcudart_static.${staticLibExtension}")
}
}
nppi {
binaries.withType(StaticLibraryBinary){
staticLibraryFile = file("${cudaPath}/lib/libnppi_static.${staticLibExtension}")
}
}
}
jni {
headers.srcDir java_home + "/../include"
if (osdetector.os == "osx") {
headers.srcDir "$java_home/../include/darwin"
} else if (osdetector.os == "linux") {
headers.srcDir "$java_home/../include/linux"
}
}
}
}
toolChains {
gcc(Gcc) {
target("armv7")
}
}
platforms {
armv7 {
architecture "arm-v7"
}
}
components {
gpuvision(NativeLibrarySpec) {
sources {
cpp.lib library: 'jni', linkage: 'api'
cpp {
source {
srcDir 'src/main/jni'
//include "**/*.cpp"
}
lib library: 'opencv_imgproc', linkage: 'static'
lib library: 'opencv_cudaimgproc', linkage: 'static'
lib library: 'opencv_cudafilters', linkage: 'static'
lib library: 'opencv_core', linkage: 'static'
if (useCuda) {
lib library: 'cudart', linkage: 'static'
lib library: 'nppi', linkage: 'static'
}
}
}
buildTypes {
release
}
targetPlatform "armv7"
}
}
tasks {
/*copyLibGpuvision {
dependsOn $.tasks.gpuvisionSharedLibrary
println $.tasks
inputs.file $.binaries.gpuvisionSharedLibrary.getSharedLibraryFile()
outputs.file $.binaries.gpuvisionSharedLibrary.getSharedLibraryFile()
}*/
jar {
//dependsOn $.tasks.copyLibGpuvision
from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
}
task nativeHeaders(dependsOn: ':jar') {
def classes = ["org.usfirst.frc.team2084.CMonster2016.vision.HighGoalProcessor",
"org.usfirst.frc.team2084.CMonster2016.vision.BoulderProcessor"]
//def files = classes.collect { sourceSets.main.output.classesDir.absolutePath + "/" +it.replace(".", "/") };
inputs.files '$buildDir/libs/VisionProcessor2016.jar'
outputs.dir "src/main/jni"
doLast {
exec {
executable org.gradle.internal.jvm.Jvm.current().getExecutable('javah')
args '-d', "src/main/jni"
args '-classpath', '$buildDir/libs/VisionProcessor2016.jar'
args classes
}
}
}
javadoc {
failOnError false
}
// This should not be changed without notifying everybody
String opencvVersion = "3.1.0"
String opencvCode = opencvVersion.replace(".", "")
dependencies {
compile files('lib/opencv-310.jar')
String ntType = "desktop"
if (osdetector.arch.contains("arm")) {
ntType = "arm"
}
compile 'org.nanohttpd:nanohttpd:+'
compile 'com.fazecast:jSerialComm:+'
compileOnly 'edu.wpi.first.wpilib.networktables.java:NetworkTables:3.+:' + ntType
testCompile 'junit:junit:4.+'
testCompile 'org.hamcrest:hamcrest-library:1.+'
testCompile 'org.mockito:mockito-core:1.+'
}