Skip to content

Commit

Permalink
Upgrade Google Benchmark to latest v1.5.3 in git submodule and for CM…
Browse files Browse the repository at this point in the history
…ake-vcpkg build on Windows (#748)
  • Loading branch information
maxgolov authored May 20, 2021
1 parent b706993 commit 227d400
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tools/ports/benchmark/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: benchmark
Version: 1.5.1
Version: 1.5.3
Homepage: https://github.com/google/benchmark
Description: A library to support the benchmarking of functions, similar to unit-tests.
Supports: !uwp
Supports: !(arm|uwp)
15 changes: 8 additions & 7 deletions tools/ports/benchmark/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
message(FATAL_ERROR "${PORT} does not currently support UWP")
endif()

if (VCPKG_PLATFORM_TOOLSET STREQUAL "v140")
# set(CMAKE_C_COMPILER_WORKS 1)
# set(CMAKE_CXX_COMPILER_WORKS 1)
Expand All @@ -17,14 +13,18 @@ else()
set(PREFER PREFER_NINJA)
endif()

include(vcpkg_common_functions)
#https://github.com/google/benchmark/issues/661
vcpkg_fail_port_install(ON_TARGET "uwp")

vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO google/benchmark
REF c05843a9f622db08ad59804c190f98879b76beba # v1.5.3
SHA512 1
HEAD_REF master
PATCHES "version.patch"
)

vcpkg_configure_cmake(
Expand All @@ -41,9 +41,10 @@ vcpkg_copy_pdbs()

vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/benchmark)

vcpkg_fixup_pkgconfig(SYSTEM_LIBRARIES pthread)

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)

# Handle copyright
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/benchmark)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/benchmark/LICENSE ${CURRENT_PACKAGES_DIR}/share/benchmark/copyright)
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
34 changes: 34 additions & 0 deletions tools/ports/benchmark/version.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1007254..47e4a1b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -78,8 +78,9 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")


# Read the git tags to determine the project version
-include(GetGitVersion)
-get_git_version(GIT_VERSION)
+# include(GetGitVersion)
+# get_git_version(GIT_VERSION)
+set(GIT_VERSION 1.5.3)

# Tell the user what versions we are using
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION ${GIT_VERSION})
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 35d559e..e9dec6d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -77,9 +77,13 @@ set(targets_export_name "${PROJECT_NAME}Targets")
set(namespace "${PROJECT_NAME}::")

include(CMakePackageConfigHelpers)
+# Avoid architecture compatibility check
+set(DOCTEST_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
+unset(CMAKE_SIZEOF_VOID_P)
write_basic_package_version_file(
"${version_config}" VERSION ${GENERIC_LIB_VERSION} COMPATIBILITY SameMajorVersion
)
+set(CMAKE_SIZEOF_VOID_P ${DOCTEST_SIZEOF_VOID_P})

configure_file("${PROJECT_SOURCE_DIR}/cmake/Config.cmake.in" "${project_config}" @ONLY)
configure_file("${PROJECT_SOURCE_DIR}/cmake/benchmark.pc.in" "${pkg_config}" @ONLY)

0 comments on commit 227d400

Please sign in to comment.