mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
current platform by default, and only builds tests when building for the current platform. Mac builds and VS2015 builds are fixed. The other big change in this update is the introduction of Debug and Release builds. Debug builds are built with -O0 and -g. Release builds are built with -O2 and -g. For GCC-based builds, the resulting shared object is copied, stripped of debug information, and a debug link is set up to the copied shared object. This allows the release build to clock in at around 600 KB. On Windows, the debug info is already stored in a separate PDB file, so this copy and strip is not necessary. ntcore is being separated out from the rest of allwpilib. All other builds will consume a published maven dependency from this project. There are 4 possible publishing targets now: release, stable, beta, and development. These are specified on the command line via -Prepo=<repo name>. Change-Id: Ie8cb21f910953e09b80a5192317033eb0866cb70
58 lines
2.2 KiB
Groovy
58 lines
2.2 KiB
Groovy
model {
|
|
toolChains {
|
|
clang(Clang) {
|
|
target('x86') {
|
|
cppCompiler.withArguments { args ->
|
|
args << '-std=c++11' << '-Wall' << '-Wextra' << '-Werror' << '-pedantic-errors'
|
|
args << '-Wno-unused-parameter' << '-fPIC' << '-m32'
|
|
}
|
|
linker.withArguments { args ->
|
|
args << '-m32'
|
|
}
|
|
}
|
|
target('x64') {
|
|
cppCompiler.withArguments { args ->
|
|
args << '-std=c++11' << '-Wall' << '-Wextra' << '-Werror' << '-pedantic-errors'
|
|
args << '-Wno-unused-parameter' << '-fPIC'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
ext.setupReleaseDefines = { cppCompiler, linker ->
|
|
cppCompiler.args '-O2'
|
|
}
|
|
|
|
ext.setupDebugDefines = { cppCompiler, linker ->
|
|
cppCompiler.args '-g', '-O0'
|
|
}
|
|
|
|
ext.releaseSetup = { releaseTask ->
|
|
binaries.withType(SharedLibraryBinarySpec) { binary ->
|
|
if (!project.hasProperty('debug')) {
|
|
def library = binary.sharedLibraryFile.absolutePath
|
|
def debugLibrary = binary.sharedLibraryFile.absolutePath + ".debug"
|
|
if (project.tasks.findByName("firstObjcopy${binary.name}") == null) {
|
|
def firstObjcopy = project.tasks.create("firstObjcopy${binary.name}", Exec) { task ->
|
|
task.commandLine 'objcopy', '--only-keep-debug', library, debugLibrary
|
|
}
|
|
def strip = project.tasks.create("strip${binary.name}", Exec) { task ->
|
|
task.commandLine 'strip', '-g', library
|
|
}
|
|
def secondObjcopy = project.tasks.create("secondObjcopy${binary.name}", Exec) { task ->
|
|
task.commandLine 'objcopy', "--add-gnu-debuglink=$debugLibrary", library
|
|
}
|
|
secondObjcopy.dependsOn strip
|
|
strip.dependsOn firstObjcopy
|
|
binary.tasks.whenObjectAdded { task ->
|
|
if (task.name.contains('link')) {
|
|
firstObjcopy.dependsOn task
|
|
}
|
|
}
|
|
}
|
|
releaseTask.dependsOn project.tasks.getByName("secondObjcopy${binary.name}")
|
|
}
|
|
}
|
|
}
|