blob: b38190e0f4fdbee6b73ef8861cd6a8769a6ae759 [file] [log] [blame]
task downloadWpiUtil() {
description = 'Downloads the C++ ARM wpiutil maven dependency.'
group = 'WPILib'
def depFolder = "$buildDir/dependencies"
def utilZip = file("$depFolder/wpiutil.zip")
outputs.file(utilZip)
def armWpiUtil
doFirst {
def armWpiUtilDependency = project.dependencies.create("edu.wpi.first.wpiutil:wpiutil-cpp:+:linuxathena@zip")
def armWpiUtilConfig = project.configurations.detachedConfiguration(armWpiUtilDependency)
armWpiUtilConfig.setTransitive(false)
armWpiUtil = armWpiUtilConfig.files[0].canonicalFile
}
doLast {
copy {
from armWpiUtil
rename 'wpiutil(.+)', 'wpiutil.zip'
into depFolder
}
}
}
task downloadWpiUtilHeaders() {
description = 'Downloads the C++ ARM wpiutil maven dependency.'
group = 'WPILib'
def depFolder = "$buildDir/dependencies"
def utilZip = file("$depFolder/wpiutilHeaders.zip")
outputs.file(utilZip)
def armWpiUtilHeaders
doFirst {
def armWpiUtilHeadersDependency = project.dependencies.create("edu.wpi.first.wpiutil:wpiutil-cpp:+:headers@zip")
def armWpiUtilHeadersConfig = project.configurations.detachedConfiguration(armWpiUtilHeadersDependency)
armWpiUtilHeadersConfig.setTransitive(false)
armWpiUtilHeaders = armWpiUtilHeadersConfig.files[0].canonicalFile
}
doLast {
copy {
from armWpiUtilHeaders
rename 'wpiutil(.+)', 'wpiutilHeaders.zip'
into depFolder
}
}
}
def wpiUtilUnzipLocation = "$buildDir/wpiutil"
def wpiUtilUnzipHeadersLocation = "$buildDir/wpiutil/include"
// Create a task that will unzip the wpiutil files into a temporary build directory
task unzipWpiUtil(type: Copy) {
description = 'Unzips the wpiutil maven dependency so that the include files and libraries can be used'
group = 'WPILib'
dependsOn downloadWpiUtil
from zipTree(downloadWpiUtil.outputs.files.singleFile)
into wpiUtilUnzipLocation
}
// Create a task that will unzip the wpiutil files into a temporary build directory
task unzipWpiUtilHeaders(type: Copy) {
description = 'Unzips the wpiutil maven dependency so that the include files and libraries can be used'
group = 'WPILib'
dependsOn downloadWpiUtilHeaders
from zipTree(downloadWpiUtilHeaders.outputs.files.singleFile)
into wpiUtilUnzipHeadersLocation
}
ext.defineWpiUtilProperties = {
ext.wpiUtil = wpiUtilUnzipLocation
ext.wpiUtilInclude = "$wpiUtilUnzipLocation/include"
ext.wpiUtilLibArmLocation = "$wpiUtilUnzipLocation/linux/athena/shared"
ext.wpiUtilSharedLib = "$wpiUtilLibArmLocation/libwpiutil.so"
ext.wpiUtilSharedLibDebug = "$wpiUtilLibArmLocation/libwpiutil.so.debug"
ext.addWpiUtilLibraryLinks = { compileTask, linker, targetPlatform ->
compileTask.dependsOn project(':').unzipWpiUtil
compileTask.dependsOn project(':').unzipWpiUtilHeaders
String architecture = targetPlatform.architecture
if (architecture.contains('arm')) {
// linker.args wpiUtilSharedLib
}
}
}
def NIUnzipHeadersLocation = "$buildDir/NI/include"
task downloadNIHeaders() {
description = 'Downloads the NI headers.'
group = 'WPILib'
def depFolder = "$buildDir/dependencies"
def libZip = file("$depFolder/NIHeaders.zip")
outputs.file(libZip)
def NIHeaders
doFirst {
def NIHeadersDependency = project.dependencies.create("edu.wpi.first.ni-libraries:ni-libraries:+:headers@zip")
def NIHeadersConfig = project.configurations.detachedConfiguration(NIHeadersDependency)
NIHeadersConfig.setTransitive(false)
NIHeaders = NIHeadersConfig.files[0].canonicalFile
}
doLast {
copy {
from NIHeaders
rename 'ni-libraries(.+)', 'NIHeaders.zip'
into depFolder
}
}
}
task unzipNIHeaders(type: Copy) {
description = 'Unzips the NI include files so they can be used'
group = 'WPILib'
dependsOn downloadNIHeaders
from zipTree(downloadNIHeaders.outputs.files.singleFile)
into NIUnzipHeadersLocation
}
ext.defineNIProperties = {
ext.NI = NIUnzipHeadersLocation
ext.NIInclude = NIUnzipHeadersLocation
ext.addNILibraryLinks = { compileTask, linker, targetPlatform ->
compileTask.dependsOn project(':').unzipNIHeaders
}
}
def halUnzipLocation = "$buildDir/hal"
def halUnzipHeadersLocation = "$buildDir/hal/include"
task downloadHAL() {
description = 'Downloads the C++ ARM HAL maven dependency.'
group = 'WPILib'
def depFolder = "$buildDir/dependencies"
def libZip = file("$depFolder/hal.zip")
outputs.file(libZip)
def armHal
doFirst {
def armHALDependency = project.dependencies.create("edu.wpi.first.hal:hal:+:linuxathena@zip")
def armHALConfig = project.configurations.detachedConfiguration(armHALDependency)
armHALConfig.setTransitive(false)
armHal = armHALConfig.files[0].canonicalFile
}
doLast {
copy {
from armHal
rename 'hal(.+)', 'hal.zip'
into depFolder
}
}
}
task downloadHALHeaders() {
description = 'Downloads the C++ ARM HAL maven dependency.'
group = 'WPILib'
def depFolder = "$buildDir/dependencies"
def libZip = file("$depFolder/halHeaders.zip")
outputs.file(libZip)
def armHalHeaders
doFirst {
def armHALHeadersDependency = project.dependencies.create("edu.wpi.first.hal:hal:+:headers@zip")
def armHALHeadersConfig = project.configurations.detachedConfiguration(armHALHeadersDependency)
armHALHeadersConfig.setTransitive(false)
armHalHeaders = armHALHeadersConfig.files[0].canonicalFile
}
doLast {
copy {
from armHalHeaders
rename 'hal(.+)', 'halHeaders.zip'
into depFolder
}
}
}
// Create a task that will unzip the hal files into a temporary build directory
task unzipHAL(type: Copy) {
description = 'Unzips the hal maven dependency so that the include files and libraries can be used'
group = 'WPILib'
dependsOn downloadHAL
from zipTree(downloadHAL.outputs.files.singleFile)
into halUnzipLocation
}
task unzipHALHeaders(type: Copy) {
description = 'Unzips the hal maven dependency so that the include files and libraries can be used'
group = 'WPILib'
dependsOn downloadHALHeaders
from zipTree(downloadHALHeaders.outputs.files.singleFile)
into halUnzipHeadersLocation
}
ext.defineHALProperties = {
ext.hal = halUnzipLocation
ext.halInclude = "$halUnzipLocation/include"
ext.halLocation = "$halUnzipLocation/linux/athena/shared"
ext.halSharedLib = "$halLocation/libwpiHal.so"
ext.addHalLibraryLinks = { compileTask, linker, targetPlatform ->
compileTask.dependsOn project(':').unzipHAL
compileTask.dependsOn project(':').unzipHALHeaders
String architecture = targetPlatform.architecture
if (architecture.contains('arm')) {
// Grab all the shared libraries and link them
linker.args halSharedLib
// linker.args "$halLocation/libnilibraries.so"
def libraryPath = halLocation
linker.args << '-L' + libraryPath
}
}
}
task downloadNetworkTables() {
description = 'Downloads the C++ ARM NetworkTables maven dependency.'
group = 'WPILib'
def depFolder = "$buildDir/dependencies"
def ntZip = file("$depFolder/ntcore.zip")
outputs.file(ntZip)
def armNetTables
doFirst {
def armNtDependency = project.dependencies.create('edu.wpi.first.ntcore:ntcore-cpp:+:linuxathena@zip')
def armConfig = project.configurations.detachedConfiguration(armNtDependency)
armConfig.setTransitive(false)
armNetTables = armConfig.files[0].canonicalFile
}
doLast {
copy {
from armNetTables
rename 'ntcore(.+)', 'ntcore.zip'
into depFolder
}
}
}
task downloadNetworkTablesHeaders() {
description = 'Downloads the C++ ARM NetworkTables maven dependency.'
group = 'WPILib'
def depFolder = "$buildDir/dependencies"
def ntZip = file("$depFolder/ntcoreHeaders.zip")
outputs.file(ntZip)
def armNetTablesHeaders
doFirst {
def armNtHeadersDependency = project.dependencies.create('edu.wpi.first.ntcore:ntcore-cpp:+:headers@zip')
def armHeadersConfig = project.configurations.detachedConfiguration(armNtHeadersDependency)
armHeadersConfig.setTransitive(false)
armNetTablesHeaders = armHeadersConfig.files[0].canonicalFile
}
doLast {
copy {
from armNetTablesHeaders
rename 'ntcore(.+)', 'ntcoreHeaders.zip'
into depFolder
}
}
}
def netTablesUnzipLocation = "$buildDir/ntcore"
def netTablesHeadersUnzipLocation = "$buildDir/ntcore/include"
// Create a task that will unzip the networktables files into a temporary build directory
task unzipNetworkTables(type: Copy) {
description = 'Unzips the networktables maven dependency so that the include files and libraries can be used'
group = 'WPILib'
dependsOn downloadNetworkTables
from zipTree(downloadNetworkTables.outputs.files.singleFile)
into netTablesUnzipLocation
}
task unzipNetworkTablesHeaders(type: Copy) {
description = 'Unzips the networktables maven dependency so that the include files and libraries can be used'
group = 'WPILib'
dependsOn downloadNetworkTablesHeaders
from zipTree(downloadNetworkTablesHeaders.outputs.files.singleFile)
into netTablesHeadersUnzipLocation
}
// This defines a project property that projects depending on network tables can use to setup that dependency.
ext.defineNetworkTablesProperties = {
ext.netTables = netTablesUnzipLocation
ext.netTablesInclude = "$netTablesUnzipLocation/include"
ext.netLibArmLocation = "$netTablesUnzipLocation/linux/athena/shared"
ext.netSharedLib = "$netLibArmLocation/libntcore.so"
ext.netSharedLibDebug = "$netLibArmLocation/libntcore.so.debug"
ext.addNetworkTablesLibraryLinks = { compileTask, linker, targetPlatform ->
compileTask.dependsOn project(':').unzipNetworkTables
compileTask.dependsOn project(':').unzipNetworkTablesHeaders
String architecture = targetPlatform.architecture
if (architecture.contains('arm')) {
linker.args netSharedLib
}
addWpiUtilLibraryLinks(compileTask, linker, targetPlatform)
}
}
def wpilibUnzipLocation = "$buildDir/wpilib"
def wpilibHeadersUnzipLocation = "$buildDir/wpilib/include"
task downloadWpilib() {
description = 'Downloads the C++ ARM wpilib maven dependency.'
group = 'WPILib'
def depFolder = "$buildDir/dependencies"
def libZip = file("$depFolder/wpilibc.zip")
outputs.file(libZip)
def armWPILib
doFirst {
def armWpiLibDependency = project.dependencies.create("edu.wpi.first.wpilibc:wpilibc:+:linuxathena@zip")
def armWpiLibConfig = project.configurations.detachedConfiguration(armWpiLibDependency)
armWpiLibConfig.setTransitive(false)
armWPILib = armWpiLibConfig.files[0].canonicalFile
}
doLast {
copy {
from armWPILib
rename 'wpilibc(.+)', 'wpilibc.zip'
into depFolder
}
}
}
task downloadWpilibHeaders() {
description = 'Downloads the C++ ARM wpilib maven dependency.'
group = 'WPILib'
def depFolder = "$buildDir/dependencies"
def libZip = file("$depFolder/wpilibcHeaders.zip")
outputs.file(libZip)
def armWPILibHeaders
doFirst {
def armWpiLibHeadersDependency = project.dependencies.create("edu.wpi.first.wpilibc:wpilibc:+:headers@zip")
def armWpiLibHeadersConfig = project.configurations.detachedConfiguration(armWpiLibHeadersDependency)
armWpiLibHeadersConfig.setTransitive(false)
armWPILibHeaders = armWpiLibHeadersConfig.files[0].canonicalFile
}
doLast {
copy {
from armWPILibHeaders
rename 'wpilibc(.+)', 'wpilibcHeaders.zip'
into depFolder
}
}
}
// Create a task that will unzip the wpilib files into a temporary build directory
task unzipWpilib(type: Copy) {
description = 'Unzips the wpilib maven dependency so that the include files and libraries can be used'
group = 'WPILib'
dependsOn downloadWpilib
from zipTree(downloadWpilib.outputs.files.singleFile)
into wpilibUnzipLocation
}
task unzipWpilibHeaders(type: Copy) {
description = 'Unzips the wpilib maven dependency so that the include files and libraries can be used'
group = 'WPILib'
dependsOn downloadWpilibHeaders
from zipTree(downloadWpilibHeaders.outputs.files.singleFile)
into wpilibHeadersUnzipLocation
}
ext.defineWpiLibProperties = {
ext.wpilib = wpilibUnzipLocation
ext.wpilibInclude = "$wpilibUnzipLocation/include"
ext.wpilibLocation = "$wpilibUnzipLocation/linux/athena/shared"
ext.wpilibSharedLib = "$wpilibLocation/libwpilibc.so"
ext.addWpilibLibraryLinks = { compileTask, linker, targetPlatform ->
compileTask.dependsOn project(':').unzipWpilib
compileTask.dependsOn project(':').unzipWpilibHeaders
String architecture = targetPlatform.architecture
if (architecture.contains('arm')) {
// Grab all the shared libraries and link them
linker.args wpilibSharedLib
def libraryPath = wpilibLocation
linker.args << '-L' + libraryPath
}
}
}
def cscoreUnzipLocation = "$buildDir/cscore"
task downloadCsCore() {
description = 'Downloads the C++ ARM CsCore maven dependency.'
group = 'WPILib'
def depFolder = "$buildDir/dependencies"
def libZip = file("$depFolder/cscore.zip")
outputs.file(libZip)
def armCsCore
doFirst {
def armCsDependency = project.dependencies.create("edu.wpi.cscore.cpp:cscore:+:athena-uberzip@zip")
def armCsConfig = project.configurations.detachedConfiguration(armCsDependency)
armCsConfig.setTransitive(false)
armCsCore = armCsConfig.files[0].canonicalFile
}
doLast {
copy {
from armCsCore
rename 'cscore(.+)', 'cscore.zip'
into depFolder
}
}
}
// Create a task that will unzip the cscore files into a temporary build directory
task unzipCsCore(type: Copy) {
description = 'Unzips the cscore maven dependency so that the include files and libraries can be used'
group = 'WPILib'
dependsOn downloadCsCore
from zipTree(downloadCsCore.outputs.files.singleFile)
into cscoreUnzipLocation
}
ext.defineCsCoreProperties = {
ext.cscore = cscoreUnzipLocation
ext.cscoreInclude = "$cscoreUnzipLocation/include"
ext.cscoreLocation = "$cscoreUnzipLocation/lib"
ext.opencvSharedLib = "$cscoreLocation/libopencv.so"
ext.cscoreSharedLib = "$cscoreLocation/libcscore.so"
ext.addCsCoreLibraryLinks = { compileTask, linker, targetPlatform ->
// compileTask.dependsOn project(':').unzipCsCore
String architecture = targetPlatform.architecture
if (architecture.contains('arm')) {
// Grab all the shared libraries and link them
linker.args opencvSharedLib
linker.args cscoreSharedLib
def libraryPath = cscoreLocation
linker.args << '-L' + libraryPath
}
}
}