mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Originally started with just swerve, but expanded to diff and mecanum (docs only) for parity across the drivetrains. Return value checks are applied when possible to make migration easier and to error loudly if people forget. --------- Co-authored-by: Joseph Eng <91924258+KangarooKoala@users.noreply.github.com>
125 lines
3.2 KiB
Groovy
125 lines
3.2 KiB
Groovy
ext {
|
|
useJava = true
|
|
useCpp = true
|
|
baseId = 'wpimath'
|
|
groupId = 'org.wpilib.wpimath'
|
|
|
|
nativeName = 'wpimath'
|
|
devMain = 'org.wpilib.math.DevMain'
|
|
|
|
splitSetup = {
|
|
it.sources {
|
|
sleipnirCpp(CppSourceSet) {
|
|
source {
|
|
srcDirs 'src/main/native/thirdparty/sleipnir/src'
|
|
include '**/*.cpp'
|
|
}
|
|
exportedHeaders {
|
|
srcDirs 'src/main/native/thirdparty/eigen/include',
|
|
'src/main/native/thirdparty/fmt/include',
|
|
'src/main/native/thirdparty/sleipnir/include',
|
|
'src/main/native/thirdparty/sleipnir/src'
|
|
}
|
|
}
|
|
nanopbCpp(CppSourceSet) {
|
|
source {
|
|
srcDirs 'src/generated/main/native/cpp'
|
|
include '**/*.cpp'
|
|
}
|
|
exportedHeaders {
|
|
srcDirs 'src/generated/main/native/cpp'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
apply from: "${rootDir}/shared/jni/setupBuild.gradle"
|
|
|
|
cppHeadersZip {
|
|
from('src/main/native/thirdparty/eigen/include') {
|
|
into '/'
|
|
}
|
|
from('src/main/native/thirdparty/gcem/include') {
|
|
into '/'
|
|
}
|
|
from("src/generated/main/native/cpp/wpimath/protobuf") {
|
|
into '/wpimath/protobuf'
|
|
include '**/*.h'
|
|
}
|
|
from('src/main/native/thirdparty/sleipnir/include') {
|
|
into '/'
|
|
}
|
|
}
|
|
|
|
cppSourcesZip {
|
|
from('src/main/native/thirdparty/sleipnir/src') {
|
|
into '/'
|
|
}
|
|
}
|
|
|
|
model {
|
|
components {
|
|
all {
|
|
it.sources.each {
|
|
it.exportedHeaders {
|
|
srcDirs 'src/main/native/include',
|
|
'src/main/native/thirdparty/eigen/include',
|
|
'src/main/native/thirdparty/gcem/include',
|
|
'src/main/native/thirdparty/sleipnir/include',
|
|
'src/generated/main/native/cpp'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
binaries {
|
|
all {
|
|
it.cppCompiler.define 'SLEIPNIR_EXPORTS'
|
|
}
|
|
}
|
|
}
|
|
|
|
nativeUtils.exportsConfigs {
|
|
wpimath {
|
|
objectFilterClosure = { file ->
|
|
return file.name.endsWith('.pb.obj') || file.name.endsWith('.npb.obj')
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
annotationProcessor libs.avaje.jsonb.generator
|
|
api project(":wpiunits")
|
|
api libs.avaje.jsonb
|
|
api libs.bundles.ejml
|
|
api libs.quickbuf.runtime
|
|
implementation project(":wpiannotations")
|
|
annotationProcessor project(':javacPlugin')
|
|
testAnnotationProcessor project(':javacPlugin')
|
|
}
|
|
|
|
sourceSets.main.java.srcDir "${projectDir}/src/generated/main/java"
|
|
sourceSets.main.resources.srcDir "${projectDir}/src/main/proto"
|
|
|
|
task unitsHeaders(type: Zip) {
|
|
destinationDirectory = file("$buildDir/outputs")
|
|
archiveBaseName = zipBaseName
|
|
archiveClassifier = "units"
|
|
|
|
from(licenseFile) {
|
|
into '/'
|
|
}
|
|
|
|
ext.includeDirs = [
|
|
project.file('src/main/native/include/units')
|
|
]
|
|
|
|
ext.includeDirs.each {
|
|
from(it) {
|
|
into '/units'
|
|
}
|
|
}
|
|
}
|
|
|
|
addTaskToCopyAllOutputs(unitsHeaders)
|