131 lines
3.7 KiB
Groovy
131 lines
3.7 KiB
Groovy
plugins {
|
|
id 'cpp'
|
|
id 'java'
|
|
id 'google-test'
|
|
id 'edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin' version '2020.2'
|
|
id 'edu.wpi.first.NativeUtils' version '2024.0.0'
|
|
id 'edu.wpi.first.GradleJni' version '1.0.0'
|
|
id 'edu.wpi.first.GradleVsCode' version '1.3.0'
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
if (project.hasProperty('releaseMode')) {
|
|
wpilibRepositories.addAllReleaseRepositories(project)
|
|
} else {
|
|
wpilibRepositories.addAllDevelopmentRepositories(project)
|
|
}
|
|
|
|
// Apply C++ configuration
|
|
apply from: 'config.gradle'
|
|
|
|
// Apply Java configuration
|
|
dependencies {
|
|
implementation 'edu.wpi.first.cscore:cscore-java:2023.+'
|
|
implementation 'edu.wpi.first.cameraserver:cameraserver-java:2023.+'
|
|
implementation 'edu.wpi.first.ntcore:ntcore-java:2023.+'
|
|
implementation 'edu.wpi.first.wpilibj:wpilibj-java:2023.+'
|
|
implementation 'edu.wpi.first.wpiutil:wpiutil-java:2023.+'
|
|
implementation 'edu.wpi.first.wpimath:wpimath-java:2023.+'
|
|
implementation 'edu.wpi.first.wpiunits:wpiunits-java:2023.+'
|
|
implementation 'edu.wpi.first.hal:hal-java:2023.+'
|
|
implementation "org.ejml:ejml-simple:0.41"
|
|
implementation "com.fasterxml.jackson.core:jackson-annotations:2.12.4"
|
|
implementation "com.fasterxml.jackson.core:jackson-core:2.12.4"
|
|
implementation "com.fasterxml.jackson.core:jackson-databind:2.12.4"
|
|
implementation 'edu.wpi.first.thirdparty.frc2023.opencv:opencv-java:4.6.0-2'
|
|
}
|
|
|
|
// Set up exports properly
|
|
nativeUtils {
|
|
exportsConfigs {
|
|
// Main library is just default empty. This will export everything
|
|
Vendor {
|
|
}
|
|
}
|
|
privateExportsConfigs {
|
|
// Only export explicit symbols from driver library
|
|
VendorDriver {
|
|
exportsFile = project.file("src/main/driver/symbols.txt")
|
|
}
|
|
}
|
|
}
|
|
|
|
model {
|
|
components {
|
|
Vendor(NativeLibrarySpec) {
|
|
sources {
|
|
cpp {
|
|
source {
|
|
srcDirs 'src/main/native/cpp'
|
|
include '**/*.cpp'
|
|
}
|
|
exportedHeaders {
|
|
srcDirs 'src/main/native/include'
|
|
}
|
|
}
|
|
}
|
|
binaries.all {
|
|
lib library: 'VendorDriver', linkage: 'shared'
|
|
}
|
|
nativeUtils.useRequiredLibrary(it, 'wpilib_shared')
|
|
}
|
|
|
|
VendorDriver(JniNativeLibrarySpec) {
|
|
enableCheckTask true
|
|
javaCompileTasks << compileJava
|
|
jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.roborio)
|
|
// Leave these for future proofing
|
|
jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.linuxarm32)
|
|
jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.linuxarm64)
|
|
sources {
|
|
cpp {
|
|
source {
|
|
srcDirs 'src/main/driver/cpp'
|
|
include '**/*.cpp'
|
|
}
|
|
exportedHeaders {
|
|
srcDirs 'src/main/driver/include'
|
|
}
|
|
}
|
|
}
|
|
|
|
nativeUtils.useRequiredLibrary(it, "driver_shared")
|
|
}
|
|
}
|
|
testSuites {
|
|
VendorTest {
|
|
sources.cpp {
|
|
source {
|
|
srcDir 'src/test/native/cpp'
|
|
include '**/*.cpp'
|
|
}
|
|
}
|
|
|
|
binaries.all {
|
|
lib library: 'VendorDriver', linkage: 'shared'
|
|
}
|
|
|
|
nativeUtils.useRequiredLibrary(it, "wpilib_executable_shared", "googletest_static")
|
|
}
|
|
|
|
VendorDriverTest {
|
|
sources.cpp {
|
|
source {
|
|
srcDir 'src/test/driver/cpp'
|
|
include '**/*.cpp'
|
|
}
|
|
}
|
|
|
|
nativeUtils.useRequiredLibrary(it, "wpilib_executable_shared", "googletest_static")
|
|
}
|
|
}
|
|
}
|
|
|
|
apply from: 'publish.gradle'
|
|
|
|
wrapper {
|
|
gradleVersion '8.3'
|
|
}
|