Skip to content

Commit

Permalink
gih
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm001 committed Dec 24, 2023
1 parent 70b732c commit dd8b650
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
id "edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin" version "2020.2"
id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-4"
id 'edu.wpi.first.WpilibTools' version '1.3.0'
id 'edu.wpi.first.GradleJni' version '1.1.0'
}

allprojects {
Expand Down
52 changes: 52 additions & 0 deletions photon-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,55 @@ task writeCurrentVersion {
build.dependsOn writeCurrentVersion

apply from: "${rootDir}/shared/javacpp/setupBuild.gradle"

apply plugin: 'edu.wpi.first.GradleJni'
model {
components {
"${nativeName}JNI"(JniNativeLibrarySpec) {
baseName = nativeName + 'jni'

enableCheckTask !project.hasProperty('skipJniCheck')
javaCompileTasks << compileJava
jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.roborio)
jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.linuxarm32)
jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.linuxarm64)

sources {
cpp {
source {
srcDirs 'src/main/native/cpp'
if (project.hasProperty('generatedSources')) {
srcDir generatedSources
}
include '**/jni/**/*.cpp'
}
exportedHeaders {
srcDir 'src/main/native/include'
if (project.hasProperty('generatedHeaders')) {
srcDir generatedHeaders
}
include '**/*.h'
}
}
}

binaries.all {
if (it instanceof StaticLibraryBinarySpec) {
it.buildable = false
return
}
lib library: "${nativeName}", linkage: 'shared'
if (!project.hasProperty('noWpiutil')) {
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
}
if (project.hasProperty('jniSplitSetup')) {
jniSplitSetup(it)
}
}

if(project.hasProperty("jni_native_libs")) jni_native_libs.each { name ->
nativeUtils.useRequiredLibrary(it, name)
}
}
}
}

0 comments on commit dd8b650

Please sign in to comment.