| apply from: "${rootDir}/shared/resources.gradle" |
| |
| ext { |
| nativeName = 'wpiutil' |
| devMain = 'edu.wpi.first.wpiutil.DevMain' |
| def generateTask = createGenerateResourcesTask('main', 'WPI', 'wpi', project) |
| extraSetup = { |
| it.tasks.withType(CppCompile) { |
| dependsOn generateTask |
| } |
| it.sources { |
| libuvCpp(CppSourceSet) { |
| source { |
| srcDirs 'src/main/native/libuv' |
| include '*.cpp' |
| } |
| exportedHeaders { |
| srcDirs 'src/main/native/include', 'src/main/native/include/uv-private', 'src/main/native/libuv' |
| } |
| } |
| resourcesCpp(CppSourceSet) { |
| source { |
| srcDirs "$buildDir/generated/main/cpp", "$rootDir/shared/singlelib" |
| include '*.cpp' |
| } |
| exportedHeaders { |
| srcDirs 'src/main/native/include' |
| } |
| } |
| } |
| if (it.targetPlatform.operatingSystem.name != 'windows') { |
| it.cppCompiler.define '_GNU_SOURCE' |
| it.sources { |
| libuvUnixCpp(CppSourceSet) { |
| source { |
| srcDirs 'src/main/native/libuv/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', |
| 'signal.cpp', |
| 'stream.cpp', |
| 'tcp.cpp', |
| 'thread.cpp', |
| 'timer.cpp', |
| 'tty.cpp', |
| 'udp.cpp', |
| ] |
| } |
| exportedHeaders { |
| srcDirs 'src/main/native/include', 'src/main/native/include/uv-private', 'src/main/native/libuv' |
| } |
| } |
| } |
| } |
| if (it.targetPlatform.operatingSystem.name == 'windows') { |
| if (it in SharedLibraryBinarySpec) { |
| it.cppCompiler.define 'BUILDING_UV_SHARED' |
| } |
| it.sources { |
| libuvWindowsCpp(CppSourceSet) { |
| source { |
| srcDirs 'src/main/native/libuv/win' |
| include '*.cpp' |
| } |
| exportedHeaders { |
| srcDirs 'src/main/native/include', 'src/main/native/include/uv-private', 'src/main/native/libuv' |
| } |
| } |
| } |
| } else if (it.targetPlatform.operatingSystem.name == 'osx') { |
| it.sources { |
| libuvMacCpp(CppSourceSet) { |
| source { |
| srcDirs 'src/main/native/libuv/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/include/uv-private', 'src/main/native/libuv' |
| } |
| } |
| } |
| } else { |
| it.sources { |
| libuvLinuxCpp(CppSourceSet) { |
| source { |
| srcDirs 'src/main/native/libuv/unix' |
| includes = [ |
| 'linux-core.cpp', |
| 'linux-inotify.cpp', |
| 'linux-syscalls.cpp', |
| 'procfs-exepath.cpp', |
| 'proctitle.cpp', |
| 'sysinfo-loadavg.cpp', |
| 'sysinfo-memory.cpp', |
| ] |
| } |
| exportedHeaders { |
| srcDirs 'src/main/native/include', 'src/main/native/include/uv-private', 'src/main/native/libuv' |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| 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/javacpp/setupBuild.gradle" |
| |
| model { |
| // Exports config is a utility to enable exporting all symbols in a C++ library on windows to a DLL. |
| // This removes the need for DllExport on a library. However, the gradle C++ builder has a bug |
| // where some extra symbols are added that cannot be resolved at link time. This configuration |
| // lets you specify specific symbols to exlude from exporting. |
| exportsConfigs { |
| wpiutil(ExportsConfig) { |
| x86ExcludeSymbols = ['_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure', |
| '_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure', |
| '_TI5?AVfailure', '_CT??_R0?AVout_of_range', '_CTA3?AVout_of_range', |
| '_TI3?AVout_of_range', '_CT??_R0?AVbad_cast'] |
| x64ExcludeSymbols = ['_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure', |
| '_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure', |
| '_TI5?AVfailure', '_CT??_R0?AVout_of_range', '_CTA3?AVout_of_range', |
| '_TI3?AVout_of_range', '_CT??_R0?AVbad_cast'] |
| } |
| } |
| components { |
| examplesMap.each { key, value -> |
| "${key}"(NativeExecutableSpec) { |
| targetBuildTypes 'debug' |
| binaries.all { |
| lib library: 'wpiutil', linkage: 'shared' |
| } |
| sources { |
| cpp { |
| source { |
| srcDirs 'examples/' + "${key}" |
| include '**/*.cpp' |
| } |
| } |
| } |
| } |
| } |
| netconsoleServer(NativeExecutableSpec) { |
| targetBuildTypes 'release' |
| sources { |
| cpp { |
| source { |
| srcDirs = ['src/netconsoleServer/native/cpp'] |
| includes = ['**/*.cpp'] |
| } |
| } |
| } |
| binaries.all { binary -> |
| lib project: ':wpiutil', library: 'wpiutil', linkage: 'static' |
| if (binary.targetPlatform.operatingSystem.isLinux()) { |
| linker.args "-lutil" |
| } |
| } |
| } |
| netconsoleTee(NativeExecutableSpec) { |
| targetBuildTypes 'release' |
| sources { |
| cpp { |
| source { |
| srcDirs = ['src/netconsoleTee/native/cpp'] |
| includes = ['**/*.cpp'] |
| } |
| } |
| } |
| binaries.all { binary -> |
| lib project: ':wpiutil', library: 'wpiutil', linkage: 'static' |
| } |
| } |
| } |
| } |