From 1163e31a4dcce1d1170aca401d0d5514a22ac0aa Mon Sep 17 00:00:00 2001 From: Matt Armstrong Date: Sun, 7 Nov 2021 20:31:26 -0800 Subject: [PATCH] google-benchmark: build as a static library This partially fixes the Windows build, which was broken because the upstream package does not use Visual Studio specific code annotations like __dllspec(dllexport) or any other mechanism for exporting symbols. There are two other reasons to fix it this way: Upstream uses CMake's WINDOWS_EXPORT_ALL_SYMBOLS feature to deal with the issue for DLL builds. Meson does not have a similar feature (see https://github.com/mesonbuild/meson/issues/2132). Google typically links benchmarks statically, so linking statically even on non-Windows builds is closer to the way upstream typically uses the library. --- subprojects/packagefiles/google-benchmark/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subprojects/packagefiles/google-benchmark/meson.build b/subprojects/packagefiles/google-benchmark/meson.build index d2b798347..2230d486f 100644 --- a/subprojects/packagefiles/google-benchmark/meson.build +++ b/subprojects/packagefiles/google-benchmark/meson.build @@ -30,7 +30,7 @@ inc = include_directories('include') thread_dep = dependency('threads') -lib_benchmark = library('gbenchmark', +lib_benchmark = static_library('gbenchmark', benchmark_sources, include_directories:inc, cpp_args : '-DNDEBUG', @@ -40,7 +40,7 @@ google_benchmark_dep = declare_dependency( link_with:lib_benchmark, include_directories:inc) -lib_benchmark_main = library('benchmark-main', +lib_benchmark_main = static_library('benchmark-main', benchmark_main_sources, include_directories:inc, cpp_args : '-DNDEBUG',