diff options
author | Kirill Bobyrev <kbobyrev.opensource@gmail.com> | 2018-08-28 09:42:41 +0000 |
---|---|---|
committer | Kirill Bobyrev <kbobyrev.opensource@gmail.com> | 2018-08-28 09:42:41 +0000 |
commit | 18c6fab1078c32aee3cfcadedf29f999661ffdac (patch) | |
tree | aca8e75639d772a0c1685cdb0e945ad8a5e043c2 /cmake | |
parent | f3a4bc290532955c93ff620a60bbb5692519c734 (diff) |
Pull google/benchmark library to the LLVM tree
This patch pulls google/benchmark v1.4.1 into the LLVM tree so that any
project could use it for benchmark generation. A dummy benchmark is
added to `llvm/benchmarks/DummyYAML.cpp` to validate the correctness of
the build process.
The current version does not utilize LLVM LNT and LLVM CMake
infrastructure, but that might be sufficient for most users. Two
introduced CMake variables:
* `LLVM_INCLUDE_BENCHMARKS` (`ON` by default) generates benchmark
targets
* `LLVM_BUILD_BENCHMARKS` (`OFF` by default) adds generated
benchmark targets to the list of default LLVM targets (i.e. if `ON`
benchmarks will be built upon standard build invocation, e.g. `ninja` or
`make` with no specific targets)
List of modifications:
* `BENCHMARK_ENABLE_TESTING` is disabled
* `BENCHMARK_ENABLE_EXCEPTIONS` is disabled
* `BENCHMARK_ENABLE_INSTALL` is disabled
* `BENCHMARK_ENABLE_GTEST_TESTS` is disabled
* `BENCHMARK_DOWNLOAD_DEPENDENCIES` is disabled
Original discussion can be found here:
http://lists.llvm.org/pipermail/llvm-dev/2018-August/125023.html
Reviewed by: dberris, lebedev.ri
Subscribers: ilya-biryukov, ioeric, EricWF, lebedev.ri, srhines,
dschuff, mgorny, krytarowski, fedor.sergeev, mgrang, jfb, llvm-commits
Differential Revision: https://reviews.llvm.org/D50894
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340809 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/modules/AddLLVM.cmake | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index aec0e5608d3..45e744f5e13 100644 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -1084,7 +1084,7 @@ function(add_unittest test_suite test_name) # Our current version of gtest does not properly recognize C++11 support # with MSVC, so it falls back to tr1 / experimental classes. Since LLVM # itself requires C++11, we can safely force it on unconditionally so that - # we don't have to fight with the buggy gtest check. + # we don't have to fight with the buggy gtest check. add_definitions(-DGTEST_LANG_CXX11=1) add_definitions(-DGTEST_HAS_TR1_TUPLE=0) @@ -1120,6 +1120,18 @@ function(add_unittest test_suite test_name) endif () endfunction() +# Generic support for adding a benchmark. +function(add_benchmark benchmark_name) + if( NOT LLVM_BUILD_BENCHMARKS ) + set(EXCLUDE_FROM_ALL ON) + endif() + + add_llvm_executable(${benchmark_name} IGNORE_EXTERNALIZE_DEBUGINFO NO_INSTALL_RPATH ${ARGN}) + set(outdir ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}) + set_output_directory(${benchmark_name} BINARY_DIR ${outdir} LIBRARY_DIR ${outdir}) + target_link_libraries(${benchmark_name} PRIVATE benchmark) +endfunction() + function(llvm_add_go_executable binary pkgpath) cmake_parse_arguments(ARG "ALL" "" "DEPENDS;GOFLAGS" ${ARGN}) |