[benchmark] Initial commit for Google Benchmark library

This commit is contained in:
Arkadiy Shapkin 2017-05-10 02:43:39 +03:00
parent add9255538
commit 5fb2f60085
3 changed files with 72 additions and 0 deletions

3
ports/benchmark/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: benchmark
Version: 1.1.0
Description: A library to support the benchmarking of functions, similar to unit-tests.

View File

@ -0,0 +1,27 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4038875..94d2aea 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -28,17 +28,20 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
endif()
# Expose public API
-target_include_directories(benchmark PUBLIC ${PROJECT_SOURCE_DIR}/include)
+target_include_directories(benchmark PRIVATE ${PROJECT_SOURCE_DIR}/include)
# Install target (will install the library to specified CMAKE_INSTALL_PREFIX variable)
install(
TARGETS benchmark
+ EXPORT benchmarkTargets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
- COMPONENT library)
+ INCLUDES DESTINATION include)
install(
DIRECTORY "${PROJECT_SOURCE_DIR}/include/benchmark"
DESTINATION include
FILES_MATCHING PATTERN "*.*h")
+
+install(EXPORT benchmarkTargets NAMESPACE benchmark:: DESTINATION share/benchmark)

View File

@ -0,0 +1,42 @@
if(VCPKG_CRT_LINKAGE STREQUAL static)
message(FATAL_ERROR "Google benchmark only supports dynamic crt linkage.")
endif()
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
message(STATUS "Warning: Dynamic building not supported yet. Building static.")
set(VCPKG_LIBRARY_LINKAGE static)
endif()
include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO google/benchmark
REF v1.1.0
SHA512 533061531e6a37723a626addc9e779018c4c2cfc8634ae45860eec0d3800103b5b562f865ac1dc0c8dbe045579b81e59de887e1c48318cebf160f03c18321831
HEAD_REF master
)
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES "${CMAKE_CURRENT_LIST_DIR}/fix-cmakelists.patch"
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DBENCHMARK_ENABLE_TESTING=OFF
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# 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)