Commit 07902e14 authored by Milian Wolff's avatar Milian Wolff
Browse files

Use an option to decide whether benchmarks should be compiled

By default, this option is disabled for debug builds and enabled
for any other builds.

Now, we can even add it for debug builds, e.g. to get ASAN coverage
for the benchmarks.
parent 7e8aee2c
......@@ -146,11 +146,13 @@ endif()
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_TOLOWER)
if(CMAKE_BUILD_TYPE_TOLOWER MATCHES "debug"
OR CMAKE_BUILD_TYPE_TOLOWER STREQUAL "")
set(COMPILER_OPTIMIZATIONS_DISABLED TRUE)
set(COMPILER_OPTIMIZATIONS_ENABLED OFF)
else()
set(COMPILER_OPTIMIZATIONS_DISABLED FALSE)
set(COMPILER_OPTIMIZATIONS_ENABLED ON)
endif()
option(BUILD_BENCHMARKS "Whether benchmarks should be compiled or not" ${COMPILER_OPTIMIZATIONS_ENABLED})
# create config-kdevelop.h
configure_file(config-kdevelop.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kdevelop.h)
include_directories(${KDevelop_BINARY_DIR}) # for config-kdevelop.h
......
......@@ -11,7 +11,7 @@ add_target_compile_flag_if_supported(test_identifier PRIVATE -Wno-self-assign-ov
ecm_add_test(test_stringhelpers.cpp
LINK_LIBRARIES Qt5::Test KDev::Tests KDev::Language)
if(NOT COMPILER_OPTIMIZATIONS_DISABLED)
if(BUILD_BENCHMARKS)
ecm_add_test(bench_hashes.cpp
LINK_LIBRARIES Qt5::Test KDev::Tests KDev::Language)
set_tests_properties(bench_hashes PROPERTIES TIMEOUT 30)
......
......@@ -6,7 +6,7 @@ remove_definitions(
-DQT_NO_CAST_FROM_BYTEARRAY
)
if(NOT COMPILER_OPTIMIZATIONS_DISABLED)
if(BUILD_BENCHMARKS)
ecm_add_test(bench_itemrepository.cpp LINK_LIBRARIES
LINK_LIBRARIES Qt5::Test KDev::Serialization KDev::Tests)
set_tests_properties(bench_itemrepository PROPERTIES TIMEOUT 30)
......
......@@ -103,7 +103,7 @@ LINK_LIBRARIES
KDevClangPrivate
)
if(NOT COMPILER_OPTIMIZATIONS_DISABLED)
if(BUILD_BENCHMARKS)
ecm_add_test(bench_codecompletion.cpp
TEST_NAME bench_codecompletion
LINK_LIBRARIES
......
......@@ -17,7 +17,7 @@ target_link_libraries(quickopentestbase PUBLIC
ecm_add_test(test_quickopen.cpp LINK_LIBRARIES quickopentestbase)
if(NOT COMPILER_OPTIMIZATIONS_DISABLED)
if(BUILD_BENCHMARKS)
ecm_add_test(bench_quickopen.cpp LINK_LIBRARIES quickopentestbase)
set_tests_properties(bench_quickopen PROPERTIES TIMEOUT 30)
endif()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment