mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
* Links HAL shared instead of static, and doesn't include library in jar * Strips shared object files, and includes debug in releases * Zips the HAL libraries into a separate maven artifact * Switches to shared wpiutil * Switches wpilibc to shared * Moves maven artifacts wpilibc now in edu.wpi.first.wpilibc:athena wpilibj now in edu.wpi.first.wpilibj:athena wpilibj jni not in edu.wpi.first.wpilibj:athena-jni hal now in edu.wpi.first.wpilib:hal athena runtime added (hal, ntcore, wpiutil) edu.wpi.first.wpilib:athena-runtime Changes made where wpilibc does NOT include all required artifacts anymore. Dependent on hal, wpiutil and ntcore packages to work correctly. JNI does NOT include all required artifacts anymore. Dependent on hal and wpiutil packages to work correctly.
185 lines
5.2 KiB
Groovy
185 lines
5.2 KiB
Groovy
// There are two hal libraries that are built
|
|
// - desktop which is used by simulation (gcc/msvc)
|
|
// - athena which is used by the roborio (arm)
|
|
|
|
plugins {
|
|
id 'cpp'
|
|
id 'maven-publish'
|
|
}
|
|
|
|
defineWpiUtilProperties()
|
|
|
|
debugStripSetup(project)
|
|
|
|
model {
|
|
components {
|
|
HALAthena(NativeLibrarySpec) {
|
|
targetPlatform 'arm'
|
|
binaries.all {
|
|
tasks.withType(CppCompile) {
|
|
addNiLibraryLinks(linker, targetPlatform)
|
|
addWpiUtilLibraryLinks(it, linker, targetPlatform)
|
|
}
|
|
}
|
|
sources {
|
|
cpp {
|
|
source {
|
|
srcDirs = ["lib/athena", "lib/athena/FRC_FPGA_ChipObject", "lib/shared"]
|
|
includes = ["**/*.cpp"]
|
|
}
|
|
exportedHeaders {
|
|
srcDirs = ["include", "lib/athena/FRC_FPGA_ChipObject", wpiUtilInclude]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// HALSim(NativeLibrarySpec) {
|
|
// binaries.all {
|
|
// if (toolChain in Gcc){
|
|
// cppCompiler.args "-std=c++1y"
|
|
// }
|
|
// }
|
|
//
|
|
// sources {
|
|
// cpp {
|
|
// source {
|
|
// srcDirs = ["lib/sim", "lib/shared"]
|
|
// includes = ["**/*.cpp"]
|
|
// }
|
|
// exportedHeaders {
|
|
// srcDirs = ["include", "lib/sim", "lib/shared"]
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
}
|
|
}
|
|
|
|
task halZip(type: Zip) {
|
|
description = 'Zips the HAL'
|
|
group = 'WPILib'
|
|
baseName = 'hal'
|
|
destinationDir = project.buildDir
|
|
duplicatesStrategy = 'exclude'
|
|
|
|
// Include the shared library file and header files from this project
|
|
model {
|
|
binaries {
|
|
withType(SharedLibraryBinarySpec) { spec ->
|
|
spec.headerDirs.each {
|
|
def normalizedIt = it.toString().replace('/', '\\')
|
|
def normalizedWPIUtil = wpiUtilInclude.toString().replace('/', '\\')
|
|
if (normalizedIt != normalizedWPIUtil) {
|
|
from(it) {
|
|
into 'include'
|
|
// We don't want to include any of the .cpp files that are in some of the header directories
|
|
exclude '**/*.cpp'
|
|
}
|
|
}
|
|
}
|
|
from(spec.sharedLibraryFile) {
|
|
into 'lib'
|
|
}
|
|
from(new File(spec.sharedLibraryFile.absolutePath + ".debug")) {
|
|
into 'lib'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Finally, include all of the shared library objects from the ni directory
|
|
from(project.file('../ni-libraries')) {
|
|
into 'lib'
|
|
exclude 'genlinks'
|
|
exclude 'libwpi.so'
|
|
}
|
|
|
|
// Add the hal static and shared libraries as a dependency
|
|
project(':hal').tasks.whenTaskAdded { task ->
|
|
if (task.name.toLowerCase() == 'halathenastaticlibrary' || task.name.toLowerCase() == 'halathenasharedlibrary') {
|
|
halZip.dependsOn task
|
|
}
|
|
}
|
|
}
|
|
|
|
task athenaRuntimeZip(type: Zip) {
|
|
description = 'Zips the Athena Runtime libraries'
|
|
group = 'WPILib'
|
|
baseName = 'athena-runtime'
|
|
destinationDir = project.buildDir
|
|
duplicatesStrategy = 'exclude'
|
|
|
|
// Include the static library file and header files from this project
|
|
model {
|
|
binaries {
|
|
withType(SharedLibraryBinarySpec) { spec ->
|
|
spec.headerDirs.each {
|
|
from(it) {
|
|
into 'include'
|
|
// We don't want to include any of the .cpp files that are in some of the header directories
|
|
exclude '**/*.cpp'
|
|
}
|
|
}
|
|
from(spec.sharedLibraryFile) {
|
|
into 'lib'
|
|
}
|
|
from(new File(spec.sharedLibraryFile.absolutePath + ".debug")) {
|
|
into 'lib'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
defineNetworkTablesProperties()
|
|
|
|
from(project.file(netTablesInclude)) {
|
|
into 'include'
|
|
}
|
|
|
|
from (file(netSharedLib)) {
|
|
into 'lib'
|
|
}
|
|
|
|
from (file(netSharedLibDebug)) {
|
|
into 'lib'
|
|
}
|
|
|
|
from (file(wpiUtilSharedLib)) {
|
|
into 'lib'
|
|
}
|
|
|
|
from (file(wpiUtilSharedLibDebug)) {
|
|
into 'lib'
|
|
}
|
|
|
|
// Add the hal static and shared libraries as a dependency
|
|
project(':hal').tasks.whenTaskAdded { task ->
|
|
if (task.name.toLowerCase() == 'halathenastaticlibrary' || task.name.toLowerCase() == 'halathenasharedlibrary') {
|
|
halZip.dependsOn task
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
publishing {
|
|
publications {
|
|
hal(MavenPublication) {
|
|
artifact halZip
|
|
|
|
groupId 'edu.wpi.first.wpilib'
|
|
artifactId 'hal'
|
|
version WPILibVersion.version
|
|
}
|
|
athenaruntime(MavenPublication) {
|
|
artifact athenaRuntimeZip
|
|
|
|
groupId 'edu.wpi.first.wpilib'
|
|
artifactId 'athena-runtime'
|
|
version WPILibVersion.version
|
|
}
|
|
}
|
|
|
|
setupWpilibRepo(it)
|
|
}
|