mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
102 lines
3.5 KiB
Groovy
102 lines
3.5 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'
|
|
include '**/*.cpp'
|
|
}
|
|
exportedHeaders {
|
|
srcDirs 'src/main/native/include'
|
|
if (project.hasProperty('generatedHeaders')) {
|
|
srcDir generatedHeaders
|
|
}
|
|
include "**/*.h"
|
|
}
|
|
}
|
|
}
|
|
|
|
if(project.hasProperty('includePhotonTargeting')) {
|
|
binaries.all {
|
|
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', 'src/main/native/cpp'
|
|
}
|
|
}
|
|
}
|
|
|
|
if(project.hasProperty('includePhotonTargeting')) {
|
|
binaries.all {
|
|
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"
|