mirror of
https://github.com/google/benchmark.git
synced 2024-12-26 12:30:14 +08:00
* Update with instructions to build under Visual Studio Fixes Issue #634. I spent 3 days trying to build this library under Visual Studio 2017, only to discover on has to link to `Shlwapi.lib`. Became so frustrated with the docs that I added full build instructions for Visual Studio 2015, 2017 and Intel Comiler 2015 and 2019. * Update headings
This commit is contained in:
parent
ef7d51c8eb
commit
bf4f2ea0bd
36
README.md
36
README.md
@ -52,6 +52,8 @@ The following minimum versions are required to build the library:
|
||||
* Visual Studio 14 2015
|
||||
* Intel 2015 Update 1
|
||||
|
||||
See [Platform-Specific Build Instructions](#platform-specific-build-instructions).
|
||||
|
||||
## Installation
|
||||
|
||||
This describes the installation process using cmake. As pre-requisites, you'll
|
||||
@ -190,7 +192,9 @@ Alternatively, link against the `benchmark_main` library and remove
|
||||
The compiled executable will run all benchmarks by default. Pass the `--help`
|
||||
flag for option information or see the guide below.
|
||||
|
||||
### Platform-specific instructions
|
||||
## Platform Specific Build Instructions
|
||||
|
||||
### Building with GCC
|
||||
|
||||
When the library is built using GCC it is necessary to link with the pthread
|
||||
library due to how GCC implements `std::thread`. Failing to link to pthread will
|
||||
@ -200,8 +204,34 @@ can link to pthread by adding `-pthread` to your linker command. Note, you can
|
||||
also use `-lpthread`, but there are potential issues with ordering of command
|
||||
line parameters if you use that.
|
||||
|
||||
If you're running benchmarks on Windows, the shlwapi library (`-lshlwapi`) is
|
||||
also required.
|
||||
### Building with Visual Studio 2015 or 2017
|
||||
|
||||
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:
|
||||
|
||||
```
|
||||
// Alternatively, can add libraries using linker options.
|
||||
#ifdef _WIN32
|
||||
#pragma comment ( lib, "Shlwapi.lib" )
|
||||
#ifdef _DEBUG
|
||||
#pragma comment ( lib, "benchmarkd.lib" )
|
||||
#else
|
||||
#pragma comment ( lib, "benchmark.lib" )
|
||||
#endif
|
||||
#endif
|
||||
```
|
||||
|
||||
Can also use the graphical version of CMake:
|
||||
* Open `CMake GUI`.
|
||||
* Under `Where to build the binaries`, same path as source plus `build`.
|
||||
* Under `CMAKE_INSTALL_PREFIX`, same path as source plus `install`.
|
||||
* Click `Configure`, `Generate`, `Open Project`.
|
||||
* If build fails, try deleting entire directory and starting again, or unticking options to build less.
|
||||
|
||||
### Building with Intel 2015 Update 1 or Intel System Studio Update 4
|
||||
|
||||
See instructions for building with Visual Studio. Once built, right click on the solution and change the build to Intel.
|
||||
|
||||
### Building on Solaris
|
||||
|
||||
If you're running benchmarks on solaris, you'll want the kstat library linked in
|
||||
too (`-lkstat`).
|
||||
|
Loading…
Reference in New Issue
Block a user