Commit Graph

134 Commits

Author SHA1 Message Date
Gary Miguel 1d25c2e3be
remove old-style (C-style) casts (#1614)
Remove old-style (C-style) casts

This is required by the Google C++ style guide:
https://google.github.io/styleguide/cppguide.html#Casting
2023-06-22 01:35:44 +03:00
Dominic Hamon 604f6fd3f4 Add project name to version message
Inspired by paulcaprioli
2023-05-30 08:44:26 +01:00
Dominic Hamon 2dd015dfef update version to v1.8.0 2023-05-05 11:25:54 +01:00
Dominic Hamon 1b507cbf10 simplify setting C++ standard 2023-03-11 14:09:45 +00:00
Henrique Bucher 4050b4bda5
Fix build break with nvc++ when -Werror is ON (#1569)
Build breaks when -Werror is turned on because of unhandled cases of
inocuous/pedantic warnings. Adopted the same solution as for Intel PGI
compiler - just disable -Werror manually, unless BENCHMARK_FORCE_WERROR
is enabled. Fixes #1556.
2023-03-08 09:50:30 +00: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
Carlos O'Ryan b111d01c1b
cleanup: support CMake >= 3.10 (#1544)
* cleanup: support CMake >= 3.10

This aligns the project with the CMake support policies in:

https://opensource.google/documentation/policies/cplusplus-support

I also simplied the management of CMake policies. Most of the overriden
policies (anything <= CMP0067) are enabled by default when you require
CMake >= 3.10.  But it is easier to just declare that you will accept
newer policies when they are available using the `...3.22` notation.

* Address review comments

* inlined links

---------

Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2023-02-17 13:38:53 +00:00
dominic 1079d96989
Werror all the time (#1546) 2023-02-16 18:54:09 +00:00
SunBlack fe65457e80
Fix typos found by codespell (#1519) 2023-01-10 12:25:32 +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
Dominic Hamon d572f47773 version bump for release 2022-11-11 14:01:03 +00:00
Roman Lebedev db4f581fbb
Partially revert "Do not depend on unversioned python binary (#1496)" (#1501)
As predicted, the cmake part of the change is contentious.
https://github.com/google/benchmark/pull/1496#issuecomment-1276508266

This partially reverts commit 229bc5a937.
2022-10-13 10:03:29 +01:00
Matthias Braun 229bc5a937
Do not depend on unversioned python binary (#1496)
Some linux distributions no longer provide `python` binary and require
usage of `python3` instead. This changes the scripts here and uses
cmake `find_package(Python3` when running python.

Co-authored-by: Dominic Hamon <dominichamon@users.noreply.github.com>
2022-10-10 14:46:41 +03:00
Dominic Hamon 49aa374da9
bump cmake dep and docs (#1468)
* bump cmake dep and docs
2022-09-14 15:11:37 +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 361e8d1cfe version bump 2022-07-25 12:35:38 +01:00
Dominic Hamon 7b3ac07517
Stop generating the export header and just check it in (#1435)
* Stop generating the export header and just check it in

* format the new header

* support windows

* format the header again

* avoid depending on internal macro

* ensure we define the right thing for windows static builds

* support older cmake

* and for tests
2022-07-20 20:34:39 +01:00
Dominic Hamon 7a2024e961 v1.6.2 bump 2022-07-18 15:34:24 +01:00
Dominic Hamon b7afda2cd2
Revert "Add possibility to ask for libbenchmark version number (#1004) (#1403)" (#1417)
This reverts commit efadf67a12.
2022-06-20 17:52:03 +01:00
Matthias Donaubauer efadf67a12
Add possibility to ask for libbenchmark version number (#1004) (#1403)
* Add possibility to ask for libbenchmark version number (#1004)

Add a header which holds the current major, minor, and
patch number of the library. The header is auto generated
by CMake.

* Do not generate unused functions (#1004)

* Add support for version number in bazel (#1004)

* Fix clang format #1004

* Fix more clang format problems (#1004)

* Use git version feature of cmake to determine current lib version

* Rename version_config header to version

* Bake git version into bazel build

* Use same input config header as in cmake for version.h

* Adapt the releasing.md to include versioning in bazel
2022-06-20 09:45:50 +01:00
Bensuperpc 4f77cf9e62
Fix float comparaison and add float comparison warning (#1368)
GCC warns about comparison with zero, clang does not.
2022-03-12 19:05:23 +03:00
Sergiu Deitsch 9e47d070fe
annotate and export public symbols (#1321) 2022-02-14 10:48:53 +00:00
Dominic Hamon 0d98dba29d Creating release commit for v1.6.1 2022-01-10 19:14:27 +00:00
Vitaly Zaitsev 365670e432
Added Doxygen support. (#1228)
Signed-off-by: Vitaly Zaitsev <vitaly@easycoding.org>
2021-10-25 12:32:33 +01:00
Sergiu Deitsch eb9100bf41 cmake: make package config relocatable 2021-10-19 11:05:29 +02:00
PhilipDeegan 285e5e9771
Cmake: options for controlling werror, disable werror for PGI compilers (#1246) 2021-10-18 09:41:25 +01:00
Vitaly Zaitsev 400ed3f57a
Added support of packaged GTest for running unit tests. (#1226)
Signed-off-by: Vitaly Zaitsev <vitaly@easycoding.org>
2021-09-12 18:57:57 +03:00
Vitaly Zaitsev 1bd8098d3d
Optimized docs installation (#1225)
* Use GNUInstallDirs to install docs.

Signed-off-by: Vitaly Zaitsev <vitaly@easycoding.org>

* Added an option to disable docs installation.

Signed-off-by: Vitaly Zaitsev <vitaly@easycoding.org>
2021-09-08 18:40:25 +01:00
Dominic Hamon f91b6b42b1 bump version to 1.6 in preparation for release 2021-09-07 12:18:34 +01:00
Dominic Hamon ddc76e513e preparing v1.5.6 release 2021-08-11 15:22:36 +01:00
Dominic Hamon bc5651e54a bump version to v1.5.4 2021-05-30 09:48:05 +01:00
Mariusz Wachowicz db2de74cc8
Fix pedantic compilation flag violation (#1156)
';' after method definition was removed.
Also, pedantic flag is now uncommented in CMakeList.txt.
2021-05-21 09:48:20 +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
Guillaume Chatelet 7d0d9061d8
Support -Wsuggest-override (#1059)
* Support -Wsuggest-override

google/benchmark is C++11 compatible but doesn't use the `override` keyword.
Projects using google/benchmark with enabled `-Wsuggest-override` and `-Werror` will fail to compile.

* Add -Wsuggest-override cxx flag

* Revert unrelated formatting

* Revert unrelated formatting, take 2

* Revert unrelated formatting, take 3

* Disable -Wsuggest-override when compiling tests, gtest does not handle it yet

Co-authored-by: Dominic Hamon <dominichamon@users.noreply.github.com>
2021-05-11 14:56:00 +03:00
Michał Janiszewski 17948a78ee
Add MSVC ARM64 support to cmake (#1090) 2021-05-07 14:08:24 +01:00
Paweł Bylica e50b572e89
cmake: Add explicit BENCHMARK_ENABLE_LIBPFM option (#1141) 2021-05-06 13:48:48 +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
Dominic Hamon 7fa6f1f91a
Disable lto-type-mismatch warnings (#1071) 2020-11-23 10:02:33 +00: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
Alex Reinking e5ea03ce07
Fix cxx03 standard selection, option override in CMake 3.13+. Fixes #933 (#934) 2020-01-31 10:16:25 +00:00
Dominic Hamon 5ac80de037 Disable pedantic warnings and errors until googletest/gmock is fixed 2020-01-30 13:29:17 +00:00
Kyle Edwards d16ae64e5a Set CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS (#889)
When building on Windows with `BUILD_SHARED_LIBS=ON`, the symbols were
not being properly exported in the DLL. Fix this by setting
`CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS`.

Fixes #888
2019-10-23 11:13:40 +03:00
Roman Lebedev 2e7203aa94
CMake: check CMAKE_CXX_COMPILER_ID, not CMAKE_C_COMPILER_ID
This may or may not have gotten broken now that benchmark was marked as CXX-only.
2019-05-11 18:57:41 +03:00
Michał Janiszewski 12c978c513 Mark CMake project as C++-only (#681)
This will make CMake skip all the checks for C compiler.
2019-05-10 19:56:08 +03:00
Shuo Chen 7d856b0304 If gtest targets are already defined, use them. (#777)
This allows a project to include both googletest and benchmark as top-level git submodule.

This allows incorporating Benchmark to an existing CMake project that already incorporates googletest.
https://github.com/google/googletest/blob/master/googletest/README.md#incorporating-into-an-existing-cmake-project
https://github.com/abseil/abseil-cpp/tree/master/CMake#incorporating-abseil-into-a-cmake-project
2019-05-01 23:00:10 +03:00
Dominic Hamon 13b8bdc2b5
Bump required cmake version from 2.x to 3.x (#801) 2019-05-01 09:06:12 +01: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
Joseph Loser 3bc802e47c Silence CMake Policy 0063 warning (#790)
Summary:
- When google benchmark is used as a submodule in a parent projects
  whose min CMake version is 3.3.2 or later, the google benchmark
  `CMakeLists.txt` triggers a warning regarding CMake policy 0063:

```
CMake Warning (dev) at tests/googlebenchmark/src/CMakeLists.txt:19 (add_library):
  Policy CMP0063 is not set: Honor visibility properties for all target
  types.  Run "cmake --help-policy CMP0063" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  Target "benchmark" of type "STATIC_LIBRARY" has the following visibility
  properties set for CXX:

    CXX_VISIBILITY_PRESET
    VISIBILITY_INLINES_HIDDEN

  For compatibility CMake is not honoring them for this target.
This warning is for project developers.  Use -Wno-dev to suppress it.
```

- Set CMake Policy 0063 to NEW if the policy is available. This will not
  affect parent projects who include benchmark but do not have a CMake min
  version of 3.3.2 or later, i.e. when this policy is introduced.
2019-04-05 11:43:47 +01:00
Jilin Zhou 0ae233ab23 [#766] add x-compile support for QNX SDP7 (#770)
Since googletest already supports x-compilation for QNX, it is nice to
 have google benchmark support it too.
Fixes #766
2019-02-19 13:05:55 +00:00
Wes McKinney 7c571338b5 Prefer -pthread to -lpthread for better compatibility when cross-compiling (#771) 2019-02-19 12:32:11 +00:00