mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
114 lines
3.0 KiB
Groovy
114 lines
3.0 KiB
Groovy
def wpiutilSetupModel = { project ->
|
|
project.model {
|
|
components {
|
|
wpiutil(NativeLibrarySpec) {
|
|
if (project.isArm) {
|
|
targetPlatform 'arm'
|
|
} else {
|
|
targetPlatform 'x86'
|
|
targetPlatform 'x64'
|
|
}
|
|
setupDefines(project, binaries)
|
|
|
|
sources {
|
|
cpp {
|
|
source {
|
|
srcDirs = ["${rootDir}/wpiutil/src"]
|
|
includes = ['**/*.cpp']
|
|
}
|
|
exportedHeaders {
|
|
srcDirs = ["${rootDir}/wpiutil/include"]
|
|
includes = ['**/*.h']
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
def wpiutilZipTask = { project ->
|
|
project.ext.wpiutilZip = project.tasks.create("${project.isArm ? 'arm' : 'native'}WpiutilZip", Zip) {
|
|
description = 'Creates platform-specific zip of the desktop wpiutil libraries.'
|
|
group = 'WPILib'
|
|
destinationDir = project.buildDir
|
|
baseName = 'wpiutil'
|
|
classifier = "${project.buildPlatform}"
|
|
duplicatesStrategy = 'exclude'
|
|
|
|
from(file('wpiutil/include')) {
|
|
into 'include'
|
|
}
|
|
|
|
project.model {
|
|
binaries {
|
|
withType(StaticLibraryBinarySpec) { binary ->
|
|
from(binary.staticLibraryFile) {
|
|
into getPlatformPath(binary)
|
|
}
|
|
}
|
|
withType(SharedLibraryBinarySpec) { binary ->
|
|
from(binary.sharedLibraryFile) {
|
|
into getPlatformPath(binary)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
project.build.dependsOn project.wpiutilZip
|
|
|
|
def releaseTasks = [project.wpiutilZip]
|
|
|
|
project.releaseSetup(releaseTasks)
|
|
|
|
project.tasks.whenTaskAdded { task ->
|
|
def name = task.name.toLowerCase()
|
|
if (name.contains("wpiutilsharedlibrary") || name.contains("wpiutilstaticlibrary") || name.contains("wpiutiltest")) {
|
|
project.wpiutilZip.dependsOn task
|
|
}
|
|
}
|
|
}
|
|
|
|
if (buildArm) {
|
|
project(':arm:wpiutil') {
|
|
apply plugin: 'cpp'
|
|
|
|
apply from: "${rootDir}/toolchains/arm.gradle"
|
|
|
|
wpiutilSetupModel(project)
|
|
wpiutilZipTask(project)
|
|
}
|
|
}
|
|
|
|
project(':native:wpiutil') {
|
|
apply plugin: 'cpp'
|
|
|
|
apply from: "${rootDir}/toolchains/native.gradle"
|
|
|
|
if (!project.hasProperty("withoutTests")) {
|
|
apply from: "${rootDir}/wpiutil/unittest/unittest.gradle"
|
|
}
|
|
|
|
wpiutilSetupModel(project)
|
|
wpiutilZipTask(project)
|
|
}
|
|
|
|
task wpiutilSourceZip(type: Zip) {
|
|
description = 'Creates a sources-zip of the wpiutil source files'
|
|
group = 'WPILib'
|
|
destinationDir = project.buildDir
|
|
baseName = 'wpiutil'
|
|
classifier = "sources"
|
|
duplicatesStrategy = 'exclude'
|
|
|
|
from('wpiutil/src') {
|
|
into 'src'
|
|
}
|
|
|
|
from('wpiutil/include') {
|
|
into 'include'
|
|
}
|
|
}
|