Skip to content

Commit

Permalink
Set to actual version of 1.5.3 - apply patch file for clang fix
Browse files Browse the repository at this point in the history
Signed-off-by: aseiwert <adam.seiwert@ngc.com>
  • Loading branch information
aseiwert committed Jul 15, 2023
1 parent 2bc9a26 commit 46bfc89
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 4 deletions.
34 changes: 34 additions & 0 deletions 0001-NFCI-Drop-warning-to-satisfy-clang-s-Wunused-but-set.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From e991355c02b93fe17713efe04cbc2e278e00fdbd Mon Sep 17 00:00:00 2001
From: Roman Lebedev <lebedev.ri@gmail.com>
Date: Wed, 9 Jun 2021 11:52:12 +0300
Subject: [PATCH] [NFCI] Drop warning to satisfy clang's
-Wunused-but-set-variable diag (#1174)

Fixes https://github.com/google/benchmark/issues/1172
---
src/complexity.cc | 2 --
1 file changed, 2 deletions(-)

diff --git a/src/complexity.cc b/src/complexity.cc
index d74b146..29f7c3b 100644
--- a/src/complexity.cc
+++ b/src/complexity.cc
@@ -82,7 +82,6 @@ std::string GetBigOString(BigO complexity) {
LeastSq MinimalLeastSq(const std::vector<int64_t>& n,
const std::vector<double>& time,
BigOFunc* fitting_curve) {
- double sigma_gn = 0.0;
double sigma_gn_squared = 0.0;
double sigma_time = 0.0;
double sigma_time_gn = 0.0;
@@ -90,7 +89,6 @@ LeastSq MinimalLeastSq(const std::vector<int64_t>& n,
// Calculate least square fitting parameter
for (size_t i = 0; i < n.size(); ++i) {
double gn_i = fitting_curve(n[i]);
- sigma_gn += gn_i;
sigma_gn_squared += gn_i * gn_i;
sigma_time += time[i];
sigma_time_gn += time[i] * gn_i;
--
2.34.1

9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif()
macro(build_benchmark)
set(extra_cmake_args)

set(GOOGLE_BENCHMARK_TARGET_VERSION "1.6.1")
set(GOOGLE_BENCHMARK_TARGET_VERSION "1.5.3")

if(DEFINED CMAKE_BUILD_TYPE)
list(APPEND extra_cmake_args -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
Expand Down Expand Up @@ -56,7 +56,7 @@ macro(build_benchmark)

externalproject_add(benchmark-${GOOGLE_BENCHMARK_TARGET_VERSION}
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG 0d98dba29d66e93259db7daa53a9327df767a415 # v${GOOGLE_BENCHMARK_TARGET_VERSION}
GIT_TAG c05843a9f622db08ad59804c190f98879b76beba # v${GOOGLE_BENCHMARK_TARGET_VERSION}
GIT_CONFIG advice.detachedHead=false
# Suppress git update due to https://gitlab.kitware.com/cmake/cmake/-/issues/16419
# See https://github.com/ament/uncrustify_vendor/pull/22 for details
Expand All @@ -66,7 +66,8 @@ macro(build_benchmark)
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_install
${extra_cmake_args}
PATCH_COMMAND
${CMAKE_COMMAND} -E chdir <SOURCE_DIR> git apply -p1 --ignore-space-change --whitespace=nowarn ${CMAKE_CURRENT_SOURCE_DIR}/thread_safety_attributes.patch
COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> git apply -p1 --ignore-space-change --whitespace=nowarn ${CMAKE_CURRENT_SOURCE_DIR}/thread_safety_attributes.patch
COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> git apply -p1 --ignore-space-change --whitespace=nowarn ${CMAKE_CURRENT_SOURCE_DIR}/0001-NFCI-Drop-warning-to-satisfy-clang-s-Wunused-but-set.patch
)

# The external project will install to the build folder, but we'll install that on make install.
Expand All @@ -79,7 +80,7 @@ macro(build_benchmark)
)
endmacro()

if(NOT benchmark_FOUND OR "${benchmark_VERSION}" VERSION_LESS 1.6.1)
if(NOT benchmark_FOUND OR "${benchmark_VERSION}" VERSION_LESS 1.5.3)
build_benchmark()
elseif(benchmark_FOUND)
# Ubuntu Focal and Jammy have a packaging bug where libbenchmark_main has no symbols,
Expand Down

0 comments on commit 46bfc89

Please sign in to comment.