gnu: Add benchmark.

* gnu/packages/benchmark.scm(benchmark): New variable.
* gnu/packages/patches/benchmark-unbundle-googletest.patch: New file.
* gnu/local.mk(dist_patch_DATA): Add it.
This commit is contained in:
Gábor Boskovits 2019-06-14 23:07:56 +02:00
parent bc70516bba
commit 4c7e8c234d
No known key found for this signature in database
GPG Key ID: 2506A96CCF630B21
3 changed files with 99 additions and 1 deletions

View File

@ -15,7 +15,7 @@
# Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
# Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
# Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
# Copyright © 2017, 2018 Gábor Boskovits <boskovits@gmail.com>
# Copyright © 2017, 2018, 2019 Gábor Boskovits <boskovits@gmail.com>
# Copyright © 2018 Amirouche Boubekki <amirouche@hypermove.net>
# Copyright © 2018, 2019 Oleg Pykhalov <go.wigust@gmail.com>
# Copyright © 2018 Stefan Stefanović <stefanx2ovic@gmail.com>
@ -691,6 +691,7 @@ dist_patch_DATA = \
%D%/packages/patches/bazaar-CVE-2017-14176.patch \
%D%/packages/patches/beets-python-3.7-fix.patch \
%D%/packages/patches/beignet-correct-file-names.patch \
%D%/packages/patches/benchmark-unbundle-googletest.patch \
%D%/packages/patches/biber-fix-encoding-write.patch \
%D%/packages/patches/binutils-loongson-workaround.patch \
%D%/packages/patches/blender-2.79-newer-ffmpeg.patch \

View File

@ -4,6 +4,7 @@
;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2019 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2019 Gábor Boskovits <boskovits@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@ -25,7 +26,10 @@
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix build-system cmake)
#:use-module (guix build-system gnu)
#:use-module (gnu packages)
#:use-module (gnu packages check)
#:use-module (gnu packages compression)
#:use-module (gnu packages linux)
#:use-module (gnu packages maths)
@ -193,3 +197,27 @@ extension to @code{time} which runs a command multiple times and prints the
timing means, standard deviations, mins, medians, and maxes having done so.
This can give a much better understanding of the command's performance.")
(license license:expat)))
(define-public benchmark
(package
(name "benchmark")
(version "1.5.0")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/google/benchmark.git")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"0r9dbg4cbk47gwmayys31a83m3y67k0kh1f6pl8i869rbd609ndh"))
(patches (search-patches "benchmark-unbundle-googletest.patch"))))
(build-system cmake-build-system)
(native-inputs
`(("googletest" ,googletest)))
(home-page "https://github.com/google/benchmark")
(synopsis "Microbenchmark support library")
(description
"Benchmark is a library to benchmark code snippets,
similar to unit tests.")
(license license:asl2.0)))

View File

@ -0,0 +1,69 @@
From 5eb306618196ea78b8c9390e22ea2edce20760fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=A1bor=20Boskovits?= <boskovits@gmail.com>
Date: Fri, 14 Jun 2019 22:15:49 +0200
Subject: [PATCH] Remove googletest lookup from build system.
---
cmake/GoogleTest.cmake | 18 +++++++++---------
cmake/GoogleTest.cmake.in | 12 ++++++------
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/cmake/GoogleTest.cmake b/cmake/GoogleTest.cmake
index fb7c6be..a6c473b 100644
--- a/cmake/GoogleTest.cmake
+++ b/cmake/GoogleTest.cmake
@@ -27,15 +27,15 @@ endif()
# settings on Windows
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
-include(${GOOGLETEST_PREFIX}/googletest-paths.cmake)
+#include(${GOOGLETEST_PREFIX}/googletest-paths.cmake)
# Add googletest directly to our build. This defines
# the gtest and gtest_main targets.
-add_subdirectory(${GOOGLETEST_SOURCE_DIR}
- ${GOOGLETEST_BINARY_DIR}
- EXCLUDE_FROM_ALL)
-
-set_target_properties(gtest PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gtest,INTERFACE_INCLUDE_DIRECTORIES>)
-set_target_properties(gtest_main PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gtest_main,INTERFACE_INCLUDE_DIRECTORIES>)
-set_target_properties(gmock PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gmock,INTERFACE_INCLUDE_DIRECTORIES>)
-set_target_properties(gmock_main PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gmock_main,INTERFACE_INCLUDE_DIRECTORIES>)
+#add_subdirectory(${GOOGLETEST_SOURCE_DIR}
+# ${GOOGLETEST_BINARY_DIR}
+# EXCLUDE_FROM_ALL)
+
+#set_target_properties(gtest PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gtest,INTERFACE_INCLUDE_DIRECTORIES>)
+#set_target_properties(gtest_main PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gtest_main,INTERFACE_INCLUDE_DIRECTORIES>)
+#set_target_properties(gmock PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gmock,INTERFACE_INCLUDE_DIRECTORIES>)
+#set_target_properties(gmock_main PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gmock_main,INTERFACE_INCLUDE_DIRECTORIES>)
diff --git a/cmake/GoogleTest.cmake.in b/cmake/GoogleTest.cmake.in
index 28818ee..13b0888 100644
--- a/cmake/GoogleTest.cmake.in
+++ b/cmake/GoogleTest.cmake.in
@@ -31,7 +31,7 @@ if(EXISTS "${GOOGLETEST_PATH}" AND IS_DIRECTORY "${GOOGLETEST_PATH}"
)
else()
if(NOT ALLOW_DOWNLOADING_GOOGLETEST)
- message(SEND_ERROR "Did not find Google Test sources! Either pass correct path in GOOGLETEST_PATH, or enable ALLOW_DOWNLOADING_GOOGLETEST, or disable BENCHMARK_ENABLE_GTEST_TESTS / BENCHMARK_ENABLE_TESTING.")
+ message(WARNING "Did not find Google Test sources! Either pass correct path in GOOGLETEST_PATH, or enable ALLOW_DOWNLOADING_GOOGLETEST, or disable BENCHMARK_ENABLE_GTEST_TESTS / BENCHMARK_ENABLE_TESTING.")
else()
message(WARNING "Did not find Google Test sources! Fetching from web...")
ExternalProject_Add(
@@ -51,8 +51,8 @@ else()
endif()
endif()
-ExternalProject_Get_Property(googletest SOURCE_DIR BINARY_DIR)
-file(WRITE googletest-paths.cmake
-"set(GOOGLETEST_SOURCE_DIR \"${SOURCE_DIR}\")
-set(GOOGLETEST_BINARY_DIR \"${BINARY_DIR}\")
-")
+#ExternalProject_Get_Property(googletest SOURCE_DIR BINARY_DIR)
+#file(WRITE googletest-paths.cmake
+#"set(GOOGLETEST_SOURCE_DIR \"${SOURCE_DIR}\")
+#set(GOOGLETEST_BINARY_DIR \"${BINARY_DIR}\")
+#")
--
2.22.0