Commit Graph

84 Commits

Author SHA1 Message Date
dominic c45d9c4c2f
bump googletest version to match bazel (#1868)
* bump googletest version to match bazel

* bump minimum cmake to 3.13 per supported versions
2024-10-24 09:46:02 +01:00
Alfredo Daniel Esponda Cervantes 23d8c1e589
Version string correction in pkg-config files (#1858)
Co-authored-by: Alfredo Daniel Esponda Cervantes <92197886+DanEC1211@users.noreply.github.com>
2024-09-26 17:56:16 +01:00
Chris Cotter 71f4218c1a
Add -lkstat to the .pc for Solaris (#1801)
* Add -lkstat to the .pc for Solaris

This fixes linking for projects that rely on pkg-config to generate the
link line on Solaris.

Test plan: Built the project locally on Solaris and verified -kstat
appears in the .pc file

```
$ cat lib/pkgconfig/benchmark.pc  | grep Libs.private
Libs.private: -lpthread -lkstat
```

* Use BENCHMARK_PRIVATE_LINK_LIBRARIES
2024-07-03 21:16:43 +03:00
Stephen Nicholas Swatman c2146397ac
Find libpfm dependency in installed CMake configs (#1806)
Currently, Google Benchmark can be built and installed with support for
libpfm, but this can cause a problem if that installation is later
called upon by another CMake project. Indeed, while the installed CMake
configuration script correctly identifies that it needs to link against
libpfm, it doesn't try to find libpfm, meaning that the target will be
unavailable. This commit fixes this potential configuration-time error
by ensuring that an installation of Google Benchmark will correctly try
to find the libpfm dependency when it is used elsewhere.
2024-06-19 21:03:42 +03:00
David Seifert c0105603f6
Add `benchmark_main.pc` to link `main()` containing library (#1779)
This is similar to the addition in 8604c4adac (diff-eb8e49bdf5e9aafb996777a4f4302ad1efd281222bf3202eb9b77ce47496c345)
that added pkg-config support in GTest. Without this, users
need to manually find the library containing `main()`.
2024-04-14 19:05:36 +03:00
Roman Lebedev 17bc235ab3
Output library / schema versions in JSON context block (#1742)
* CMake: `get_git_version()`: just use `--dirty` flag of `git describe`

* CMake: move version normalization out of `get_git_version()`

Mainly, i want `get_git_version()` to return true version,
not something sanitized.

* JSON reporter: store library version and schema version in `context`

* Tools: discard inputs with unexpected `json_schema_version`

* Extract version string into `GetBenchmarkVersiom()`

---------

Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2024-01-29 13:15:43 +00:00
Dominic Hamon a092f8222c missing cmake include 2023-07-10 17:58:01 +01:00
Dominic Hamon c30468bb4b add back package properties for PFM 2023-07-10 17:54:09 +01:00
Pichot 8805bd0c14
pfm: Use a more standard CMake approach for finding libpfm (#1628)
* pfm: Use a more standard CMake approach for finding libpfm

* add myself and sort AUTHORS & CONTRIBUTORS
2023-07-10 17:46:34 +01:00
Enrico Seiler e730f91d8c
Fix passing non-const lvalue refs to DoNotOptimize (#1622) 2023-07-05 18:05:08 +01:00
Yingwei Zheng 3b19d7222d
Fix CPU frequency estimation on riscv (#1549)
* Fix CPU frequency estimation on riscv

* Cleanup code for CPU frequency estimation

* Fix use before definition of the macro

* Move the platform definitions back

* Fix compilation error on windows

* Remove unused sleep.h and sleep.cc
2023-02-21 11:30:28 +00:00
dominic hamon da652a7486
Try removing attempt to set the C++ standard (#1464)
* Try removing attempt to set the C++ standard

Fixes #1460 #1462

* set the standard to 11

* spell it right

* had it right the first time

* require std 11

* plumb through the standard to cxxfeaturecheck

* use policy instead

* can't use policy just yet

* Update CXXFeatureCheck.cmake

* fix CXX_STANDARD_REQUIRED statement

Co-authored-by: Dominic Hamon <dominichamon@users.noreply.github.com>
2022-12-10 19:42:44 -04:00
babbaj 2a78e8cbe9
use CMAKE_INSTALL_FULL in pkg-config file (#1473) 2022-08-23 23:28:02 +03:00
Dominic Hamon 77d1e74d29
add debug option for enabling more output for failed cxxfeaturechecks (#1467)
fixes #1466
2022-08-10 20:42:27 +01:00
Dominic Hamon 974cd5a5c5
Ensure we don't need benchmark installed to pass c++ feature checks (#1456)
* Ensure we don't need benchmark installed to pass c++ feature checks

Requires removal of some dependencies on benchmark.h from internal
low-level headers, which is a good thing.

Also added better logging to the feature check cmake module.
2022-08-04 15:33:35 +01:00
Dominic Hamon 8205547ceb
fix sanitizer builds by using clang 13 (#1426)
* attempt to fix sanitizer builds by moving away from llvm head

* extra verbosity

* try clang 13 and add extra logging

* get latest clang and try again
2022-07-05 10:41:38 +01:00
Dominic Hamon 6cf20f1e02
Suppress GoogleTest warnings on windows (MSVC) too. (#1320)
Fixes #1209
2022-01-13 14:21:43 +00:00
Dominic Hamon 1f99405076
update googletest to latest release tag 1.11.0 (#1301)
* update googletest to latest release tag 1.11.0

* fix cmake builds to the same release
2021-12-08 16:30:03 +00:00
dominc8 680d3fdbb5
Add clang-tidy check (#1290)
* Add clang-tidy.yml and .clang-tidy

* Add mention to authors/contributors

* Temp fix 2 clang-tidy issues

* Enable clang-tidy on pull requests

* Exclude gtest source files from clang-tidy
2021-11-25 15:47:44 +00:00
Donald Aingworth a07f6d1789
Googletest renamed master to main today. (#1285)
Co-authored-by: Donald Aingworth <donald@midpointmarkets.org>
2021-11-17 09:45:03 +00:00
Sergiu Deitsch 1be88c0683 cmake: allow to use package config from build directory 2021-10-19 11:11:11 +02:00
Sergiu Deitsch eb9100bf41 cmake: make package config relocatable 2021-10-19 11:05:29 +02:00
Roman Lebedev 2f30903ca2
GoogleTest.cmake.in: mention BENCHMARK_USE_BUNDLED_GTEST 2021-10-19 11:32:26 +03:00
Roman Lebedev 8c8052aa7b
GoogleTest.cmake.in: immediately error-out after failure message, Closes #1255
Results in a bit nicer output when googletest was not found.
2021-10-19 11:31:32 +03:00
Roman Lebedev e7a8415876
CMake: add forgotten include(FeatureSummary) into FindPFM.cmake to fix build
Sorry!
2021-09-03 01:15:09 +03:00
Roman Lebedev e7fa637cbe
[NFC] PFM: actually report package as found, and advertise description
This slightly prettifies the CMake's `feature_summary()` output,
should the library be built as part of some project that then prints
the CMake summary.
2021-08-23 19:36:34 +03:00
Dominic Hamon 07f833d6b2 so much for googletest not failing any more 2021-08-11 15:10:02 +01:00
Dominic Hamon d0db4e01c1 turn back on strict mode for googletest as it no longer breaks 2021-08-11 15:01:17 +01:00
Dominic Hamon ab74ae5e10
downgrade warnings for googletest (#1203)
fixes #1202. sort of.
2021-07-19 12:11:13 +01:00
Kai Germaschewski a4bcd937b2
fix version recorded in releases (#1047)
* cmake: fix handling the case where `git describe` fails

* cmake: fix version recorded in releases

If downloaded as a tarball release, there will be no info from git
to determine the release, so it ends up v0.0.0. If that's the case,
we'll now use the release specified in the project() command,
which needs to be updated for each new release.

* cmake: add `--tags` to `git describe`

That way, lightweight tags will also be taken into account, which should
never hurt, but it'll help in cases where, for some mysterious reason or
other, annotated tags don't make it into a clone.

* update releasing.md
2021-05-20 17:59:29 +01:00
Mircea Trofin 376ebc2635
Support optional, user-directed collection of performance counters (#1114)
* Support optional, user-directed collection of performance counters

The patch allows an engineer wishing to drill into the root causes
of a regression, for example. Currently, only single threaded runs
are supported. The feature is a build-time opt in, and then a runtime
opt in.

The engineer may run the benchmark executable, passing a list of
performance counter names (using libpfm's naming scheme) at the
command line. The counter values will then be collected and reported
back as UserCounters.

This is different from #240 in that it is a benchmark user opt-in, and
the counter collection is transparent to the benchmark.

Currently, this is only supported on platforms where libpfm is
supported.

libpfm: http://perfmon2.sourceforge.net/

* 'Use' values param in Snapshot when BENCHMARK_OS_WINDOWS

This is to avoid unused parameter warning-as-error

* Added missing include for <vector> in perf_counters.cc

* Moved doc to docs

* Added license blurbs
2021-04-28 09:25:29 +01:00
Kai Germaschewski d882be1ea9
fix cmake issue with referencing a non-existing function argument (#1118)
according to https://cmake.org/cmake/help/latest/command/function.html,
"Referencing to ARGV# arguments beyond ARGC have undefined behavior.",
which I hit with cmake 3.19.7.

This uses ARGC to check whether ARGV1 has been passed before referencing
it.
2021-04-26 09:15:07 +01:00
Vitaly Zaitsev 7efada2dac
Fixed pkg-config on other than Ubuntu GNU/Linux distributions. (#1043)
Signed-off-by: Vitaly Zaitsev <vitaly@easycoding.org>
2020-09-12 18:56:43 +03:00
Jeremy Ong 01c0ab7cbb
Fix Clang builds on Windows (#1021)
Fixes #974. The `cxx_feature_check` now has an additional
optional argument which can be used to supply extra cmake flags
to pass to the `try_compile` command. The `CMAKE_CXX_STANDARD=14`
flag was determined to be the minimum flag necessary to correctly
compile and run the regex feature checks when compiling with Clang
under Windows (n.b. this does *not* refer to clang-cl, the frontend
to the MSVC compiler). The additional flag is not enabled for any
other compiler/platform tuple.
2020-08-27 11:17:19 +01:00
Dominic Hamon 5c25ad3acb
Ctest support (#1025)
* ctest is now working

* Update README

* remove commented out lines

* Tweaked docs

Added note to use parallel and cleaned build config notes

* Response to comments

* revert all but the readme

* make error message clearer

* drop --parallel
2020-08-21 16:25:56 +01:00
Kyle Edwards f4f5dba46b Cache RUN_${FEATURE} variable in CXXFeatureCheck.cmake (#886)
When cross-compiling, this variable was not set on the second run
of CMake, resulting in the next check failing even though it shouldn't
be run in the first place. Fix this by caching the variable.
2019-10-04 09:50:53 +01:00
Attila M. Szilagyi ef7d51c8eb Allow setting GOOGLETEST_PATH cmake argument. Fixes #867 (#868)
In `cmake/GoogleTest.cmake`, GOOGLETEST_PATH is default-initialized, but that init forgot to
account for the fact that the patch is explicitly supposed to be user-configurable.
By passing `CACHE` to `set()` we avoid that error.
2019-09-15 20:25:32 +03:00
Roman Lebedev 727a81aabd
CMake: avoid incorrect extra "" around the GOOGLETEST_PATH.
It was looking in `"<...>/googlebenchmark/build/third_party/googletest"`,
with these extra `"` quotes, and wasn't finding anything..
2019-04-30 19:33:09 +03:00
Roman Lebedev 4b77194032
CMake: codedrop of googletest cmake magic from me (#809)
https://github.com/google/benchmark/pull/801 is stuck with some cryptic cmake failure due to
some linking issue between googletest and threading libraries.

I suspect that is mostly happening because of the, uhm,
intentionally extremely twisted-in-the-brains approach that is being used to
actually build the library as part of the buiild,
except without actually building it as part of the build.

If we do actually build it as part of the build,
then all the transitive dependencies should magically be in order,
and maybe everything will just work.

This new version of cmake magic was written by me in
0e22f085c5/cmake/Modules/GoogleTest.cmake.in
0e22f085c5/cmake/Modules/GoogleTest.cmake, based on the official googletest docs and LOTS of experimentation.
2019-04-30 13:36:29 +03:00
Daniel Kraft 97393e5ef8 Add -lpthread to pkg-config Libs.private. (#755)
Since pthread is required at least for GCC (according to the
documentation), this should be reflected by the pkg-config file.

The same is, for instance, also done by the gflags library:
1005485222/cmake/package.pc.in (L13)
2019-02-01 15:51:44 +03:00
Dominic Hamon bb15a4e3bf Ensure all informational cmake messages have STATUS type 2018-11-13 09:56:22 +00:00
Olzhas Kaiyrakhmet d731697a5d Fix SOURCE_DIR in HandleGTest.cmake (#705)
If benchmark added as cmake subproject, HandleGTest throws an error as  does return absolute source dir.
Change it to , so it will be refering to it's own source dir.

Also see PR #703.
2018-10-13 01:06:41 -07:00
Eric 8356d646bf
Revert "Fix SOURCE_DIR in HandleGTest.cmake (#703)" (#704)
This reverts commit 609752306f.
2018-10-13 00:53:25 -07:00
Olzhas Kaiyrakhmet 609752306f Fix SOURCE_DIR in HandleGTest.cmake (#703)
* Fix SOURCE_DIR in HandleGTest.cmake

If benchmark added as cmake subproject, HandleGTest throws an error as  does return absolute source dir.
Change it to , so it will be refering to it's own source dir.
2018-10-13 00:51:51 -07:00
Gregorio Litenstein 9ffb8df6c5 Fix Clang Detection (#697)
For several versions now, CMake by default refers to macOS’ Clang as AppleClang instead of just Clang, which would fail STREQUAL. Fixed by changing it to MATCHES.
2018-10-05 16:44:02 +01:00
Deniz Evrenci 6d74c0625b split_list is not defined for assembly tests (#595)
* Update AUTHORS and CONTRIBUTORS

* split_list is not defined for assembly tests
2018-05-14 15:02:49 +01:00
Roman Lebedev e8ddd907bb There is no "FATAL" in message(), only "FATAL_ERROR" (#584) 2018-05-08 11:33:37 +01:00
php1ic 16af64500f Run git from the source directory (#589) (#590)
Git was being executed in the current directory, so could not get the
latest tag if cmake was run from a build directory. Force git to be
run from with the source directory.
2018-05-08 11:29:09 +01:00
Yangqing Jia 105ac14b2f Add caching for cxx_feature_check (#573) 2018-04-23 20:57:03 +01:00
Eric Fiselier 2844167ff9 Fix #564 - gmock/gmock.h not found in benchmark tests. 2018-04-05 18:34:13 -06:00