mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[cscore] Limit jnicvstatic exports to only C and JNI symbols (#2565)
Reduces risk even more about accidentally interfering with OpenCV.
This commit is contained in:
@@ -79,7 +79,7 @@ class SingleNativeBuild implements Plugin<Project> {
|
||||
components.each { component ->
|
||||
if (component.name == "${nativeName}Base") {
|
||||
base = (NativeLibrarySpec) component
|
||||
} else if (component.name == "${nativeName}" || component.name == "${nativeName}JNI") {
|
||||
} else if (component.name == "${nativeName}" || component.name == "${nativeName}JNI" || component.name == "${nativeName}JNICvStatic") {
|
||||
subs << component
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ apply from: "${rootDir}/shared/jni/setupBuild.gradle"
|
||||
model {
|
||||
components {
|
||||
cscoreJNICvStatic(JniNativeLibrarySpec) {
|
||||
baseName = 'cscore-jnicvstatic'
|
||||
baseName = 'cscorejnicvstatic'
|
||||
|
||||
enableCheckTask true
|
||||
javaCompileTasks << compileJava
|
||||
@@ -46,6 +46,13 @@ model {
|
||||
}
|
||||
lib library: "${nativeName}", linkage: 'static'
|
||||
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
|
||||
|
||||
if (it.targetPlatform.operatingSystem.linux) {
|
||||
it.linker.args '-Wl,--version-script=' + file('src/main/native/LinuxSymbolScript.txt')
|
||||
} else if (it.targetPlatform.operatingSystem.macOsX) {
|
||||
it.linker.args '-exported_symbols_list'
|
||||
it.linker.args file('src/main/native/MacSymbolScript.txt').toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
4
cscore/src/main/native/LinuxSymbolScript.txt
Normal file
4
cscore/src/main/native/LinuxSymbolScript.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
cscorejnicvstatic {
|
||||
global: CS_*; JNI_*; Java_*; # explicitly list symbols to be exported
|
||||
local: *; # hide everything else
|
||||
};
|
||||
3
cscore/src/main/native/MacSymbolScript.txt
Normal file
3
cscore/src/main/native/MacSymbolScript.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
_CS_*
|
||||
_JNI_*
|
||||
_Java_*
|
||||
Reference in New Issue
Block a user