mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-06 03:31:43 +00:00
Update build setup for raspbian and debug binaries (#1384)
- Build both debug and release binaries - Append "d" to debug libraries in the style of opencv - Split shared and static classifiers - Add raspbian support
This commit is contained in:
committed by
Peter Johnson
parent
8ff81f5a2a
commit
a8aacd3657
@@ -33,9 +33,9 @@ apply from: "${rootDir}/shared/googletest.gradle"
|
||||
if (project.hasProperty('niLibraries')) {
|
||||
ext {
|
||||
chipObjectComponents = ["$nativeName".toString(), "${nativeName}Dev".toString(), "${nativeName}Base".toString(),
|
||||
"${nativeName}JNI".toString(), "${nativeName}Test".toString()]
|
||||
"${nativeName}JNI".toString(), "${nativeName}JNIShared".toString(), "${nativeName}Test".toString()]
|
||||
netCommComponents = ["$nativeName".toString(), "${nativeName}Dev".toString(), "${nativeName}Base".toString(),
|
||||
"${nativeName}JNI".toString(), "${nativeName}Test".toString()]
|
||||
"${nativeName}JNI".toString(), "${nativeName}JNIShared".toString(), "${nativeName}Test".toString()]
|
||||
useNiJava = true
|
||||
}
|
||||
|
||||
@@ -44,17 +44,16 @@ if (project.hasProperty('niLibraries')) {
|
||||
|
||||
model {
|
||||
components {
|
||||
"${nativeName}Base"(JniNativeLibrarySpec) {
|
||||
"${nativeName}Base"(NativeLibrarySpec) {
|
||||
if (project.hasProperty('setBaseName')) {
|
||||
baseName = setBaseName
|
||||
}
|
||||
javaCompileTasks << compileJava
|
||||
jniCrossCompileOptions << JniCrossCompileOptions('athena')
|
||||
sources {
|
||||
cpp {
|
||||
source {
|
||||
srcDirs 'src/main/native/cpp'
|
||||
include '**/*.cpp'
|
||||
exclude '**/jni/*.cpp'
|
||||
}
|
||||
exportedHeaders {
|
||||
srcDir 'src/main/native/include'
|
||||
@@ -75,13 +74,10 @@ model {
|
||||
}
|
||||
}
|
||||
}
|
||||
"${nativeName}"(JniNativeLibrarySpec) {
|
||||
"${nativeName}"(NativeLibrarySpec) {
|
||||
if (project.hasProperty('setBaseName')) {
|
||||
baseName = setBaseName
|
||||
}
|
||||
enableCheckTask true
|
||||
javaCompileTasks << compileJava
|
||||
jniCrossCompileOptions << JniCrossCompileOptions('athena')
|
||||
sources {
|
||||
cpp {
|
||||
source {
|
||||
@@ -99,21 +95,23 @@ model {
|
||||
binaries.all {
|
||||
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
|
||||
}
|
||||
appendDebugPathToBinaries(binaries)
|
||||
}
|
||||
"${nativeName}JNI"(JniNativeLibrarySpec) {
|
||||
"${nativeName}JNIShared"(JniNativeLibrarySpec) {
|
||||
if (project.hasProperty('setBaseName')) {
|
||||
baseName = setBaseName
|
||||
baseName = setBaseName + 'jni'
|
||||
} else {
|
||||
baseName = nativeName
|
||||
baseName = nativeName + 'jni'
|
||||
}
|
||||
enableCheckTask true
|
||||
javaCompileTasks << compileJava
|
||||
jniCrossCompileOptions << JniCrossCompileOptions('athena')
|
||||
jniCrossCompileOptions << JniCrossCompileOptions('raspbian')
|
||||
sources {
|
||||
cpp {
|
||||
source {
|
||||
srcDirs "${rootDir}/shared/singlelib"
|
||||
include '**/*.cpp'
|
||||
srcDirs 'src/main/native/cpp'
|
||||
include '**/jni/*.cpp'
|
||||
}
|
||||
exportedHeaders {
|
||||
srcDir 'src/main/native/include'
|
||||
@@ -128,12 +126,53 @@ model {
|
||||
it.buildable = false
|
||||
return
|
||||
}
|
||||
lib library: "${nativeName}", linkage: 'shared'
|
||||
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
|
||||
if (project.hasProperty('jniSplitSetup')) {
|
||||
jniSplitSetup(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
"${nativeName}JNI"(JniNativeLibrarySpec) {
|
||||
if (project.hasProperty('setBaseName')) {
|
||||
baseName = setBaseName + 'jni'
|
||||
} else {
|
||||
baseName = nativeName + 'jni'
|
||||
}
|
||||
enableCheckTask true
|
||||
javaCompileTasks << compileJava
|
||||
jniCrossCompileOptions << JniCrossCompileOptions('athena')
|
||||
jniCrossCompileOptions << JniCrossCompileOptions('raspbian')
|
||||
sources {
|
||||
cpp {
|
||||
source {
|
||||
srcDirs 'src/main/native/cpp'
|
||||
include '**/jni/*.cpp'
|
||||
}
|
||||
exportedHeaders {
|
||||
srcDir 'src/main/native/include'
|
||||
if (project.hasProperty('generatedHeaders')) {
|
||||
srcDir generatedHeaders
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
binaries.all {
|
||||
if (it instanceof StaticLibraryBinarySpec) {
|
||||
it.buildable = false
|
||||
return
|
||||
}
|
||||
lib library: "${nativeName}", linkage: 'static'
|
||||
lib project: ':wpiutil', library: 'wpiutil', linkage: 'static'
|
||||
if (project.hasProperty('jniSplitSetup')) {
|
||||
jniSplitSetup(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
// By default, a development executable will be generated. This is to help the case of
|
||||
// testing specific functionality of the library.
|
||||
"${nativeName}Dev"(NativeExecutableSpec) {
|
||||
targetBuildTypes 'debug'
|
||||
sources {
|
||||
cpp {
|
||||
|
||||
@@ -151,6 +190,7 @@ model {
|
||||
}
|
||||
binaries.all {
|
||||
lib library: nativeName, linkage: 'shared'
|
||||
lib library: "${nativeName}JNIShared", linkage: 'shared'
|
||||
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
|
||||
}
|
||||
}
|
||||
@@ -181,7 +221,7 @@ model {
|
||||
}
|
||||
binaries {
|
||||
withType(GoogleTestTestSuiteBinarySpec) {
|
||||
if (!project.hasProperty('onlyAthena')) {
|
||||
if (!project.hasProperty('onlyAthena') && !project.hasProperty('onlyRaspbian')) {
|
||||
lib library: nativeName, linkage: 'shared'
|
||||
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user