Update to new Native Utils (#1696)

Also update to azure 2019 windows image
This commit is contained in:
Thad House
2019-06-28 14:09:10 -07:00
committed by Peter Johnson
parent 30e936837c
commit 3dfb01d45b
36 changed files with 408 additions and 659 deletions

View File

@@ -1,95 +1,95 @@
plugins {
id 'cpp'
id 'java'
id 'com.google.protobuf' version '0.8.6'
id 'edu.wpi.first.NativeUtils'
}
description = "A C++ and Java library to pass FRC Simulation Messages in and out of Gazebo."
/* The simulation does not run on real hardware; so we always skip Athena */
ext.skipAthena = true
ext.skipRaspbian = true
apply from: "${rootDir}/shared/config.gradle"
/* Use a sort of poor man's autoconf to find the protobuf development
files; on Debian, those are supplied by libprotobuf-dev.
This should get skipped on Windows.
TODO: Add Windows support for the simulation code */
def protobuf_version = ""
try {
protobuf_version = "pkg-config --modversion protobuf".execute().text.trim()
println "Protobuf version is [${protobuf_version}]"
} catch(Exception ex) {
}
if (!protobuf_version?.trim()) {
println "Protobuf is not available. (pkg-config --modversion protobuf failed)"
protobuf_version = "+"
if (project.hasProperty("makeSim")) {
/* Force the build even though we did not find protobuf. */
println "makeSim set. Forcing build - failure likely."
}
else {
ext.skip_gz_msgs = true
println "Skipping gz_msgs."
}
}
tasks.whenTaskAdded { task ->
task.onlyIf { !project.hasProperty('skip_gz_msgs') }
}
dependencies {
compile "com.google.protobuf:protobuf-java:${protobuf_version}"
compile "com.google.protobuf:protoc:${protobuf_version}"
}
/* There is a nice gradle plugin for protobuf, and the protoc tool
is included; using it simplifies our build process.
The trick is that we have to use the same version as the system
copy of libprotobuf-dev */
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:${protobuf_version}"
}
generatedFilesBaseDir = "$buildDir/generated"
generateProtoTasks {
all().each { task ->
task.builtins {
cpp {
outputSubDir = 'simulation/gz_msgs'
}
}
}
}
}
model {
components {
gz_msgs(NativeLibrarySpec) {
sources {
cpp {
source {
srcDir "$buildDir/generated/main/simulation/gz_msgs"
builtBy tasks.generateProto
}
exportedHeaders {
srcDir "src/include"
srcDir "$buildDir/generated/main"
}
}
}
/* We must compile with -fPIC to link the static library into an so */
binaries {
all {
cppCompiler.args "-fPIC"
}
}
}
}
}
plugins {
id 'cpp'
id 'java'
id 'com.google.protobuf' version '0.8.8'
id 'edu.wpi.first.NativeUtils'
}
description = "A C++ and Java library to pass FRC Simulation Messages in and out of Gazebo."
/* The simulation does not run on real hardware; so we always skip Athena */
ext.skipAthena = true
ext.skipRaspbian = true
apply from: "${rootDir}/shared/config.gradle"
/* Use a sort of poor man's autoconf to find the protobuf development
files; on Debian, those are supplied by libprotobuf-dev.
This should get skipped on Windows.
TODO: Add Windows support for the simulation code */
def protobuf_version = ""
try {
protobuf_version = "pkg-config --modversion protobuf".execute().text.trim()
println "Protobuf version is [${protobuf_version}]"
} catch(Exception ex) {
}
if (!protobuf_version?.trim()) {
println "Protobuf is not available. (pkg-config --modversion protobuf failed)"
protobuf_version = "+"
if (project.hasProperty("makeSim")) {
/* Force the build even though we did not find protobuf. */
println "makeSim set. Forcing build - failure likely."
}
else {
ext.skip_gz_msgs = true
println "Skipping gz_msgs."
}
}
tasks.whenTaskAdded { task ->
task.onlyIf { !project.hasProperty('skip_gz_msgs') }
}
dependencies {
compile "com.google.protobuf:protobuf-java:${protobuf_version}"
compile "com.google.protobuf:protoc:${protobuf_version}"
}
/* There is a nice gradle plugin for protobuf, and the protoc tool
is included; using it simplifies our build process.
The trick is that we have to use the same version as the system
copy of libprotobuf-dev */
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:${protobuf_version}"
}
generatedFilesBaseDir = "$buildDir/generated"
generateProtoTasks {
all().each { task ->
task.builtins {
cpp {
outputSubDir = 'simulation/gz_msgs'
}
}
}
}
}
model {
components {
gz_msgs(NativeLibrarySpec) {
sources {
cpp {
source {
srcDir "$buildDir/generated/main/simulation/gz_msgs"
builtBy tasks.generateProto
}
exportedHeaders {
srcDir "src/include"
srcDir "$buildDir/generated/main"
}
}
}
/* We must compile with -fPIC to link the static library into an so */
binaries {
all {
cppCompiler.args "-fPIC"
}
}
}
}
}

View File

@@ -11,7 +11,7 @@ ext {
apply from: "${rootDir}/shared/config.gradle"
if (!project.hasProperty('onlyAthena')) {
if (!project.hasProperty('onlylinuxathena')) {
ext {
sharedCvConfigs = [halsim_adx_gyro_accelerometerTest: []]
@@ -37,19 +37,20 @@ if (!project.hasProperty('onlyAthena')) {
apply from: "${rootDir}/shared/nilibraries.gradle"
model {
exportsConfigs {
halsim_adx_gyro_accelerometer(ExportsConfig) {
x86ExcludeSymbols = ['_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure',
'_CT??_R0?AVbad_cast',
'_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure',
'_TI5?AVfailure']
x64ExcludeSymbols = ['_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure',
'_CT??_R0?AVbad_cast',
'_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure',
'_TI5?AVfailure']
}
nativeUtils.exportsConfigs {
halsim_adx_gyro_accelerometer {
x86ExcludeSymbols = ['_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure',
'_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure',
'_TI5?AVfailure', '_CT??_R0?AVout_of_range', '_CTA3?AVout_of_range',
'_TI3?AVout_of_range', '_CT??_R0?AVbad_cast']
x64ExcludeSymbols = ['_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure',
'_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure',
'_TI5?AVfailure', '_CT??_R0?AVout_of_range', '_CTA3?AVout_of_range',
'_TI3?AVout_of_range', '_CT??_R0?AVbad_cast']
}
}
model {
components {
"${nativeName}Base"(NativeLibrarySpec) {
sources {
@@ -68,7 +69,7 @@ if (!project.hasProperty('onlyAthena')) {
it.buildable = false
return
}
if (it.targetPlatform.architecture.name == 'athena') {
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
it.buildable = false
return
}
@@ -89,7 +90,7 @@ if (!project.hasProperty('onlyAthena')) {
}
}
binaries.all {
if (it.targetPlatform.architecture.name == 'athena') {
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
it.buildable = false
return
}
@@ -114,7 +115,7 @@ if (!project.hasProperty('onlyAthena')) {
}
}
binaries.all {
if (it.targetPlatform.architecture.name == 'athena') {
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
it.buildable = false
return
}
@@ -126,7 +127,7 @@ if (!project.hasProperty('onlyAthena')) {
}
binaries {
withType(GoogleTestTestSuiteBinarySpec) {
if (!project.hasProperty('onlyAthena') && !project.hasProperty('onlyRaspbian')) {
if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian')) {
lib project: ':ntcore', library: 'ntcore', linkage: 'shared'
lib project: ':cscore', library: 'cscore', linkage: 'shared'
project(':hal').addHalDependency(it, 'shared')
@@ -147,7 +148,7 @@ if (!project.hasProperty('onlyAthena')) {
model {
testSuites {
if (!project.hasProperty('onlyAthena') && !project.hasProperty('onlyRaspbian')) {
if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian')) {
"${nativeName}Test"(GoogleTestTestSuiteSpec) {
for(NativeComponentSpec c : $.components) {
if (c.name == nativeName) {

View File

@@ -21,7 +21,7 @@ apply from: "${rootDir}/shared/plugins/setupBuild.gradle"
model {
testSuites {
def comps = $.components
if (!project.hasProperty('onlyAthena') && !project.hasProperty('onlyRaspbian')) {
if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian')) {
"${pluginName}Test"(GoogleTestTestSuiteSpec) {
for(NativeComponentSpec c : comps) {
if (c.name == pluginName) {

View File

@@ -12,7 +12,7 @@ ext {
apply from: "${rootDir}/shared/config.gradle"
if (!project.hasProperty('onlyAthena')) {
if (!project.hasProperty('onlylinuxathena')) {
ext {
sharedCvConfigs = [lowfi_simTest: []]
@@ -40,19 +40,20 @@ if (!project.hasProperty('onlyAthena')) {
apply from: "${rootDir}/shared/nilibraries.gradle"
model {
exportsConfigs {
lowfi_sim(ExportsConfig) {
x86ExcludeSymbols = ['_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure',
'_CT??_R0?AVbad_cast',
'_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure',
'_TI5?AVfailure']
x64ExcludeSymbols = ['_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure',
'_CT??_R0?AVbad_cast',
'_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure',
'_TI5?AVfailure']
}
nativeUtils.exportsConfigs {
lowfi_sim {
x86ExcludeSymbols = ['_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure',
'_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure',
'_TI5?AVfailure', '_CT??_R0?AVout_of_range', '_CTA3?AVout_of_range',
'_TI3?AVout_of_range', '_CT??_R0?AVbad_cast']
x64ExcludeSymbols = ['_CT??_R0?AV_System_error', '_CT??_R0?AVexception', '_CT??_R0?AVfailure',
'_CT??_R0?AVruntime_error', '_CT??_R0?AVsystem_error', '_CTA5?AVfailure',
'_TI5?AVfailure', '_CT??_R0?AVout_of_range', '_CTA3?AVout_of_range',
'_TI3?AVout_of_range', '_CT??_R0?AVbad_cast']
}
}
model {
components {
"${nativeName}Base"(NativeLibrarySpec) {
sources {
@@ -71,7 +72,7 @@ if (!project.hasProperty('onlyAthena')) {
it.buildable = false
return
}
if (it.targetPlatform.architecture.name == 'athena') {
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
it.buildable = false
return
}
@@ -93,7 +94,7 @@ if (!project.hasProperty('onlyAthena')) {
}
}
binaries.all {
if (it.targetPlatform.architecture.name == 'athena') {
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
it.buildable = false
return
}
@@ -119,7 +120,7 @@ if (!project.hasProperty('onlyAthena')) {
}
}
binaries.all {
if (it.targetPlatform.architecture.name == 'athena') {
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
it.buildable = false
return
}
@@ -150,7 +151,7 @@ if (!project.hasProperty('onlyAthena')) {
model {
testSuites {
if (!project.hasProperty('onlyAthena') && !project.hasProperty('onlyRaspbian')) {
if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian')) {
"${nativeName}Test"(GoogleTestTestSuiteSpec) {
for(NativeComponentSpec c : $.components) {
if (c.name == nativeName) {