diff options
author | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2018-11-07 11:50:12 +0200 |
---|---|---|
committer | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2018-11-08 14:19:23 +0200 |
commit | 86d2e928f200613da4232e7a53070c35a5848f02 (patch) | |
tree | 5e5c1182a1235cbae55fef05b3538c47b54cc19c | |
parent | 7cee81abfa12ab4897de45188b787a43f652ef9f (diff) |
[core] Vendor libbenchmark
Prebuilt binaries for libbenchmark might be incompatible with some
environments, for example, when mbgl-benchmark target is compiled
on host with GCC and linked against mason's clang 5.0 compiled binaries.
Vendored libbenchmark avoids aforementioned issue, as the target and
the binary compiled with same compiler / options.
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | cmake/benchmark.cmake | 3 | ||||
-rw-r--r-- | cmake/mason-dependencies.cmake | 2 | ||||
-rw-r--r-- | cmake/vendor.cmake | 1 | ||||
m--------- | vendor/benchmark | 0 | ||||
-rw-r--r-- | vendor/benchmark.cmake | 25 |
6 files changed, 30 insertions, 4 deletions
diff --git a/.gitmodules b/.gitmodules index 236abddd1..078c98c82 100644 --- a/.gitmodules +++ b/.gitmodules @@ -61,3 +61,6 @@ [submodule "vendor/boost"] path = vendor/boost url = https://github.com/mapbox/mapbox-gl-native-boost.git +[submodule "vendor/benchmark"] + path = vendor/benchmark + url = https://github.com/google/benchmark.git diff --git a/cmake/benchmark.cmake b/cmake/benchmark.cmake index dd47766b9..b5452a573 100644 --- a/cmake/benchmark.cmake +++ b/cmake/benchmark.cmake @@ -11,10 +11,9 @@ target_include_directories(mbgl-benchmark target_link_libraries(mbgl-benchmark PRIVATE mbgl-core + PRIVATE benchmark ) -target_add_mason_package(mbgl-benchmark PRIVATE benchmark) - mbgl_platform_benchmark() create_source_groups(mbgl-benchmark) diff --git a/cmake/mason-dependencies.cmake b/cmake/mason-dependencies.cmake index b5b1b7407..3a7a3f2ef 100644 --- a/cmake/mason-dependencies.cmake +++ b/cmake/mason-dependencies.cmake @@ -12,7 +12,6 @@ elseif(MBGL_PLATFORM STREQUAL "linux") mason_use(libuv VERSION 1.9.1) mason_use(libpng VERSION 1.6.25) mason_use(libjpeg-turbo VERSION 1.5.0) - mason_use(benchmark VERSION 1.4.1${MASON_CXXABI_SUFFIX}) mason_use(args VERSION 6.2.0 HEADER_ONLY) if(WITH_EGL) @@ -20,7 +19,6 @@ elseif(MBGL_PLATFORM STREQUAL "linux") endif() elseif(MBGL_PLATFORM STREQUAL "macos") mason_use(glfw VERSION 2018-06-27-0be4f3f) - mason_use(benchmark VERSION 1.4.1) mason_use(args VERSION 6.2.0 HEADER_ONLY) if(WITH_EGL) diff --git a/cmake/vendor.cmake b/cmake/vendor.cmake index e66a0cad2..760754486 100644 --- a/cmake/vendor.cmake +++ b/cmake/vendor.cmake @@ -3,6 +3,7 @@ execute_process( WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/vendor ) +include(${CMAKE_SOURCE_DIR}/vendor/benchmark.cmake) include(${CMAKE_SOURCE_DIR}/vendor/boost.cmake) include(${CMAKE_SOURCE_DIR}/vendor/earcut.hpp.cmake) include(${CMAKE_SOURCE_DIR}/vendor/expected.cmake) diff --git a/vendor/benchmark b/vendor/benchmark new file mode 160000 +Subproject e776aa0275e293707b6a0901e0e8d8a8a367950 diff --git a/vendor/benchmark.cmake b/vendor/benchmark.cmake new file mode 100644 index 000000000..516e3cd33 --- /dev/null +++ b/vendor/benchmark.cmake @@ -0,0 +1,25 @@ +add_library(benchmark STATIC + ${CMAKE_SOURCE_DIR}/vendor/benchmark/src/commandlineflags.cc + ${CMAKE_SOURCE_DIR}/vendor/benchmark/src/console_reporter.cc + ${CMAKE_SOURCE_DIR}/vendor/benchmark/src/complexity.cc + ${CMAKE_SOURCE_DIR}/vendor/benchmark/src/csv_reporter.cc + ${CMAKE_SOURCE_DIR}/vendor/benchmark/src/colorprint.cc + ${CMAKE_SOURCE_DIR}/vendor/benchmark/src/sleep.cc + ${CMAKE_SOURCE_DIR}/vendor/benchmark/src/benchmark.cc + ${CMAKE_SOURCE_DIR}/vendor/benchmark/src/counter.cc + ${CMAKE_SOURCE_DIR}/vendor/benchmark/src/benchmark_register.cc + ${CMAKE_SOURCE_DIR}/vendor/benchmark/src/statistics.cc + ${CMAKE_SOURCE_DIR}/vendor/benchmark/src/json_reporter.cc + ${CMAKE_SOURCE_DIR}/vendor/benchmark/src/reporter.cc + ${CMAKE_SOURCE_DIR}/vendor/benchmark/src/string_util.cc + ${CMAKE_SOURCE_DIR}/vendor/benchmark/src/sysinfo.cc + ${CMAKE_SOURCE_DIR}/vendor/benchmark/src/timers.cc +) + +target_compile_definitions(benchmark PRIVATE + HAVE_STEADY_CLOCK +) + +target_include_directories(benchmark SYSTEM PUBLIC + ${CMAKE_SOURCE_DIR}/vendor/benchmark/include +) |