mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
122 lines
4.5 KiB
Groovy
122 lines
4.5 KiB
Groovy
import org.gradle.internal.os.OperatingSystem
|
|
|
|
if (project.hasProperty('onlylinuxathena')) {
|
|
return;
|
|
}
|
|
|
|
description = "NetworkTables Viewer"
|
|
|
|
apply plugin: 'cpp'
|
|
apply plugin: 'visual-studio'
|
|
apply plugin: 'edu.wpi.first.NativeUtils'
|
|
|
|
if (OperatingSystem.current().isWindows()) {
|
|
apply plugin: 'windows-resources'
|
|
}
|
|
|
|
ext {
|
|
nativeName = 'outlineviewer'
|
|
}
|
|
|
|
apply from: "${rootDir}/shared/resources.gradle"
|
|
apply from: "${rootDir}/shared/config.gradle"
|
|
|
|
def wpilibVersionFileInput = file("src/main/generate/WPILibVersion.cpp.in")
|
|
def wpilibVersionFileOutput = file("$buildDir/generated/main/cpp/WPILibVersion.cpp")
|
|
|
|
task generateCppVersion() {
|
|
description = 'Generates the wpilib version class'
|
|
group = 'WPILib'
|
|
|
|
outputs.file wpilibVersionFileOutput
|
|
inputs.file wpilibVersionFileInput
|
|
|
|
if (wpilibVersioning.releaseMode) {
|
|
outputs.upToDateWhen { false }
|
|
}
|
|
|
|
// We follow a simple set of checks to determine whether we should generate a new version file:
|
|
// 1. If the release type is not development, we generate a new version file
|
|
// 2. If there is no generated version number, we generate a new version file
|
|
// 3. If there is a generated build number, and the release type is development, then we will
|
|
// only generate if the publish task is run.
|
|
doLast {
|
|
def version = wpilibVersioning.version.get()
|
|
println "Writing version ${version} to $wpilibVersionFileOutput"
|
|
|
|
if (wpilibVersionFileOutput.exists()) {
|
|
wpilibVersionFileOutput.delete()
|
|
}
|
|
def read = wpilibVersionFileInput.text.replace('${wpilib_version}', version)
|
|
wpilibVersionFileOutput.write(read)
|
|
}
|
|
}
|
|
|
|
gradle.taskGraph.addTaskExecutionGraphListener { graph ->
|
|
def willPublish = graph.hasTask(publish)
|
|
if (willPublish) {
|
|
generateCppVersion.outputs.upToDateWhen { false }
|
|
}
|
|
}
|
|
|
|
def generateTask = createGenerateResourcesTask('main', 'OV', 'ov', project)
|
|
|
|
project(':').libraryBuild.dependsOn build
|
|
tasks.withType(CppCompile) {
|
|
dependsOn generateTask
|
|
dependsOn generateCppVersion
|
|
}
|
|
|
|
model {
|
|
components {
|
|
// By default, a development executable will be generated. This is to help the case of
|
|
// testing specific functionality of the library.
|
|
"${nativeName}"(NativeExecutableSpec) {
|
|
baseName = 'outlineviewer'
|
|
sources {
|
|
cpp {
|
|
source {
|
|
srcDirs 'src/main/native/cpp', "$buildDir/generated/main/cpp"
|
|
include '**/*.cpp'
|
|
}
|
|
exportedHeaders {
|
|
srcDirs 'src/main/native/include'
|
|
}
|
|
}
|
|
if (OperatingSystem.current().isWindows()) {
|
|
rc.source {
|
|
srcDirs 'src/main/native/win'
|
|
include '*.rc'
|
|
}
|
|
}
|
|
}
|
|
binaries.all {
|
|
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
|
|
it.buildable = false
|
|
return
|
|
}
|
|
lib project: ':glass', library: 'glassnt', linkage: 'static'
|
|
lib project: ':glass', library: 'glass', linkage: 'static'
|
|
project(':ntcore').addNtcoreDependency(it, 'static')
|
|
lib project: ':wpinet', library: 'wpinet', linkage: 'static'
|
|
lib project: ':wpiutil', library: 'wpiutil', linkage: 'static'
|
|
lib project: ':wpigui', library: 'wpigui', linkage: 'static'
|
|
lib project: ':fieldImages', library: 'fieldImages', linkage: 'static'
|
|
lib project: ':thirdparty:imgui_suite', library: 'imguiSuite', linkage: 'static'
|
|
if (it.targetPlatform.operatingSystem.isWindows()) {
|
|
it.linker.args << 'Gdi32.lib' << 'Shell32.lib' << 'd3d11.lib' << 'd3dcompiler.lib'
|
|
} else if (it.targetPlatform.operatingSystem.isMacOsX()) {
|
|
it.linker.args << '-framework' << 'Metal' << '-framework' << 'MetalKit' << '-framework' << 'Cocoa' << '-framework' << 'IOKit' << '-framework' << 'CoreFoundation' << '-framework' << 'CoreVideo' << '-framework' << 'QuartzCore'
|
|
} else {
|
|
it.linker.args << '-lX11'
|
|
if (it.targetPlatform.name.startsWith('linuxarm')) {
|
|
it.linker.args << '-lGL'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
apply from: 'publish.gradle'
|