microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
23.25k stars 6.41k forks source link

[benchmark] auto define BENCHMARK_STATIC_DEFINE at static-md triplet #40251

Open TomieAi opened 3 months ago

TomieAi commented 3 months ago

Is your feature request related to a problem? Please describe.

if u installed benchmark with x64-windows-static-md as triplet its gona throw some external resolve error

I was puzzled why it dint work at static-md i thought its not compatible xD until I read on the export.h it seems u have to define BENCHMARK_STATIC_DEFINE if u want to use it on static-md.. but that breaks the convenience of vcpkg static-md triplet config.

Proposed solution

please just auto define BENCHMARK_STATIC_DEFINE this when static-md was used.

Describe alternatives you've considered

for now im doing this.. if I dint stumble on export.h I probably gave up on it right now xD

#define BENCHMARK_STATIC_DEFINE
#include <benchmark/benchmark.h>
#pragma comment ( lib, "Shlwapi.lib" )

Additional context

image

Error occurred by default that will puzzle you when u are in static-md mode.

image

FrankXie05 commented 1 month ago

@TomieAi This macro BENCHMARK_STATIC_DEFINE has been marked as a public macro by upstream. And vcpkg has also been updated to the latest version to merge this content. Please use the latest vcpkg to install the latest benchmark. :)

Upstream: https://github.com/google/benchmark/issues/1457 https://github.com/google/benchmark/pull/1470 Code: https://github.com/google/benchmark/blob/12235e24652fc7f809373e7c11a5f73c5763fc4c/src/CMakeLists.txt#L71

dg0yt commented 1 month ago

@FrankXie05 "Burn-in library linkage" to resolve the issue for msbuild.