mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
Allows logging software and live data view to see results. Also removes the requirement for AScope to keep up with the packet serde schema and instead just use the Protobuf descriptor.
108 lines
3.9 KiB
Groovy
108 lines
3.9 KiB
Groovy
apply plugin: 'cpp'
|
|
apply plugin: 'google-test-test-suite'
|
|
apply plugin: 'edu.wpi.first.NativeUtils'
|
|
|
|
apply from: "${rootDir}/shared/config.gradle"
|
|
apply from: "${rootDir}/shared/javacommon.gradle"
|
|
|
|
wpilibTools.deps.wpilibVersion = wpi.versions.wpilibVersion.get()
|
|
|
|
def nativeConfigName = 'wpilibNatives'
|
|
def nativeConfig = configurations.create(nativeConfigName)
|
|
|
|
def nativeTasks = wpilibTools.createExtractionTasks {
|
|
configurationName = nativeConfigName
|
|
}
|
|
|
|
nativeTasks.addToSourceSetResources(sourceSets.main)
|
|
|
|
nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpimath")
|
|
nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpinet")
|
|
nativeConfig.dependencies.add wpilibTools.deps.wpilib("wpiutil")
|
|
nativeConfig.dependencies.add wpilibTools.deps.wpilib("ntcore")
|
|
nativeConfig.dependencies.add wpilibTools.deps.wpilib("cscore")
|
|
nativeConfig.dependencies.add wpilibTools.deps.wpilib("apriltag")
|
|
nativeConfig.dependencies.add wpilibTools.deps.wpilib("hal")
|
|
nativeConfig.dependencies.add wpilibTools.deps.wpilibOpenCv("frc" + wpi.frcYear.get(), wpi.versions.opencvVersion.get())
|
|
|
|
// Windows specific functionality to export all symbols from a binary automatically
|
|
nativeUtils {
|
|
exportsConfigs {
|
|
"${nativeName}" {}
|
|
}
|
|
}
|
|
|
|
model {
|
|
components {
|
|
"${nativeName}"(NativeLibrarySpec) {
|
|
sources {
|
|
cpp {
|
|
source {
|
|
srcDirs 'src/main/native/cpp', "$buildDir/generated/source/proto/main/cpp"
|
|
include '**/*.cpp', '**/*.cc'
|
|
}
|
|
exportedHeaders {
|
|
srcDirs 'src/main/native/include', "$buildDir/generated/source/proto/main/cpp"
|
|
if (project.hasProperty('generatedHeaders')) {
|
|
srcDir generatedHeaders
|
|
}
|
|
include "**/*.h"
|
|
}
|
|
}
|
|
}
|
|
|
|
binaries.all {
|
|
it.tasks.withType(CppCompile) {
|
|
it.dependsOn generateProto
|
|
}
|
|
if(project.hasProperty('includePhotonTargeting')) {
|
|
lib project: ':photon-targeting', library: 'photontargeting', linkage: 'shared'
|
|
}
|
|
}
|
|
|
|
nativeUtils.useRequiredLibrary(it, "wpilib_shared")
|
|
nativeUtils.useRequiredLibrary(it, "apriltag_shared")
|
|
nativeUtils.useRequiredLibrary(it, "opencv_shared")
|
|
}
|
|
}
|
|
testSuites {
|
|
"${nativeName}Test"(GoogleTestTestSuiteSpec) {
|
|
for(NativeComponentSpec c : $.components) {
|
|
if (c.name == nativeName) {
|
|
testing c
|
|
break
|
|
}
|
|
}
|
|
sources {
|
|
cpp {
|
|
source {
|
|
srcDirs 'src/test/native/cpp'
|
|
include '**/*.cpp'
|
|
}
|
|
exportedHeaders {
|
|
srcDirs 'src/test/native/include', "$buildDir/generated/source/proto/main/cpp"
|
|
}
|
|
}
|
|
}
|
|
|
|
binaries.all {
|
|
it.tasks.withType(CppCompile) {
|
|
it.dependsOn generateProto
|
|
}
|
|
if(project.hasProperty('includePhotonTargeting')) {
|
|
lib project: ':photon-targeting', library: 'photontargeting', linkage: 'shared'
|
|
}
|
|
}
|
|
|
|
nativeUtils.useRequiredLibrary(it, "cscore_shared")
|
|
nativeUtils.useRequiredLibrary(it, "cameraserver_shared")
|
|
nativeUtils.useRequiredLibrary(it, "wpilib_executable_shared")
|
|
nativeUtils.useRequiredLibrary(it, "googletest_static")
|
|
nativeUtils.useRequiredLibrary(it, "apriltag_shared")
|
|
nativeUtils.useRequiredLibrary(it, "opencv_shared")
|
|
}
|
|
}
|
|
}
|
|
|
|
apply from: "${rootDir}/shared/javacpp/publish.gradle"
|