mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
* Dedicated RoboRIO Toolchain, allow Toolchain Path to change * Add cCompiler Tool to correctly discover RoboRIO GCC on Mac * Add @333fred requests for GString and ToolChainPath * Add Toolchain Path option to README
161 lines
4.5 KiB
Groovy
161 lines
4.5 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 'roborio-arm'
|
|
binaries.all {
|
|
tasks.withType(CppCompile) {
|
|
addNiLibraryLinks(linker, targetPlatform)
|
|
addWpiUtilLibraryLinks(it, linker, targetPlatform)
|
|
}
|
|
}
|
|
sources {
|
|
cpp {
|
|
source {
|
|
srcDirs = ["lib/athena", niLibraryHeadersRoot, "lib/shared"]
|
|
includes = ["**/*.cpp"]
|
|
}
|
|
exportedHeaders {
|
|
srcDirs = ["include", niLibraryHeadersRoot, wpiUtilInclude]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
tasks { tasks ->
|
|
tasks.halZip.dependsOn tasks.HALAthenaSharedLibrary
|
|
tasks.athenaRuntimeZip.dependsOn tasks.HALAthenaSharedLibrary
|
|
}
|
|
}
|
|
|
|
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('/', '\\')
|
|
// exclude the wpiUtil library, and any NI libraries (NI libraries grabbed later)
|
|
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/lib')) {
|
|
into 'lib'
|
|
exclude 'genlinks'
|
|
exclude 'genlinks.bat'
|
|
exclude 'libwpi.so'
|
|
}
|
|
}
|
|
|
|
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()
|
|
dependsOn project(':').downloadNetworkTables
|
|
|
|
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'
|
|
}
|
|
}
|
|
|
|
|
|
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)
|
|
}
|
|
|
|
build.dependsOn halZip
|
|
build.dependsOn athenaRuntimeZip
|