Commit 62a9d756 by Alex Strelnikov Committed by Dominic Hamon

Update bazel WORKSPACE and BUILD files to work better on Windows. (#581)

Note, bazel only supports MSVC on Windows, and not MinGW, so linking against shlwapi.lib only needs to follow MSVC conventions. git_repository() did not work in local testing, so is swapped for http_archive(). The latter is also documented as the preferred way to depend on an external library in bazel.
parent b678a202
...@@ -16,7 +16,7 @@ cc_library( ...@@ -16,7 +16,7 @@ cc_library(
]), ]),
hdrs = ["include/benchmark/benchmark.h"], hdrs = ["include/benchmark/benchmark.h"],
linkopts = select({ linkopts = select({
":windows": [], ":windows": ["-DEFAULTLIB:shlwapi.lib"],
"//conditions:default": ["-pthread"], "//conditions:default": ["-pthread"],
}), }),
strip_include_prefix = "include", strip_include_prefix = "include",
......
...@@ -73,7 +73,7 @@ We need to install the library globally now ...@@ -73,7 +73,7 @@ We need to install the library globally now
sudo make install sudo make install
``` ```
Now you have google/benchmark installed in your machine Now you have google/benchmark installed in your machine
Note: Don't forget to link to pthread library while building Note: Don't forget to link to pthread library while building
## Stable and Experimental Library Versions ## Stable and Experimental Library Versions
...@@ -933,7 +933,7 @@ sudo cpupower frequency-set --governor powersave ...@@ -933,7 +933,7 @@ sudo cpupower frequency-set --governor powersave
# Known Issues # Known Issues
### Windows ### Windows with CMake
* Users must manually link `shlwapi.lib`. Failure to do so may result * Users must manually link `shlwapi.lib`. Failure to do so may result
in unresolved symbols. in unresolved symbols.
......
workspace(name = "com_github_google_benchmark") workspace(name = "com_github_google_benchmark")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") http_archive(
name = "com_google_googletest",
git_repository( urls = ["https://github.com/google/googletest/archive/3f0cf6b62ad1eb50d8736538363d3580dd640c3e.zip"],
name = "com_google_googletest", strip_prefix = "googletest-3f0cf6b62ad1eb50d8736538363d3580dd640c3e",
commit = "3f0cf6b62ad1eb50d8736538363d3580dd640c3e", # HEAD
remote = "https://github.com/google/googletest",
) )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment