2015-11-29 21:12:12 -05:00
|
|
|
import org.apache.tools.ant.taskdefs.condition.Os
|
|
|
|
|
|
|
|
|
|
//cmake wrapper tasks
|
2015-12-24 02:34:29 -05:00
|
|
|
task setupCmake(type: Exec) {
|
|
|
|
|
description = 'create build directory for cmake to use'
|
|
|
|
|
group = 'WPILib Simulation'
|
2015-11-29 21:12:12 -05:00
|
|
|
workingDir '..'
|
|
|
|
|
commandLine 'mkdir', '-p', 'build'
|
2015-12-24 02:34:29 -05:00
|
|
|
}
|
2015-11-29 21:12:12 -05:00
|
|
|
|
2015-12-24 02:34:29 -05:00
|
|
|
task cmake(type: Exec, dependsOn: setupCmake) {
|
|
|
|
|
description = 'run cmake in the build directory to generate makefiles'
|
|
|
|
|
group = 'WPILib Simulation'
|
2015-11-29 21:12:12 -05:00
|
|
|
workingDir '../build'
|
|
|
|
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
2015-12-24 02:34:29 -05:00
|
|
|
commandLine '../configure.bat',
|
|
|
|
|
"-DNTCORE_INCLUDE_DIR=$netTablesInclude",
|
|
|
|
|
"-DNTCORE_LIBDIR=$netLibDesktopLocation",
|
|
|
|
|
"-DSIMULATION_INSTALL_DIR=$simulationInstallDir"
|
2015-09-24 20:26:49 -04:00
|
|
|
}
|
2015-11-29 21:12:12 -05:00
|
|
|
else {
|
2015-12-24 02:34:29 -05:00
|
|
|
commandLine 'cmake', '..',
|
|
|
|
|
"-DNTCORE_INCLUDE_DIR=$netTablesInclude",
|
|
|
|
|
"-DNTCORE_LIBDIR=$netLibDesktopLocation",
|
|
|
|
|
"-DSIMULATION_INSTALL_DIR=$simulationInstallDir"
|
2015-11-29 21:12:12 -05:00
|
|
|
}
|
2015-12-24 02:34:29 -05:00
|
|
|
}
|
2015-11-29 21:12:12 -05:00
|
|
|
|
2015-12-24 02:34:29 -05:00
|
|
|
task frc_gazebo_plugins(type: Exec, dependsOn: cmake) {
|
|
|
|
|
description = 'build Gazebo plugins with cmake'
|
|
|
|
|
group = 'WPILib Simulation'
|
2015-11-29 21:12:12 -05:00
|
|
|
workingDir '../build'
|
|
|
|
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
2015-12-24 02:34:29 -05:00
|
|
|
commandLine 'nmake', 'frc_gazebo_plugins'
|
2015-11-29 21:12:12 -05:00
|
|
|
}
|
|
|
|
|
else {
|
2015-12-24 02:34:29 -05:00
|
|
|
commandLine 'make', 'frc_gazebo_plugins'
|
2015-11-29 21:12:12 -05:00
|
|
|
}
|
2015-12-24 02:34:29 -05:00
|
|
|
}
|
2015-11-29 21:12:12 -05:00
|
|
|
|
2015-12-24 02:34:29 -05:00
|
|
|
task gz_msgs(type: Exec, dependsOn: cmake) {
|
|
|
|
|
description = 'build gz_msgs library with cmake'
|
|
|
|
|
group = 'WPILib Simulation'
|
2015-11-29 21:12:12 -05:00
|
|
|
workingDir '../build'
|
|
|
|
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
|
|
|
|
commandLine 'nmake', 'gz_msgs'
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
commandLine 'make', 'gz_msgs'
|
|
|
|
|
}
|
2015-12-24 02:34:29 -05:00
|
|
|
}
|
2015-11-29 21:12:12 -05:00
|
|
|
|
2015-12-24 02:34:29 -05:00
|
|
|
task wpilibcSim(type: Exec, dependsOn: ['cmake', ':unzipNetworkTables']) {
|
|
|
|
|
description = 'build WPILib C++ for simulation with cmake'
|
|
|
|
|
group = 'WPILib Simulation'
|
2015-11-29 21:12:12 -05:00
|
|
|
workingDir '../build'
|
|
|
|
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
2015-12-24 02:34:29 -05:00
|
|
|
commandLine 'nmake', 'wpilibcSim'
|
2015-11-29 21:12:12 -05:00
|
|
|
}
|
|
|
|
|
else {
|
2015-12-24 02:34:29 -05:00
|
|
|
commandLine 'make', 'wpilibcSim'
|
2015-11-29 21:12:12 -05:00
|
|
|
}
|
2015-12-24 02:34:29 -05:00
|
|
|
}
|
2015-11-29 21:12:12 -05:00
|
|
|
|
2015-12-24 02:34:29 -05:00
|
|
|
task allcsim(dependsOn: [wpilibcSim, gz_msgs, frc_gazebo_plugins]){
|
|
|
|
|
description = 'wrapper task to build all c++ simulation tasks'
|
|
|
|
|
group = 'WPILib Simulation'
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-28 01:50:35 -05:00
|
|
|
task wpilibcSimCopy(type: Copy, dependsOn: allcsim) {
|
2015-12-24 02:34:29 -05:00
|
|
|
description = 'copy headers and ntcore library to make simulation zip'
|
|
|
|
|
group = 'WPILib Simulation'
|
|
|
|
|
into "$simulationInstallDir"
|
|
|
|
|
|
|
|
|
|
from ("$netTablesInclude"){
|
|
|
|
|
into "include"
|
|
|
|
|
}
|
2015-09-24 20:26:49 -04:00
|
|
|
|
2015-12-24 02:34:29 -05:00
|
|
|
from ("../hal/include"){
|
|
|
|
|
into "include"
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-22 17:55:51 -04:00
|
|
|
from ("sim/include"){
|
2015-12-24 02:34:29 -05:00
|
|
|
into "include"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
from ("shared/include"){
|
|
|
|
|
into "include"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
from ("$netLibDesktopLocation/libntcore.so") {
|
|
|
|
|
into "lib"
|
|
|
|
|
}
|
2015-11-25 10:56:30 -05:00
|
|
|
}
|
2015-12-24 02:34:29 -05:00
|
|
|
|
|
|
|
|
build.dependsOn allcsim
|