Commit f80396b3 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Allow to use UNITY build see...

Allow to use UNITY build see https://cmake.org/cmake/help/latest/prop_tgt/UNITY_BUILD.html (Reduce compile time. Need cmake 3.16.0) (disable for the moment)
parent b916aad8
Pipeline #44336 passed with stage
in 13 minutes and 4 seconds
......@@ -37,10 +37,8 @@ include(GenerateExportHeader)
add_definitions(-DTRANSLATION_DOMAIN="kdebugsettings")
add_definitions(-DQT_NO_FOREACH)
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
  • This changes the deprecation rules (which previously only apply to a git checkout) and looks unrelated to the commit message.

Please register or sign in to reply
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000)
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x060000)
endif()
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000)
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x060000)
  • add_definitions() can add more than one definition. If you're going to shuffle things around, consider merging these calls.

Please register or sign in to reply
configure_file(config-kdebugsettings.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kdebugsettings.h)
......@@ -52,6 +50,16 @@ if(BUILD_TESTING)
add_definitions(-DBUILD_TESTING)
endif(BUILD_TESTING)
option(USE_UNITY_CMAKE_SUPPORT "Use UNITY cmake support (speedup compile time)" FALSE)
  • Typically (I won't say it's a rule though) option() values are ON or OFF (even if to CMake, all these boolean-ish words mean the same).

Please register or sign in to reply
set(COMPILE_WITH_UNITY_CMAKE_SUPPORT false)
  • Inconsistent capitalization. Use FALSE (or OFF, since this is related to the option).

Please register or sign in to reply
if (USE_UNITY_CMAKE_SUPPORT)
if(${CMAKE_VERSION} VERSION_LESS "3.16.0")
message(STATUS "CMAKE version is less than 3.16.0 . We can't use cmake unify build support")
Please register or sign in to reply
else()
set(COMPILE_WITH_UNITY_CMAKE_SUPPORT true)
Please register or sign in to reply
endif()
endif()
add_subdirectory( src )
if (BUILD_TESTING)
......
......@@ -21,6 +21,9 @@ set(kdebugsettings_LIB_SRCS
)
add_library(libkdebugsettings ${kdebugsettings_LIB_SRCS})
if (COMPILE_WITH_UNITY_CMAKE_SUPPORT)
  • Why is all this machinery needed, when the linked documenation page recommends letting the developer set CMAKE_UNITY_BUILD variable on the cmake(1) command line ? What is special about all the other parts of this project that make it unsuitable for a unity build?

Please register or sign in to reply
set_target_properties(libkdebugsettings PROPERTIES UNITY_BUILD ON)
endif()
generate_export_header(libkdebugsettings BASE_NAME libkdebugsettings)
target_link_libraries(libkdebugsettings
Qt5::Core
......@@ -51,6 +54,9 @@ set(kdebugsettings_SRCS
)
add_executable(kdebugsettings ${kdebugsettings_SRCS})
if (COMPILE_WITH_UNITY_CMAKE_SUPPORT)
set_target_properties(kdebugsettings PROPERTIES UNITY_BUILD ON)
endif()
target_link_libraries(kdebugsettings Qt5::Widgets KF5::I18n KF5::DBusAddons KF5::CoreAddons KF5::ConfigCore KF5::WidgetsAddons KF5::ItemViews KF5::Completion libkdebugsettings)
......
  • Where is the merge request / review / discussion on some relevant mailing list about turning on unity builds?

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