Add Photonlib (#231)

Merges Photonlib into Photonvision, along with the Photonlib code examples. Also creates a new PhotonTargeting library teams can depend on.
This commit is contained in:
Matt
2021-01-16 20:41:47 -08:00
committed by GitHub
parent 58b39f47aa
commit 2e1b3d0f83
79 changed files with 5867 additions and 142 deletions

View File

@@ -0,0 +1,77 @@
plugins {
id 'cpp'
id 'java'
id 'edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin' version '2020.2'
id 'google-test-test-suite'
id 'edu.wpi.first.NativeUtils' version '2020.10.1'
id 'edu.wpi.first.GradleJni' version '0.10.1'
id 'edu.wpi.first.GradleVsCode' version '0.12.0'
}
repositories {
maven {
url = 'https://frcmaven.wpi.edu:443/artifactory/release'
maven { url "https://frcmaven.wpi.edu/artifactory/development" }
mavenCentral()
}
}
apply from: '../photon-lib/config.gradle'
ext.examplesMap = [:]
File examplesTree = file("$projectDir/src/main/cpp/examples")
examplesTree.list(new FilenameFilter() {
@Override
public boolean accept(File current, String name) {
return new File(current, name).isDirectory();
}
}).each {
examplesMap.put(it, [])
}
nativeUtils.platformConfigs.named(nativeUtils.wpi.platforms.roborio).configure {
cppCompiler.args.remove('-Wno-error=deprecated-declarations')
cppCompiler.args.add('-Werror=deprecated-declarations')
}
ext {
sharedCvConfigs = examplesMap
staticCvConfigs = [:]
useJava = false
useCpp = true
}
model {
components {
examplesMap.each { key, value ->
"${key}"(NativeExecutableSpec) {
targetBuildTypes 'debug'
binaries.all { binary ->
lib project: ':photon-lib', library: 'Photon', linkage: 'shared'
if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
nativeUtils.useRequiredLibrary(binary, 'netcomm_shared', 'chipobject_shared', 'visa_shared', 'ni_runtime_shared')
}
}
sources {
cpp {
source {
srcDirs 'src/main/cpp/examples/' + "${key}" + "/cpp"
include '**/*.cpp'
}
exportedHeaders {
srcDirs 'src/main/cpp/examples/' + "${key}" + "/include"
include '**/*.h'
}
}
}
nativeUtils.useRequiredLibrary(it, 'wpilib_shared')
}
}
}
}
ext {
exampleDirectory = new File("$projectDir/src/main/java/edu/wpi/first/wpilibj/examples/")
exampleFile = new File("$projectDir/src/main/java/edu/wpi/first/wpilibj/examples/examples.json")
}