From c83742fd7368540f23bbe45f9a2d5d7ce7f00717 Mon Sep 17 00:00:00 2001 From: Egor Skryabin Date: Fri, 9 Oct 2026 00:50:00 +0300 Subject: [PATCH] Made a bit clearer platform_specific_build_instructions.md --- CONTRIBUTORS | 1 + docs/platform_specific_build_instructions.md | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 74e5fe958..fda25664b 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -45,6 +45,7 @@ Dominik Czarnota Dominik Korman Donald Aingworth Doug Evans +Egor Skryabin Eric Backus Eric Fiselier Eugene Zhuk diff --git a/docs/platform_specific_build_instructions.md b/docs/platform_specific_build_instructions.md index 5c1439d0a..129d806d6 100644 --- a/docs/platform_specific_build_instructions.md +++ b/docs/platform_specific_build_instructions.md @@ -15,9 +15,10 @@ On QNX, the pthread library is part of libc and usually included automatically [`pthread_create()`](https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.lib_ref/topic/p/pthread_create.html)). There's no separate pthread library to link. -## Building with Visual Studio 2015, 2017 or 2022 +## Building on Windows -The `shlwapi` library (`-lshlwapi`) is required to support a call to `CPUInfo` which reads the registry. Either add `shlwapi.lib` under `[ Configuration Properties > Linker > Input ]`, or use the following: +The `shlwapi` library (`-lshlwapi`) is required to support a call to `CPUInfo` which reads the registry. +If you are building with Visual Studio (2015, 2017 or 2022) either add `shlwapi.lib` under `[ Configuration Properties > Linker > Input ]`, or use the following: ``` // Alternatively, can add libraries using linker options. @@ -33,7 +34,11 @@ The `shlwapi` library (`-lshlwapi`) is required to support a call to `CPUInfo` w #endif ``` -When using the static library, make sure to add `BENCHMARK_STATIC_DEFINE` under `[Configuration Properties > C/C++ > Preprocessor > Preprocessor Definitions]` +When using the static library, make sure to add `BENCHMARK_STATIC_DEFINE` (For Visual Studio under `[Configuration Properties > C/C++ > Preprocessor > Preprocessor Definitions]`). + +When using MingGW GCC toolchain for your project, compilation command might look like this (libbenchmark.a in the same directory as test_benchmark.cpp): + +`g++ test_benchmark.cpp -DBENCHMARK_STATIC_DEFINE -isystem "C:\\Program Files\\vcpkg\\installed\\x64-mingw-static\\include" -L "C:\\Program Files\\vcpkg\\installed\\x64-mingw-static\\lib" -lbenchmark -lpthread -o benchmark_test.exe` Can also use the graphical version of CMake: * Open `CMake GUI`.