Update build setup for raspbian and debug binaries (#1384)

- Build both debug and release binaries
- Append "d" to debug libraries in the style of opencv
- Split shared and static classifiers
- Add raspbian support
This commit is contained in:
Thad House
2018-10-27 00:19:38 -07:00
committed by Peter Johnson
parent 8ff81f5a2a
commit a8aacd3657
41 changed files with 565 additions and 343 deletions

View File

@@ -52,6 +52,7 @@ model {
servo(NativeLibrarySpec)
drive_motor(NativeLibrarySpec)
all { component ->
component.targetBuildTypes 'debug'
sources {
cpp.lib library: "${component.name}", linkage: "static"
}

View File

@@ -100,6 +100,7 @@ if (!project.hasProperty('onlyAthena')) {
// By default, a development executable will be generated. This is to help the case of
// testing specific functionality of the library.
"${nativeName}Dev"(NativeExecutableSpec) {
targetBuildTypes 'debug'
sources {
cpp {
source {
@@ -125,13 +126,17 @@ if (!project.hasProperty('onlyAthena')) {
}
binaries {
withType(GoogleTestTestSuiteBinarySpec) {
lib project: ':ntcore', library: 'ntcore', linkage: 'shared'
lib project: ':cscore', library: 'cscore', linkage: 'shared'
project(':hal').addHalDependency(it, 'shared')
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared'
lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared'
lib library: nativeName, linkage: 'shared'
if (!project.hasProperty('onlyAthena') && !project.hasProperty('onlyRaspbian')) {
lib project: ':ntcore', library: 'ntcore', linkage: 'shared'
lib project: ':cscore', library: 'cscore', linkage: 'shared'
project(':hal').addHalDependency(it, 'shared')
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
lib project: ':cameraserver', library: 'cameraserver', linkage: 'shared'
lib project: ':wpilibc', library: 'wpilibc', linkage: 'shared'
lib library: nativeName, linkage: 'shared'
} else {
it.buildable = false
}
}
}
}
@@ -142,7 +147,7 @@ if (!project.hasProperty('onlyAthena')) {
model {
testSuites {
if (!project.hasProperty('onlyAthena')) {
if (!project.hasProperty('onlyAthena') && !project.hasProperty('onlyRaspbian')) {
"${nativeName}Test"(GoogleTestTestSuiteSpec) {
for(NativeComponentSpec c : $.components) {
if (c.name == nativeName) {

View File

@@ -49,13 +49,7 @@ addTaskToCopyAllOutputs(cppHeadersZip)
model {
publishing {
def halsim_adx_gyro_accelerometerTaskList = createComponentZipTasks($.components, nativeName, zipBaseName, Zip, project, includeStandardZipFormat)
def allTask
if (!project.hasProperty('jenkinsBuild')) {
allTask = createAllCombined(halsim_adx_gyro_accelerometerTaskList, nativeName, zipBaseName, Zip, project)
}
def halsim_adx_gyro_accelerometerTaskList = createComponentZipTasks($.components, [nativeName], zipBaseName, Zip, project, includeStandardZipFormat)
publications {
cpp(MavenPublication) {
@@ -63,10 +57,6 @@ model {
artifact it
}
if (!project.hasProperty('jenkinsBuild')) {
artifact allTask
}
artifact cppHeadersZip
artifact cppSourcesZip

View File

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

View File

@@ -57,7 +57,11 @@ void DSCommPacket::ReadMatchtimeTag(wpi::ArrayRef<uint8_t> tagData) {
store |= tagData[4] << 8;
store |= tagData[5];
float matchTime = *reinterpret_cast<float*>(&store);
static_assert(sizeof(uint32_t) == sizeof(float), "float must be 32 bits");
float matchTime = 0;
std::memcpy(&matchTime, &store, sizeof(float));
m_match_time = matchTime;
}

View File

@@ -105,6 +105,7 @@ if (!project.hasProperty('onlyAthena')) {
// By default, a development executable will be generated. This is to help the case of
// testing specific functionality of the library.
"${nativeName}Dev"(NativeExecutableSpec) {
targetBuildTypes 'debug'
sources {
cpp {
source {
@@ -149,7 +150,7 @@ if (!project.hasProperty('onlyAthena')) {
model {
testSuites {
if (!project.hasProperty('onlyAthena')) {
if (!project.hasProperty('onlyAthena') && !project.hasProperty('onlyRaspbian')) {
"${nativeName}Test"(GoogleTestTestSuiteSpec) {
for(NativeComponentSpec c : $.components) {
if (c.name == nativeName) {

View File

@@ -50,13 +50,7 @@ addTaskToCopyAllOutputs(cppHeadersZip)
model {
publishing {
def lowfiSimTaskList = createComponentZipTasks($.components, nativeName, zipBaseName, Zip, project, includeStandardZipFormat)
def allTask
if (!project.hasProperty('jenkinsBuild')) {
allTask = createAllCombined(lowfiSimTaskList, nativeName, zipBaseName, Zip, project)
}
def lowfiSimTaskList = createComponentZipTasks($.components, [nativeName], zipBaseName, Zip, project, includeStandardZipFormat)
publications {
cpp(MavenPublication) {
@@ -64,10 +58,6 @@ model {
artifact it
}
if (!project.hasProperty('jenkinsBuild')) {
artifact allTask
}
artifact cppHeadersZip
artifact cppSourcesZip