From 2c4faee667438785a489684bddbe58eafaa7e920 Mon Sep 17 00:00:00 2001 From: Thad House Date: Fri, 29 Dec 2017 20:18:35 -0800 Subject: [PATCH] Fixes -Og compile and strip binaries (#838) --- config.gradle | 64 ++++++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 36 deletions(-) diff --git a/config.gradle b/config.gradle index 5abeb90df5..0f6394d7ec 100644 --- a/config.gradle +++ b/config.gradle @@ -1,21 +1,21 @@ 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++1y', '-Wformat=2', '-Wall', '-Wextra', '-Werror', '-pedantic', '-Wno-psabi', '-g', - '-Wno-unused-parameter', '-Wno-error=deprecated-declarations', '-fPIC', '-rdynamic', '-pthread'] +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' def macCompilerArgs = ['-std=c++11', '-Wall', '-Wextra', '-Werror', '-pedantic-errors', '-fPIC', '-g', - '-Wno-unused-parameter', '-Wno-missing-field-initializers', '-Wno-unused-private-field', '-Wno-unused-const-variable', '-pthread'] + '-Wno-unused-parameter', '-Wno-missing-field-initializers', '-Wno-unused-private-field', + '-Wno-unused-const-variable', '-pthread'] def macReleaseCompilerArgs = ['-O2'] def macDebugCompilerArgs = ['-O0'] def mac32BitArg = '-m32' @@ -147,6 +147,7 @@ if (!project.hasProperty('onlyAthena')) { linkerArgs << linux32BitArg debugCompilerArgs = linuxDebugCompilerArgs releaseCompilerArgs = linuxReleaseCompilerArgs + releaseStripBinaries = true compilerFamily = 'Gcc' detectPlatform = linux32IntelPlatformDetect exclude << 'halAthena' @@ -159,6 +160,7 @@ if (!project.hasProperty('onlyAthena')) { linkerArgs = linuxLinkerArgs debugCompilerArgs = linuxDebugCompilerArgs releaseCompilerArgs = linuxReleaseCompilerArgs + releaseStripBinaries = true compilerFamily = 'Gcc' detectPlatform = linux64IntelPlatformDetect exclude << 'halAthena' @@ -173,6 +175,7 @@ if (!project.hasProperty('onlyAthena')) { linkerArgs << mac32BitArg debugCompilerArgs = macDebugCompilerArgs releaseCompilerArgs = macReleaseCompilerArgs + releaseStripBinaries = true compilerFamily = 'Clang' detectPlatform = mac32PlatformDetect exclude << 'halAthena' @@ -184,56 +187,45 @@ if (!project.hasProperty('onlyAthena')) { compilerArgs = macCompilerArgs debugCompilerArgs = macDebugCompilerArgs releaseCompilerArgs = macReleaseCompilerArgs + releaseStripBinaries = true compilerFamily = 'Clang' detectPlatform = mac64PlatformDetect exclude << 'halAthena' } - raspbian(CrossBuildConfig) { - architecture = 'raspbian' + } + } +} + +if (project.hasProperty('linuxCross')) { + model { + buildConfigs { + linuxArm(CrossBuildConfig) { + architecture = 'nativearm' operatingSystem = 'linux' - toolChainPrefix = 'arm-linux-gnueabihf-' - compilerArgs = linuxCompilerArgs - linkerArgs = linuxLinkerArgs - debugCompilerArgs = linuxDebugCompilerArgs - releaseCompilerArgs = linuxReleaseCompilerArgs - skipByDefault = true - compilerFamily = 'Gcc' - exclude << 'gmock' - exclude << 'halAthena' - } - armhf(CrossBuildConfig) { - architecture = 'armhf' - operatingSystem = 'linux' - toolChainPrefix = 'arm-linux-gnueabihf-' - compilerArgs = linuxCompilerArgs - linkerArgs = linuxLinkerArgs - debugCompilerArgs = linuxDebugCompilerArgs - releaseCompilerArgs = linuxReleaseCompilerArgs - skipByDefault = true - compilerFamily = 'Gcc' - exclude << 'gmock' - exclude << 'halAthena' - } - aarch(CrossBuildConfig) { - architecture = 'aarch' - operatingSystem = 'linux' - toolChainPrefix = 'aarch-linux-gnu-' + toolChainPrefix = 'PLEASE_PROVIDE_A_COMPILER_NAME' compilerArgs = linuxCompilerArgs linkerArgs = linuxLinkerArgs debugCompilerArgs = linuxDebugCompilerArgs releaseCompilerArgs = linuxReleaseCompilerArgs + releaseStripBinaries = true skipByDefault = true compilerFamily = 'Gcc' exclude << 'gmock' exclude << 'halAthena' } + } + } +} else { + model { + buildConfigs { linuxArm(BuildConfig) { - architecture = 'arm' + architecture = 'nativearm' operatingSystem = 'linux' compilerArgs = linuxCompilerArgs linkerArgs = linuxLinkerArgs debugCompilerArgs = linuxDebugCompilerArgs releaseCompilerArgs = linuxReleaseCompilerArgs + releaseStripBinaries = true compilerFamily = 'Gcc' detectPlatform = linuxArmPlatformDetect exclude << 'halAthena'