Commit Graph

151 Commits

Author SHA1 Message Date
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
Reid Kleckner dc10645549 Set CMP0048 policy before project() to silence warnings (#750)
If this policy isn't set, CMake emits a large warning when project() is
called from a cmake subdirectory.

This came up when the benchmark library was added to the LLVM build, and
it was reported in https://llvm.org/PR38874. This patch was the fix I
applied locally to fix the issue, and I wanted to send it upstream.
2018-12-30 20:46:07 +03:00
Dominic Hamon bb15a4e3bf Ensure all informational cmake messages have STATUS type 2018-11-13 09:56:22 +00:00
Kirill Bobyrev a9b31c51b1 Disable exceptions in Microsoft STL (#715)
This is the copy of patch proposed to LLVM's copy of benchmark via
https://reviews.llvm.org/D52998.
2018-11-02 16:03:49 +00: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
Roman Lebedev f274c503e1 Backport LLVM's r341717 "Fix flags used to compile benchmark library with clang-cl" (#673)
`MSVC` is true for clang-cl, but `"${CMAKE_CXX_COMPILER_ID}" STREQUAL
"MSVC"` is false, so we would enable -Wall, which means -Weverything
with clang-cl, and we get tons of undesired warnings.

Use the simpler condition to fix things.

Patch by: Reid Kleckner @rnk
2018-09-10 16:30:40 -04:00
Michael "Croydon" Keck a0018c3931 Ignore 32 bit build option when using MSVC (#638) 2018-08-29 12:51:20 +01:00
Federico Ficarelli 0c21bc369a Fix build with Intel compiler (#631)
* Set -Wno-deprecated-declarations for Intel

Intel compiler silently ignores -Wno-deprecated-declarations
so warning no. 1786 must be explicitly suppressed.

* Make std::int64_t → double casts explicit

While std::int64_t → double is a perfectly conformant
implicit conversion, Intel compiler warns about it.
Make them explicit via static_cast<double>.

* Make std::int64_t → int casts explicit

Intel compiler warns about emplacing an std::int64_t
into an int container. Just make the conversion explicit
via static_cast<int>.

* Cleanup Intel -Wno-deprecated-declarations workaround logic
2018-07-09 11:45:10 +01:00
Dominic Hamon d8584bda67
Use EXPECT_DOUBLE_EQ when comparing doubles in tests. (#624)
* Use EXPECT_DOUBLE_EQ when comparing doubles in tests.

Fixes #623

* disable 'float-equal' warning
2018-06-27 12:11:30 +01:00
Dominic Hamon 151ead6242
Disable deprecation warnings when -Werror is enabled. (#609)
Fixes #608
2018-06-07 12:54:14 +01:00
Eric 7b8d0249d8 Deprecate CSVReporter - A first step to overhauling reporting. (#488)
As @dominichamon and I have discussed, the current reporter interface
is poor at best. And something should be done to fix it.

I strongly suspect such a fix will require an entire reimagining
of the API, and therefore breaking backwards compatibility fully.

For that reason we should start deprecating and removing parts
that we don't intend to replace. One of these parts, I argue,
is the CSVReporter. I propose that the new reporter interface
should choose a single output format (JSON) and traffic entirely
in that. If somebody really wanted to replace the functionality
of the CSVReporter they would do so as an external tool which
transforms the JSON.

For these reasons I propose deprecating the CSVReporter.
2018-05-29 13:25:32 +01:00
Roman Lebedev e8ddd907bb There is no "FATAL" in message(), only "FATAL_ERROR" (#584) 2018-05-08 11:33:37 +01:00
Eric 7b03df7ff7
Add tests to verify assembler output -- Fix DoNotOptimize. (#530)
* Add tests to verify assembler output -- Fix DoNotOptimize.

For things like `DoNotOptimize`, `ClobberMemory`, and even `KeepRunning()`,
it is important exactly what assembly they generate. However, we currently
have no way to test this. Instead it must be manually validated every
time a change occurs -- including a change in compiler version.

This patch attempts to introduce a way to test the assembled output automatically.
It's mirrors how LLVM verifies compiler output, and it uses LLVM FileCheck to run
the tests in a similar way.

The tests function by generating the assembly for a test in CMake, and then
using FileCheck to verify the // CHECK lines in the source file are found
in the generated assembly.

Currently, the tests only run on 64-bit x86 systems under GCC and Clang,
and when FileCheck is found on the system.

Additionally, this patch tries to improve the code gen from DoNotOptimize.
This should probably be a separate change, but I needed something to test.

* Disable assembly tests on Bazel for now

* Link FIXME to github issue

* Fix Tests on OS X

* fix strip_asm.py to work on both Linux and OS X like targets
2018-03-23 16:10:47 -06:00
Eric Fiselier e668e2a1ba Fix #552 - GCC and Clang warn on possibly invalid offsetof usage.
This patch disables the -Winvalid-offsetof warning for GCC and Clang
when using it to check the cache lines of the State object.

Technically this usage of offsetof is undefined behavior until C++17.
However, all major compilers support this application as an extension,
as demonstrated by the passing static assert (If a compiler encounters UB
during evaluation of a constant expression, that UB must be diagnosed).
Unfortunately, Clang and GCC also produce a warning about it.

This patch temporarily suppresses the warning using #pragma's in the
source file (instead of globally suppressing the warning in the build systems).
This way the warning is ignored for both CMake and Bazel builds without
having to modify either build system.
2018-03-21 13:47:25 -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 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
Yangqing Jia 491360b833 Add option to install benchmark (#463)
* Add option to install benchmark

* Change to BENCHMARK_ENABLE_INSTALL per @dominichamon
2017-10-20 13:49:37 -07:00
Roman Lebedev 6e06648133 Attempting to resolve a submoduling issues... (#439) 2017-08-28 16:10:19 -07:00
Eric d6aacaf48f Revert "Use NEW settings for CMP0063 policy (#399)" (#401)
This reverts commit af542061c5.
2017-06-13 18:42:32 -06:00
Tim af542061c5 Use NEW settings for CMP0063 policy (#399)
This removes warnings when using CMake >= 3.3 if you have symbol visibility set.
2017-06-13 18:42:07 -06:00
Eric Fiselier cb8a0cc10f test commit 2017-05-03 23:43:16 -06: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
rolandschulz 9b92ed76a8 Fix ICC compiler warnings (#358)
fixes #354

The build fails with ICC17 because of warnings and Werror. What is the correct solution to fix it?
Should a patch

disable Werror for ICC (or maybe all non known compilers)
disable the false postive warnings for all files. This could be done using:
add_cxx_compiler_flag(-wd2102) #ICC17u2: Many false positives for Wstrict-aliasing
add_cxx_compiler_flag(-wd2259) #ICC17u2: non-pointer conversion from "long" to "int" may lose significant bits (even for explicit static cast, sleep.cc(44))
add_cxx_compiler_flag(-wd654) #ICC17u2: overloaded virtual function "benchmark::Fixture::SetUp" is only partially overridden (because of deprecated overload)
disable warnings at file level or some other granularity
2017-03-27 18:30:54 -06:00
Eric efd4e992a6 Add support for building w/o exceptions (#317) 2016-12-05 09:24:09 -08:00
Eric a3eac442c2 Update the required CMake version to 2.8.12 (#316) 2016-12-05 09:22:46 -08:00
Eric Fiselier f67ee4ad9b Fix #294. Add -D_GNU_SOURCE when building under Cygwin 2016-10-08 01:03:23 -06:00
Eric d038472c18 Refactor benchmark.cc into benchmark_register.cc and benchmark.cc (#287)
* Refactor benchmark.cc into benchmark_register.cc and benchmark_run.cc

The benchmark.cc file is getting really big and it contains a bunch of
unrelated components. This patch separates the files into two separate
parts. The "runtime" parts and the "registration" parts.

This patch also removes the PIMPL used by Benchmark. Previously we couldn't
have STL types in the interface but now we can. Therefore there is no reason
to keep BenchmarkImp.

* add missing include

* rework windows timers again

* Guard timespec on older Windows versions

* Remove old thread safety annotation workarounds
2016-09-05 15:48:40 -06:00
Eric cba945e37d Make `PauseTiming()` and `ResumeTiming()` per thread. (#286)
* Change to using per-thread timers

* fix bad assertions

* fix copy paste error on windows

* Fix thread safety annotations

* Make null-log thread safe

* remove remaining globals

* use chrono for walltime since it is thread safe

* consolidate timer functions

* Add missing ctime include

* Rename to be consistent with Google style

* Format patch using clang-format

* cleanup -Wthread-safety configuration

* Don't trust _POSIX_FEATURE macros because OS X lies.

* Fix OS X thread timings

* attempt to fix mingw build

* Attempt to make mingw work again

* Revert old mingw workaround

* improve diagnostics

* Drastically improve OS X measurements

* Use average real time instead of max
2016-09-02 21:34:34 -06: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
Steve Downey 2149577f89 Add export linker flags policy to cmake (#251)
Add policy CMP0056, which honors the link flags in try_compile and
try_run. This allows for building against non-system libc++ by providing
the correct -L and rpath options in a containing project.

For example:

    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L ${LLVM_ROOT}/lib -l c++ -l c++abi")
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,${LLVM_ROOT}/lib")
2016-07-06 12:36:56 -07:00
Billy Robert O'Neal III 09edc486b8 Added GCC/Clang support for other rel configs 2016-05-10 16:47:06 -07:00
Billy Robert O'Neal III d89ab075fd Added support for CMake's other rel configs
In addition to release, CMake supports RELWITHDEBINFO and MINSIZEREL
build configurations. In particular, debug info is necessary for many
profilers to do anything useful, making RELWITHDEBINFO important here.

MINSIZEREL was added for completeness' sake.
2016-05-10 16:47:06 -07:00
Billy Robert O'Neal III 9bb1ba6b76 Fix clobbering of default CMAKE_CXX_FLAGS_RELEASE
BENCHMARK_ENABLE_LTO=true was completely replacing
CMAKE_CXX_FLAGS_RELEASE; meaning neither CMake's release defaults nor
user customizations were being applied.
2016-05-10 16:47:06 -07:00
Billy Robert O'Neal III 60b5921735 Remove redundant MSVC++ /W3 triggering warnings
This change looks for CMake's default setting for MSVC++, /W3 (and any
other level should that change in the future), and removes it before
adding /W4. This stops the build for MSVC++ emitting warnings about
/W4 overriding /W3 earlier on the command line.
2016-05-10 16:47:06 -07:00
Arkadiy Shapkin 9e37d69b23 Support MSVC on appveyor 2016-02-12 23:12:29 +03:00
Anton Danielsson 9195fd07d6 Revert "Added Wconversion so the gcc/clang warnings will be more similar to W4 on MSVC."
This reverts commit 0a2bd8935391e42f2581ec4826f7ac5f8fc9041a.
2015-10-08 10:48:44 +02:00
Anton Danielsson 0a8e0dbb0b Added Wconversion so the gcc/clang warnings will be more similar to W4 on MSVC.
This also points out some important issues like:
warning: conversion to 'size_t {aka unsigned int}' from 'long long int' may alter its value [-Wconversion]
   state.SetBytesProcessed(items_processed * sizeof(v));
This occurs on 32 bit systems where size_t is only 32 bits.
2015-10-08 10:48:37 +02:00
Anton Danielsson 53b1896c53 Added _CRT_SECURE_NO_WARNINGS under MSVC. 2015-10-08 10:48:29 +02:00
Anton Danielsson 02440964e8 Changed MSVC warnings from Wall to W4 to avoid 10000+ warnings from stl/windows headers. 2015-10-08 10:47:34 +02:00
Matt Clarkson 344775db63 Enable strict aliasing warnings 2015-05-13 09:17:48 +01:00
Matt Clarkson 36c1eb6975 Coverage support with LCOV and GCOV
This patch adds a `coverage` target that allows coverage statisitics to be
retrieved for the project. It requires that lcov and gcov is installed and
that the generator is unix makefiles but this can be improved upon in
future releases.

To make it work use the coverage build type:

```
cmake -DCMAKE_BUILD_TYPE=Coverage .
make coverage
```
2015-05-13 09:17:38 +01:00
Matt Clarkson 3314aa43c2 Allow the user to set the C++ standard to use
This is useful to test the library at different standard levels. Currently
doesn't search for C++14 in 'auto' mode. Can enable in the future
2015-05-12 17:15:41 +01:00
Matt Clarkson e44ee2d005 Group common C++ flags 2015-05-12 17:15:41 +01:00
Matt Clarkson bb23a9b9f2 Compile with link time optimisation
Can provide speed improvements
2015-05-12 17:15:38 +01:00
Matt Clarkson 7418bbbbac Only warn on errors in release mode
This improves development iterations when working in debug mode as you
don't have to fix up warnings to get the code to compile. Once a feature
is complete you can then run a release build and fix up all the warnings.
2015-05-05 12:11:43 +01:00
Dominic Hamon 1e0ed3a21c Rearrange the pieces 2015-04-03 13:33:54 -07:00
Geoff Romer dcb1a3dad4 Drop down to CMake 2.8.11, and drop INTERFACE since that version doesn't
support it.
2015-04-03 13:30:59 -07:00
Geoff Romer 89a1edae15 Require cmake 2.8.12 in order to support target_include_directories, and
simplify thread linking logic.
2015-04-03 13:30:59 -07:00
Eric Fiselier 8bb991d099 Remove BENCHMARK_ENABLE_SHARED and prefer BUILD_SHARED_LIBS 2015-04-01 11:34:38 -04:00
Eric Fiselier d3e0671a87 finish selection of clock with debug information 2015-03-26 17:52:28 -04:00
Eric Fiselier 7f2ef46255 merge master 2015-03-17 12:35:11 -04:00
Eric Fiselier 1924b30a6c Merge null pointer warnings 2015-03-17 12:21:20 -04:00
Eric Fiselier 66bf7c8f71 add floating point comparison warnings 2015-03-12 20:27:29 -04:00
Eric Fiselier f022d780eb Enable int shortening warnings 2015-03-12 20:17:40 -04:00
Eric Fiselier 64ba272911 Enable zero as NULL warnings and fix all occurences 2015-03-12 19:16:06 -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 5b41e128b3 Step one towards merging timer changes.
This patch cleans up our use of generic macros and also merges changes in the
build system.

It adds options -DBENCHMARK_ENABLE_TESTING and -DBENCHMARK_ENABLE_SHARED.
2015-03-06 12:35:00 -05:00
Pavel Davydov 26c01ee9ab Fix #77 add FreeBSD detection in cmake 2015-02-21 17:23:20 +03:00
Eric Fiselier 114886100b Don't use c++14 2015-02-19 16:38:30 -05:00
Niklas Hofmann 27aa01a3f9 remove -Wzero-as-null-pointer-constant flag for now 2014-10-26 03:23:15 +01: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 a13627bc3a Move pthread dependency to test CMakeLists.txt 2014-10-11 14:57:45 -07:00
Matt Clarkson edfa60a1d1 Resolve regular expression engines 2014-08-22 14:55:46 +01:00
Matt Clarkson fac16a662e CMakeLists.txt comments 2014-08-20 08:42:30 +01:00
Matt Clarkson 1c82191d7a Consistent indentation in CMakeLists.txt 2014-08-20 08:42:29 +01:00
Matt Clarkson 6a66991586 Verify gtest with URL_MD5 2014-08-08 13:46:04 +01:00
Dominic Hamon ed08661efe Remove URL_HASH as it is unsupported 2014-08-07 10:28:55 -07:00
Matt Clarkson d2aa5c1eb3 Verify the download of gtest 2014-08-07 17:58:30 +01:00
Matt Clarkson 6b1a6958c4 CMake function for adding compiler flags 2014-08-04 10:01:44 +01:00
Matt Clarkson 6945096ba1 Add -Wshadow if supported 2014-08-04 10:01:44 +01:00
Matt Clarkson e863292dcc Detect compiler flags and append to default CMake flags 2014-08-04 10:01:44 +01:00
Matt Clarkson c927845d5a get_git_version CMake function 2014-08-01 15:02:32 +01:00
Matt Clarkson d591edf513 Implemented git versioning
This patch automatically versions the shared libraries from any annotated `git`
tags:

```
git tag -a v1.0.0
```

It expects semver version tags such as `v1.0.0`. It would be trivial to support
`1.0.0` but looking around it seems that most C/C++ projects follow `vX.X.X`
rather that `X.X.X` like a lot of `Node.js` stuff.

This determines that the if the project has had a certain amount of commits
since the last tag and also if the project is _dirty_ (has modified files), but
does __nothing__ with that information. In the future a more robust release
could be implemented in the script.

This is pretty brittle and has little in the way of configuration. Ideally we
should use `find_program` to work out where `git` is so that users can configure
it. This implementation assumes that `git` will be available in `PATH`

Outputs the following on the command line:

```
-- git Version: v[MAJOR].[MINOR].[PATCH]-[COMMITS_SINCE_TAG]-[SHA1](-dirty)?
-- Version: [MAJOR].[MINOR].[PATCH]
```
2014-08-01 09:20:28 +01:00
Matt Clarkson 57fdf38f74 Allow shared libraries with BUILD_SHARED_LIBS 2014-07-30 18:08:54 +01:00
Lei Xu 3460bf1aa6 Fixed compiling on Mac 10.9.3 with g++-4.8, clang or system c++ 2014-07-24 23:57:09 -07:00
Chris Kennelly 92cd2e82af Remove URL_HASH and TLS_VERIFY from CMake configuration.
Per the CMake 2.8.0 documentation, these options did not exist for
ExternalProject_Add.  These options were added in CMake 2.8.10.
2014-04-23 14:23:20 -07:00
Chris Kennelly 6087edda9d Add ExternalProject reference to Google Test 1.7.0. 2014-04-23 00:55:36 -07:00
Chris Kennelly e38fde6450 Setup targets from each directory, rather than the top-level. 2014-04-23 00:47:07 -07:00
David Coeurjolly 22f436ea84 Missing includes in install target 2014-02-05 21:07:40 +01:00
David Coeurjolly cbcf159bf2 Thread is required 2014-02-05 20:46:54 +01:00
David Coeurjolly 25074512ff Cmake edit with 'make install' target 2014-02-05 20:38:57 +01:00
Dominic Hamon 77cd9803ce add pedantic errors and fix them 2014-01-10 15:07:04 -08:00