diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2020-12-03 19:13:08 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-12-07 19:27:05 +0000 |
commit | acfe198d08a45854e8edf1b1fadacec58ce6e075 (patch) | |
tree | 2b4e8d81777db7296abdb15b1a6e4b077772d2d7 /cmake/QtProcessConfigureArgs.cmake | |
parent | 01474c31ba2a3ca225cbc2440bd0ee28458b2a26 (diff) |
CMake: Add extra targets to run single benchmark using CMake generator
Add custom targets with '_benchmark' suffixes to make run of
benchmarks using generators possible, e.g.:
$ ninja tst_bench_qudpsocket_benchmark
Extend '-[no]make' option to pass benchmark. Rework
'-[no]make' processing to unify these options processing.
Also looks like it doesn't make sense to enable benchmarks without
having test enabled. So '-DQT_BUILD_BENCHMARKS' enables test as own
dependency automatically.
Task-number: QTBUG-89076
Change-Id: Ieee9eadaf6d75a1efec120242d6eb786ace1b071
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 61d5b019727dd1c06366205cb307a2a928a2a29c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake/QtProcessConfigureArgs.cmake')
-rw-r--r-- | cmake/QtProcessConfigureArgs.cmake | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/cmake/QtProcessConfigureArgs.cmake b/cmake/QtProcessConfigureArgs.cmake index 258a4a09e1..021b2abdef 100644 --- a/cmake/QtProcessConfigureArgs.cmake +++ b/cmake/QtProcessConfigureArgs.cmake @@ -603,6 +603,30 @@ function(guess_compiler_from_mkspec) set(cmake_args "${cmake_args}" PARENT_SCOPE) endfunction() +function(check_qt_build_parts type) + set(input "INPUT_${type}") + set(buildFlag "TRUE") + if("${type}" STREQUAL "nomake") + set(buildFlag "FALSE") + endif() + + list(APPEND knownParts "tests" "examples" "benchmarks") + + foreach(part ${${input}}) + if(part IN_LIST knownParts) + qt_feature_normalize_name("${part}" partUpperCase) + string(TOUPPER "${partUpperCase}" partUpperCase) + push("-DQT_BUILD_${partUpperCase}=${buildFlag}") + continue() + elseif("${part}" STREQUAL "tools" AND "${type}" STREQUAL "make") + # default true ignored + continue() + endif() + qtConfAddWarning("'-${type} ${part}' is not implemented yet.") + endforeach() + set(cmake_args "${cmake_args}" PARENT_SCOPE) +endfunction() + drop_input(commercial) drop_input(confirm-license) translate_boolean_input(precompile_header BUILD_WITH_PCH) @@ -662,33 +686,8 @@ endif() drop_input(make) drop_input(nomake) -foreach(part ${INPUT_nomake}) - if("${part}" STREQUAL "tests") - push("-DQT_BUILD_TESTS=OFF") - continue() - endif() - if("${part}" STREQUAL "examples") - push("-DQT_BUILD_EXAMPLES=OFF") - continue() - endif() - qtConfAddWarning("'-nomake ${part}' is not implemented yet.") -endforeach() - -foreach(part ${INPUT_make}) - if("${part}" STREQUAL "tests") - push("-DQT_BUILD_TESTS=ON") - continue() - endif() - if("${part}" STREQUAL "examples") - push("-DQT_BUILD_EXAMPLES=ON") - continue() - endif() - if("${part}" STREQUAL "tools") - # default - continue() - endif() - qtConfAddWarning("'-make ${part}' is not implemented yet.") -endforeach() +check_qt_build_parts(nomake) +check_qt_build_parts(make) drop_input(debug) drop_input(release) |