mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Currently if using a separate compiler prefix, it would still get published to the arm classifier. This modifies so a classifier suffix can be used to disambiguate arm from armhf.
120 lines
3.3 KiB
Groovy
120 lines
3.3 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("wpiutilZip", Zip) {
|
|
description = 'Creates platform-specific zip of the desktop wpiutil libraries.'
|
|
group = 'WPILib'
|
|
destinationDir = project.buildDir
|
|
baseName = 'wpiutil'
|
|
if (project.isArm && project.hasProperty('compilerPrefix')
|
|
&& project.hasProperty('armSuffix')) {
|
|
classifier = "${project.buildPlatform}${project.armSuffix}"
|
|
} else {
|
|
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)
|
|
}
|
|
from(new File(binary.sharedLibraryFile.absolutePath + ".debug")) {
|
|
into getPlatformPath(binary)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
project.build.dependsOn project.wpiutilZip
|
|
|
|
project.debugStripSetup()
|
|
|
|
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'
|
|
}
|
|
}
|