Skip to content
This repository has been archived by the owner on Sep 21, 2020. It is now read-only.

Commit

Permalink
Fixes linux and mac builds to -Og, and strips binaries (#261)
Browse files Browse the repository at this point in the history
Also fixes errors from new optimization level.
  • Loading branch information
ThadHouse authored and PeterJohnson committed Dec 30, 2017
1 parent aa2de65 commit 2287281
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ buildscript {
}
}
dependencies {
classpath 'gradle.plugin.edu.wpi.first:native-utils:1.3.0'
classpath 'gradle.plugin.edu.wpi.first:native-utils:1.5.1'
classpath 'gradle.plugin.edu.wpi.first.wpilib.versioning:wpilib-version-plugin:2.0'
}
}
Expand Down
11 changes: 8 additions & 3 deletions config.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import edu.wpi.first.nativeutils.*
import org.gradle.internal.os.OperatingSystem

def windowsCompilerArgs = ['/EHsc', '/DNOMINMAX', '/D_SCL_SECURE_NO_WARNINGS', '/D_WINSOCK_DEPRECATED_NO_WARNINGS',
'/Zi', '/FS', '/Zc:inline', '/MT']
def windowsCompilerArgs = ['/EHsc', '/DNOMINMAX', '/Zi', '/FS', '/Zc:inline', '/MT']
def windowsReleaseCompilerArgs = ['/O2']
def windowsLinkerArgs = [ '/DEBUG:FULL' ]
def windowsReleaseLinkerArgs = [ '/OPT:REF', '/OPT:ICF' ]

def linuxCompilerArgs = ['-std=c++11', '-Wformat=2', '-Wall', '-Wextra', '-Werror', '-pedantic', '-Wno-psabi', '-g',
'-Wno-unused-parameter', '-fPIC', '-rdynamic', '-Wno-error=deprecated-declarations', '-pthread']
def linuxLinkerArgs = ['-rdynamic', '-pthread']
def linuxReleaseCompilerArgs = ['-O2']
def linuxReleaseCompilerArgs = ['-Og']
def linuxDebugCompilerArgs = ['-O0']
def linux32BitArg = '-m32'

Expand Down Expand Up @@ -142,6 +141,7 @@ if (!project.hasProperty('onlyAthena')) {
linkerArgs << linux32BitArg
debugCompilerArgs = linuxDebugCompilerArgs
releaseCompilerArgs = linuxReleaseCompilerArgs
releaseStripBinaries = true
compilerFamily = 'Gcc'
detectPlatform = linux32IntelPlatformDetect
}
Expand All @@ -152,6 +152,7 @@ if (!project.hasProperty('onlyAthena')) {
linkerArgs = linuxLinkerArgs
debugCompilerArgs = linuxDebugCompilerArgs
releaseCompilerArgs = linuxReleaseCompilerArgs
releaseStripBinaries = true
compilerFamily = 'Gcc'
detectPlatform = linux64IntelPlatformDetect
}
Expand All @@ -163,6 +164,7 @@ if (!project.hasProperty('onlyAthena')) {
linkerArgs << mac32BitArg
debugCompilerArgs = macDebugCompilerArgs
releaseCompilerArgs = macReleaseCompilerArgs
releaseStripBinaries = true
compilerFamily = 'Clang'
detectPlatform = mac32PlatformDetect
}
Expand All @@ -172,6 +174,7 @@ if (!project.hasProperty('onlyAthena')) {
compilerArgs = macCompilerArgs
debugCompilerArgs = macDebugCompilerArgs
releaseCompilerArgs = macReleaseCompilerArgs
releaseStripBinaries = true
compilerFamily = 'Clang'
detectPlatform = mac64PlatformDetect
}
Expand All @@ -190,6 +193,7 @@ if (project.hasProperty('linuxCross')) {
linkerArgs = linuxLinkerArgs
debugCompilerArgs = linuxDebugCompilerArgs
releaseCompilerArgs = linuxReleaseCompilerArgs
releaseStripBinaries = true
skipByDefault = true
compilerFamily = 'Gcc'
exclude << 'gmock'
Expand All @@ -206,6 +210,7 @@ if (project.hasProperty('linuxCross')) {
linkerArgs = linuxLinkerArgs
debugCompilerArgs = linuxDebugCompilerArgs
releaseCompilerArgs = linuxReleaseCompilerArgs
releaseStripBinaries = true
compilerFamily = 'Gcc'
detectPlatform = linuxArmPlatformDetect
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/native/cpp/DsClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void DsClient::Thread::Main() {
DEBUG3("found robotIP=" << json.slice(pos + 1, endpos));

// Parse into number
unsigned int ip;
unsigned int ip = 0;
if (json.slice(pos + 1, endpos).getAsInteger(10, ip)) continue; // error

// If zero, clear the server override
Expand Down
2 changes: 1 addition & 1 deletion src/main/native/cpp/Message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ using namespace nt;

std::shared_ptr<Message> Message::Read(WireDecoder& decoder,
GetEntryTypeFunc get_entry_type) {
unsigned int msg_type;
unsigned int msg_type = 0;
if (!decoder.Read8(&msg_type)) return nullptr;
auto msg =
std::make_shared<Message>(static_cast<MsgType>(msg_type), private_init());
Expand Down

0 comments on commit 2287281

Please sign in to comment.