mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
53 lines
1.9 KiB
Groovy
53 lines
1.9 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' << '-Wno-missing-field-initializers'
|
|
}
|
|
linker.withArguments { args ->
|
|
args << '-m32'
|
|
}
|
|
}
|
|
target('x64') {
|
|
cppCompiler.withArguments { args ->
|
|
args << '-std=c++11' << '-Wall' << '-Wextra' << '-Werror' << '-pedantic-errors'
|
|
args << '-Wno-unused-parameter' << '-fPIC' << '-Wno-missing-field-initializers'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
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
|
|
if (project.tasks.findByName("strip${binary.name}") == null) {
|
|
def dsymutil = project.tasks.create("dsymutil${binary.name}", Exec) { task ->
|
|
task.commandLine 'dsymutil', library
|
|
}
|
|
def strip = project.tasks.create("strip${binary.name}", Exec) { task ->
|
|
task.commandLine 'strip', '-S', library
|
|
}
|
|
strip.dependsOn dsymutil
|
|
binary.tasks.whenObjectAdded { task ->
|
|
if (task.name.contains('link')) {
|
|
dsymutil.dependsOn task
|
|
}
|
|
}
|
|
}
|
|
releaseTask.dependsOn project.tasks.getByName("strip${binary.name}")
|
|
}
|
|
}
|
|
}
|