Commit Graph

53 Commits

Author SHA1 Message Date
CrazyRong
f9e826db52 升级benchmark版本到版本火车要求的1.8.3版本
Signed-off-by: CrazyRong <zzr189911@163.com>
2024-04-20 16:24:00 +08:00
mipengwei
a0da9a7685 Signed-off-by:mipengwei <mipengwei@huawei.com> 2022-07-20 09:51:00 +08: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
Eric Fiselier
68e228944e Fix #538 - gtest.h not found when building with older CMake versions.
Older CMake versions, in particular 2.8, don't seem to correctly handle
interface include directories. This causes failures when building the
tests. Additionally, older CMake versions use a different library install
directory than expected (i.e. they use lib/<target-triple>). This caused
certain tests to fail to link.

This patch fixes both those issues. The first by manually adding the
correct include directory when building the tests. The second by specifying
the library output directory when configuring the GTest build.
2018-03-21 13:27:04 -06:00
Eric
207b9c7aec
Improve State packing: put important members on first cache line. (#527)
* Improve State packing: put important members on first cache line.

This patch does a few different things to ensure commonly accessed
data is on the first cache line of the `State` object.

First, it moves the `error_occurred_` member to reside after
the `started_` and `finished_` bools, since there was internal
padding there that was unused.

Second, it moves `batch_leftover_` and `max_iterations` further up
in the struct declaration. These variables are used in the calculation
of `iterations()` which users might call within the loop. Therefore
it's more important they exist on the first cache line.

Finally, this patch turns the bool members into bitfields. Although
this shouldn't have much of an effect currently, because padding is
still needed between the last bool and the first size_t, it should
help in future changes that require more "bool like" members.

* Remove bitfield change for now

* Move bools (and their padding) to end of "first cache line" vars.

I think it makes the most sense to move the padding required
following the group of bools to the end of the variables we want
on the first cache line.

This also means that the `total_iterations_` variable, which is the
most accessed, has the same address as the State object.

* Fix static assertion after moving bools
2018-02-14 13:44:41 -07:00
Eric Fiselier
562f9d256d Fix GTest workaround on MSVC 2018-02-12 18:43:32 -07:00
Eric
906749a48e Work around Gtest build failure caused by -Werror=unused-function. (#529)
We're propagating extra warning flags to the gtest build, which
can cause it to fail. This patch prevents passing "-Wextra" to
gtest, since the library itself doesn't test with that flag.
2018-02-12 17:11:01 -08:00
Eric Fiselier
778b85a7a9 Prevent GTest and GMock from being installed with Google Benchmark.
When users satisfy the GTest dependancy by placing a googletest
directory in the project, the targets from GTest and GMock incorrectly
get installed along side this library. We shouldn't be installing
our test dependancies.

This patch forces the options that control installation for googletest
to OFF.
2018-01-05 11:04:22 -07:00
Eric
7db02be244
Add support for GTest based unit tests. (#485)
* Add support for GTest based unit tests.

As Dominic and I have previously discussed, there is some
need/desire to improve the testing situation in Google Benchmark.

One step to fixing this problem is to make it easier to write
unit tests by adding support for GTest, which is what this patch does.

By default it looks for an installed version of GTest. However the
user can specify -DBENCHMARK_BUILD_EXTERNAL_GTEST=ON to instead
download, build, and use copy of gtest from source. This is
quite useful when Benchmark is being built in non-standard configurations,
such as against libc++ or in 32 bit mode.
2017-12-13 16:26:47 -07:00
Roman Lebedev
c45f01866b CMake: implement LTO for clang. Fixes #478 (#487)
* CMake: implement LTO for clang. Fixes #478

* LTO: add basic docs about required executables.
2017-11-29 12:48:43 -08:00
Steinar H. Gunderson
0c3ec998c4 Add a pkg-config file, for the benefit of projects not using CMake. (#480) 2017-11-15 11:51:22 -08:00
Roman Lebedev
6e06648133 Attempting to resolve a submoduling issues... (#439) 2017-08-28 16:10:19 -07:00
Victor Costan
902936033d CMake: Fallback from try_run to try_compile when cross-compiling. (#436) 2017-08-15 15:53:30 -07:00
Jern-Kuan Leong
710c2b89d8 Fix #403 HAVE_${VAR} not passed to makefile (#404)
Add definition of ${VAR} to makefiles if specified as part of cmake
parameter.
2017-06-16 14:46:11 -07:00
Dominic Hamon
66283598e6 Merge branch '1.1' of git://github.com/piribes/benchmark into piribes-1.1 2017-04-04 08:35:51 -07:00
Giuseppe Roberti
824bbb818e Add CMake Package Config files during install
- Remove target_include_directories of ${PROJECT_SOURCE_DIR}/include to
  fix error: Target "benchmark" INTERFACE_INCLUDE_DIRECTORIES property
  contains path which is prefixed in the source directory.
2017-04-03 01:54:24 +02:00
Eric
0dbcdf56a0 Add BENCHMARK_BUILD_32_BITS option and add builders to test it (#360)
* Add BENCHMARK_BUILD_32_BITS option and add builders to test it

* Attempt to fix travis configuration

* Make add_required_cxx_compiler_flag cause an error when the flag isn't supported

* add gcc-multilib dependancy on travis

* attempt to fix travis.yml parsing error

* Require g++-multilib instead of gcc-multilib

* Add 32 bit release configurations

* Attempt to fix libc++ travis build w/ 32 bits

* Work around CMake configuration failure on Travis
2017-03-28 00:43:42 -07:00
Eric
a3eac442c2 Update the required CMake version to 2.8.12 (#316) 2016-12-05 09:22:46 -08:00
ktnyt
d1daeee4e9 Pass flag string to check_cxx_compiler_flag (#298) 2016-10-05 09:19:14 -07:00
Eric
6e25917001 Add -DBENCHMARK_USE_LIBCXX:BOOL=<value> option. (#280)
* Add BENCHMARK_USE_LIBCXX option.

* Add comments

* re-add zero null pointer warning
2016-08-29 12:43:30 -06:00
Eric Fiselier
9fcdd6fc25 Prevent re-execution of slow feature tests. 2016-05-23 20:51:15 -06:00
Alastair Murray
a574110048 Close a memory leak in configuration code
This was causing configuration failures on address sanitizer builds.
2016-02-09 13:08:56 +00:00
Zbigniew Skowron
cd2e633fe5 Fix get_git_version to use GIT_EXECUTABLE.
get_git_version CMake function uses 'git' command directly, instead of
GIT_EXECUTABLE variable. This causes CMake errors while generating
project files in environments, where 'git' command is not present
in PATH.
2015-10-18 02:13:37 +02:00
Tobias Ulvgard
775ef51d04 CMake check for git on the system 2015-10-06 10:09:55 +02:00
Matt Clarkson
fc883f6742 Improve the CMake C++ flag checker
This checks the flag on the compiler AND linker which allows it to work
with flags such as -flto and -fsanitize=address
2015-05-01 11:09:56 +01:00
Eric Fiselier
b07fee6b64 address review comments 2015-03-26 18:32:31 -04:00
Eric Fiselier
d3e0671a87 finish selection of clock with debug information 2015-03-26 17:52:28 -04:00
Eric Fiselier
7a767012f1 Adopt new benchmark timing internals.
This patch adopts a new internal structure for how timings are performed.
Currently every iteration of a benchmark checks to see if it has been running
for an appropriate amount of time. Checking the clock introduces noise into
the timings and this can cause inconsistent output from each benchmark.

Now every iteration of a benchmark only checks an iteration count to see if it
should stop running. The iteration count is determined before hand by testing
the benchmark on a series of increasing iteration counts until a suitable count
is found. This increases the amount of time it takes to run the actual benchmarks
but it also greatly increases the accuracy of the results.

This patch introduces some breaking changes. The notable breaking changes are:
1. Benchmarks run on multiple threads no generate a report per thread. Instead
   only a single report is generated.
2. ::benchmark::UseRealTime() was removed and replaced with State::UseRealTime().
2015-03-12 18:03:33 -04:00
Eric Fiselier
c5a362b4d3 Change std::regex detection test to detect bug in libstdc++.
libstdc++'s std::regex has (or had) a bug in std::regex::operator=(...) that
caused undefined behaviour. Clang will detect this and compile the function so
that it crashes at runtime. This patch tried to detect that bug during
configuration.
2015-03-06 12:05:19 -05:00
Chris Kennelly
8eac5dc328 Merge pull request #58 from google/zero_null
Fix #50 by using nullptr and adding stricter warning.
2014-10-18 15:33:40 -07:00
Dominic Hamon
e6107a781c Fix #50 by using nullptr and adding stricter warning. 2014-10-11 15:52:50 -07:00
Dominic Hamon
f98c5760fe Fix #54 by correcting reference to CXX flags for variants. 2014-10-11 15:13:00 -07:00
Matt Clarkson
9593e64076 Fixed the CMake add_cxx_compiler_flag function 2014-08-22 14:56:12 +01:00
Matt Clarkson
edfa60a1d1 Resolve regular expression engines 2014-08-22 14:55:46 +01:00