Skip to content

Commit bb5ee73

Browse files
authored
[build] Build JNI and benchmarks as release by default (#8257)
It doesn't make sense to benchmark debug binaries. Also, wpimath JNI performance in unit tests is drastically impacted by debug vs release.
1 parent 0277759 commit bb5ee73

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

.github/workflows/fix_compile_commands.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ def main():
3131
# Replace GCC warning argument with one Clang recognizes
3232
elif arg == "-Wno-maybe-uninitialized":
3333
out_args.append("-Wno-uninitialized")
34+
# Skip GCC-specific warning argument
35+
elif arg == "-Wno-error=restrict":
36+
pass
3437
else:
3538
out_args.append(arg)
3639

benchmark/build.gradle

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,11 @@ tasks.register('deployStatic') {
181181
model {
182182
components {
183183
benchmarkCpp(NativeExecutableSpec) {
184-
targetBuildTypes 'debug'
184+
if (project.hasProperty('ciDebugOnly')) {
185+
targetBuildTypes 'debug'
186+
} else {
187+
targetBuildTypes 'release'
188+
}
185189
sources {
186190
cpp {
187191
source {
@@ -235,7 +239,11 @@ model {
235239
}
236240
}
237241
benchmarkCppStatic(NativeExecutableSpec) {
238-
targetBuildTypes 'debug'
242+
if (project.hasProperty('ciDebugOnly')) {
243+
targetBuildTypes 'debug'
244+
} else {
245+
targetBuildTypes 'release'
246+
}
239247
nativeUtils.excludeBinariesFromStrip(it)
240248
sources {
241249
cpp {

shared/config.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ nativeUtils.platformConfigs.each {
3939
}
4040
}
4141

42-
// Compress debug info on Linux
4342
nativeUtils.platformConfigs.each {
4443
if (it.name.contains('linux')) {
44+
// Compress debug info on Linux
4545
it.cppCompiler.debugArgs.add("-gz=zlib")
4646
// Make warning in OpenCV 4.10 from GCC 15 not an error
4747
it.cppCompiler.args.add("-Wno-error=overloaded-virtual")
48+
// Make warning from Google Benchmark not an error
49+
it.cppCompiler.args.add("-Wno-error=restrict")
4850
}
4951
}
5052

shared/jni/setupBuild.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,11 @@ model {
148148
// By default, a development executable will be generated. This is to help the case of
149149
// testing specific functionality of the library.
150150
"${nativeName}Dev"(NativeExecutableSpec) {
151-
targetBuildTypes 'debug'
151+
if (project.hasProperty('ciDebugOnly') || project.hasProperty('debugJNI')) {
152+
targetBuildTypes 'debug'
153+
} else {
154+
targetBuildTypes 'release'
155+
}
152156
sources {
153157
cpp {
154158
source {

0 commit comments

Comments
 (0)