Cockatrice/libcockatrice_interfaces/CMakeLists.txt
BruebachL 315cbae345
[Build] Extend PCH to libraries and grow IWYU-driven header sets (#7456)
The executables precompile Qt since #7235, but the libcockatrice_*
static libraries still reparse the full Qt Core stack in every TU.
Measured over the tree after the IWYU pass: 380 MB of header parse in
the libraries, 92% of it reachable from qtcore_pch.h.

- Apply qtcore_pch.h to the 14 Qt Core static library targets
  (skips libcockatrice_rng: its SFMT.c is C and cannot use a C++
  precompiled header).
- Grow qtcore_pch.h with 25 QtCore headers that IWYU shows are
  re-parsed across many TUs and were not already reachable from the
  existing list (JSON/QUuid cluster, QSettings, item models,
  threading, XmlStream, QTemporaryDir, ...).
- Grow qtwidgets_pch.h with 30 QtGui/QtWidgets headers (dialog
  cluster, item views, QImageReader, ...).

Only stable Qt headers go into the PCH, so it rarely invalidates.
Test executables stay PCH-less: 1-3 TUs per target does not amortize
the extra precompile.

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2026-10-11 15:07:30 +02:00

35 lines
1.7 KiB
CMake

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(HEADERS
libcockatrice/interfaces/interface_cache_storage_settings_provider.h
libcockatrice/interfaces/interface_card_database_path_provider.h
libcockatrice/interfaces/interface_card_preference_provider.h
libcockatrice/interfaces/interface_card_set_priority_controller.h
libcockatrice/interfaces/interface_cards_display_settings_provider.h
libcockatrice/interfaces/interface_chat_settings_provider.h
libcockatrice/interfaces/interface_deck_editor_settings_provider.h
libcockatrice/interfaces/interface_game_settings_provider.h
libcockatrice/interfaces/interface_interface_settings_provider.h
libcockatrice/interfaces/interface_network_settings_provider.h
libcockatrice/interfaces/interface_paths_settings_provider.h
libcockatrice/interfaces/interface_personal_settings_provider.h
libcockatrice/interfaces/interface_sound_settings_provider.h
libcockatrice/interfaces/interface_tabs_settings_provider.h
libcockatrice/interfaces/interface_updates_settings_provider.h
libcockatrice/interfaces/interface_visual_deck_storage_settings_provider.h
libcockatrice/interfaces/noop_card_database_path_provider.h
libcockatrice/interfaces/noop_card_preference_provider.h
libcockatrice/interfaces/noop_card_set_priority_controller.h
)
qt6_wrap_cpp(MOC_SOURCES ${HEADERS})
add_library(libcockatrice_interfaces STATIC ${MOC_SOURCES})
target_include_directories(libcockatrice_interfaces PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(libcockatrice_interfaces PUBLIC libcockatrice_utility ${QT_CORE_MODULE})
target_precompile_headers(libcockatrice_interfaces PRIVATE "${CMAKE_SOURCE_DIR}/cmake/pch/qtcore_pch.h")