From 40c6fbe24d061721cb7571dd6ec6c9b235648b9d Mon Sep 17 00:00:00 2001 From: Sam Carlberg Date: Wed, 10 Jun 2015 09:08:43 -0400 Subject: [PATCH] Makes the build work on Mac (needs to be tested on other platforms) Change-Id: Ibc579d5f141f3ace9892e7f898cfd21050bc2aaf --- build.gradle | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/build.gradle b/build.gradle index 8f26c798e5..1960f5b787 100644 --- a/build.gradle +++ b/build.gradle @@ -115,6 +115,28 @@ subprojects { staticLibArchiver.executable = compilerPrefix + staticLibArchiver.executable } } + macGcc(Clang) { + target('arm') { + // We use a custom-built cross compiler with the prefix arm-frc-linux-gnueabi- + // If this ever changes, the prefix will need to be changed here + def compilerPrefix = 'arm-frc-linux-gnueabi-' + cppCompiler.executable = compilerPrefix + 'g++' + linker.executable = compilerPrefix + 'g++' + assembler.executable = compilerPrefix + 'gcc' + // Gradle auto-adds the -m32 argument to the linker and compiler. Our compiler only supports + // arm, and doesn't understand this flag, so it is removed from both + cppCompiler.withArguments { args -> + args << '-std=c++1y' << '-Wformat=2' << '-Wall' << '-Wextra' << '-Werror' << '-pedantic' + args << '-Wno-psabi' << '-Wno-unused-parameter' << '-fPIC' << '-O0' << '-g3' << '-rdynamic' + args.remove('-m32') + } + linker.withArguments { args -> + args << '-rdynamic' + args.remove('-m32') + } + staticLibArchiver.executable = compilerPrefix + staticLibArchiver.executable + } + } } // The only platform is arm linux