mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
The symbol exporter in native-utils was updated and stopped exporting the excluded symbols.
278 lines
10 KiB
Groovy
278 lines
10 KiB
Groovy
apply from: "${rootDir}/shared/resources.gradle"
|
|
|
|
ext {
|
|
baseId = 'wpinet'
|
|
groupId = 'edu.wpi.first.net'
|
|
|
|
nativeName = 'wpinet'
|
|
devMain = 'edu.wpi.first.net.DevMain'
|
|
def generateTask = createGenerateResourcesTask('main', 'WPI', 'wpi', project)
|
|
|
|
splitSetup = {
|
|
it.tasks.withType(CppCompile) {
|
|
dependsOn generateTask
|
|
}
|
|
it.sources {
|
|
libuvCpp(CppSourceSet) {
|
|
source {
|
|
srcDirs 'src/main/native/thirdparty/libuv/src'
|
|
include '*.cpp'
|
|
}
|
|
exportedHeaders {
|
|
srcDirs 'src/main/native/include', 'src/main/native/thirdparty/libuv/include', 'src/main/native/thirdparty/libuv/src'
|
|
}
|
|
}
|
|
tcpsocketsCpp(CppSourceSet) {
|
|
source {
|
|
srcDirs 'src/main/native/thirdparty/tcpsockets/cpp'
|
|
include '*.cpp'
|
|
}
|
|
exportedHeaders {
|
|
srcDirs 'src/main/native/include', 'src/main/native/thirdparty/tcpsockets/include'
|
|
}
|
|
}
|
|
resourcesCpp(CppSourceSet) {
|
|
source {
|
|
srcDirs "$buildDir/generated/main/cpp", "$rootDir/shared/singlelib"
|
|
include '*.cpp'
|
|
}
|
|
exportedHeaders {
|
|
srcDirs 'src/main/native/include'
|
|
}
|
|
}
|
|
}
|
|
if (!it.targetPlatform.operatingSystem.isWindows()) {
|
|
it.cppCompiler.define '_GNU_SOURCE'
|
|
it.sources {
|
|
libuvUnixCpp(CppSourceSet) {
|
|
source {
|
|
srcDirs 'src/main/native/thirdparty/libuv/src/unix'
|
|
includes = [
|
|
'async.cpp',
|
|
'core.cpp',
|
|
'dl.cpp',
|
|
'fs.cpp',
|
|
'getaddrinfo.cpp',
|
|
'getnameinfo.cpp',
|
|
'loop-watcher.cpp',
|
|
'loop.cpp',
|
|
'pipe.cpp',
|
|
'poll.cpp',
|
|
'process.cpp',
|
|
'random-devurandom.cpp',
|
|
'random-getentropy.cpp',
|
|
'random-getrandom.cpp',
|
|
'signal.cpp',
|
|
'stream.cpp',
|
|
'tcp.cpp',
|
|
'thread.cpp',
|
|
'timer.cpp',
|
|
'tty.cpp',
|
|
'udp.cpp',
|
|
]
|
|
}
|
|
exportedHeaders {
|
|
srcDirs 'src/main/native/include', 'src/main/native/thirdparty/libuv/include', 'src/main/native/thirdparty/libuv/src'
|
|
}
|
|
}
|
|
wpinetUnixCpp(CppSourceSet) {
|
|
source {
|
|
srcDirs 'src/main/native/unix'
|
|
include '**/*.cpp'
|
|
}
|
|
exportedHeaders {
|
|
srcDirs 'src/main/native/include', 'src/main/native/cpp'
|
|
include '**/*.h'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (it.targetPlatform.operatingSystem.isWindows()) {
|
|
if (it in SharedLibraryBinarySpec) {
|
|
it.cppCompiler.define 'BUILDING_UV_SHARED'
|
|
}
|
|
it.sources {
|
|
libuvWindowsCpp(CppSourceSet) {
|
|
source {
|
|
srcDirs 'src/main/native/thirdparty/libuv/src/win'
|
|
include '*.cpp'
|
|
}
|
|
exportedHeaders {
|
|
srcDirs 'src/main/native/include', 'src/main/native/thirdparty/libuv/include', 'src/main/native/thirdparty/libuv/src'
|
|
}
|
|
}
|
|
wpinetWindowsCpp(CppSourceSet) {
|
|
source {
|
|
srcDirs 'src/main/native/windows'
|
|
include '**/*.cpp'
|
|
}
|
|
exportedHeaders {
|
|
srcDirs 'src/main/native/include', 'src/main/native/cpp'
|
|
include '**/*.h'
|
|
}
|
|
}
|
|
}
|
|
} else if (it.targetPlatform.operatingSystem.isMacOsX()) {
|
|
it.sources {
|
|
libuvMacCpp(CppSourceSet) {
|
|
source {
|
|
srcDirs 'src/main/native/thirdparty/libuv/src/unix'
|
|
includes = [
|
|
'bsd-ifaddrs.cpp',
|
|
'darwin.cpp',
|
|
'darwin-proctitle.cpp',
|
|
'fsevents.cpp',
|
|
'kqueue.cpp',
|
|
'proctitle.cpp'
|
|
]
|
|
}
|
|
exportedHeaders {
|
|
srcDirs 'src/main/native/include', 'src/main/native/thirdparty/libuv/include', 'src/main/native/thirdparty/libuv/src'
|
|
}
|
|
}
|
|
wpinetmacOSCpp(CppSourceSet) {
|
|
source {
|
|
srcDirs 'src/main/native/macOS'
|
|
include '**/*.cpp'
|
|
}
|
|
exportedHeaders {
|
|
srcDirs 'src/main/native/include', 'src/main/native/cpp'
|
|
include '**/*.h'
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
it.sources {
|
|
libuvLinuxCpp(CppSourceSet) {
|
|
source {
|
|
srcDirs 'src/main/native/thirdparty/libuv/src/unix'
|
|
includes = [
|
|
'linux.cpp',
|
|
'procfs-exepath.cpp',
|
|
'proctitle.cpp',
|
|
'random-sysctl-linux.cpp',
|
|
]
|
|
}
|
|
exportedHeaders {
|
|
srcDirs 'src/main/native/include', 'src/main/native/thirdparty/libuv/include', 'src/main/native/thirdparty/libuv/src'
|
|
}
|
|
}
|
|
wpinetLinuxCpp(CppSourceSet) {
|
|
source {
|
|
srcDirs 'src/main/native/linux'
|
|
include '**/*.cpp'
|
|
}
|
|
exportedHeaders {
|
|
srcDirs 'src/main/native/include', 'src/main/native/cpp', 'src/main/native/fmtlib/include'
|
|
include '**/*.h'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
def examplesMap = [:];
|
|
file("$projectDir/examples").list(new FilenameFilter() {
|
|
@Override
|
|
public boolean accept(File current, String name) {
|
|
return new File(current, name).isDirectory();
|
|
}
|
|
}).each {
|
|
examplesMap.put(it, [])
|
|
}
|
|
|
|
apply from: "${rootDir}/shared/jni/setupBuild.gradle"
|
|
|
|
nativeUtils.exportsConfigs {
|
|
wpinet {
|
|
}
|
|
}
|
|
|
|
cppHeadersZip {
|
|
from('src/main/native/thirdparty/libuv/include') {
|
|
into '/'
|
|
}
|
|
from('src/main/native/thirdparty/tcpsockets/include') {
|
|
into '/'
|
|
}
|
|
}
|
|
|
|
model {
|
|
components {
|
|
all {
|
|
it.sources.each {
|
|
it.exportedHeaders {
|
|
srcDirs 'src/main/native/include', 'src/main/native/thirdparty/libuv/include', 'src/main/native/thirdparty/tcpsockets/include', 'src/main/native/thirdparty/libuv/src'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
model {
|
|
components {
|
|
examplesMap.each { key, value ->
|
|
"${key}"(NativeExecutableSpec) {
|
|
targetBuildTypes 'debug'
|
|
binaries.all {
|
|
lib library: 'wpinet', linkage: 'shared'
|
|
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
|
|
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
|
|
nativeUtils.useRequiredLibrary(it, 'ni_link_libraries', 'ni_runtime_libraries')
|
|
}
|
|
}
|
|
sources {
|
|
cpp {
|
|
source {
|
|
srcDirs 'examples/' + "${key}"
|
|
include '**/*.cpp'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
netconsoleServer(NativeExecutableSpec) {
|
|
sources {
|
|
cpp {
|
|
source {
|
|
srcDirs = [
|
|
'src/netconsoleServer/native/cpp'
|
|
]
|
|
includes = ['**/*.cpp']
|
|
}
|
|
}
|
|
}
|
|
binaries.all { binary ->
|
|
lib project: ':wpinet', library: 'wpinet', linkage: 'static'
|
|
lib project: ':wpiutil', library: 'wpiutil', linkage: 'static'
|
|
if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
|
|
nativeUtils.useRequiredLibrary(binary, 'ni_link_libraries', 'ni_runtime_libraries')
|
|
}
|
|
if (binary.targetPlatform.operatingSystem.isLinux()) {
|
|
linker.args "-lutil"
|
|
}
|
|
}
|
|
}
|
|
netconsoleTee(NativeExecutableSpec) {
|
|
sources {
|
|
cpp {
|
|
source {
|
|
srcDirs = [
|
|
'src/netconsoleTee/native/cpp'
|
|
]
|
|
includes = ['**/*.cpp']
|
|
}
|
|
}
|
|
}
|
|
binaries.all { binary ->
|
|
lib project: ':wpinet', library: 'wpinet', linkage: 'static'
|
|
lib project: ':wpiutil', library: 'wpiutil', linkage: 'static'
|
|
if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
|
|
nativeUtils.useRequiredLibrary(binary, 'ni_link_libraries', 'ni_runtime_libraries')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|