From 227d400479c8b43d8cfa2339a95b52c35511199e Mon Sep 17 00:00:00 2001 From: Max Golovanov Date: Thu, 20 May 2021 11:54:03 -0700 Subject: [PATCH] Upgrade Google Benchmark to latest v1.5.3 in git submodule and for CMake-vcpkg build on Windows (#748) --- third_party/benchmark | 2 +- tools/ports/benchmark/CONTROL | 4 ++-- tools/ports/benchmark/portfile.cmake | 15 ++++++------ tools/ports/benchmark/version.patch | 34 ++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 tools/ports/benchmark/version.patch diff --git a/third_party/benchmark b/third_party/benchmark index 73d4d5e8d6..c05843a9f6 160000 --- a/third_party/benchmark +++ b/third_party/benchmark @@ -1 +1 @@ -Subproject commit 73d4d5e8d6d449fc8663765a42aa8aeeee844489 +Subproject commit c05843a9f622db08ad59804c190f98879b76beba diff --git a/tools/ports/benchmark/CONTROL b/tools/ports/benchmark/CONTROL index 62b80dffae..4e522eb83d 100644 --- a/tools/ports/benchmark/CONTROL +++ b/tools/ports/benchmark/CONTROL @@ -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 \ No newline at end of file +Supports: !(arm|uwp) diff --git a/tools/ports/benchmark/portfile.cmake b/tools/ports/benchmark/portfile.cmake index e89fafca6c..5a2779c493 100644 --- a/tools/ports/benchmark/portfile.cmake +++ b/tools/ports/benchmark/portfile.cmake @@ -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) @@ -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( @@ -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) diff --git a/tools/ports/benchmark/version.patch b/tools/ports/benchmark/version.patch new file mode 100644 index 0000000000..067dc58927 --- /dev/null +++ b/tools/ports/benchmark/version.patch @@ -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)