Browse Source

CMake: Call UIC on the .ui files manually

Fixes unnecessary recompilation when editing GUI files.

PR #16151.
adaptive-webui-19844
Prince Gupta 3 years ago committed by GitHub
parent
commit
96965ae347
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/CMakeLists.txt
  2. 9
      src/app/CMakeLists.txt
  3. 69
      src/gui/CMakeLists.txt

3
src/CMakeLists.txt

@ -63,11 +63,10 @@ else() @@ -63,11 +63,10 @@ else()
endif()
endif()
# automatically call Qt moc, rcc and uic as needed for all targets by default
# automatically call Qt moc and rcc as needed for all targets by default
set(CMAKE_AUTORCC_OPTIONS --compress 9 --threshold 5)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
# create interface-only target libraries with common compile options/definitions to link to
include(MacroQbtCommonConfig)

9
src/app/CMakeLists.txt

@ -110,10 +110,17 @@ if (STACKTRACE) @@ -110,10 +110,17 @@ if (STACKTRACE)
target_sources(qbt_app PRIVATE stacktrace_win.h)
if (GUI)
qt_wrap_ui(STACKTRACE_UI_HEADERS stacktracedialog.ui)
target_sources(qbt_app PRIVATE
stacktracedialog.h
stacktracedialog.cpp
stacktracedialog.ui
${STACKTRACE_UI_HEADERS}
)
# UI headers will be generated in ${CMAKE_CURRENT_BINARY_DIR}
target_include_directories(qbt_app PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
)
endif()

69
src/gui/CMakeLists.txt

@ -1,3 +1,37 @@ @@ -1,3 +1,37 @@
# CMAKE_AUTO_UI causes unncessary rebuilds
qt_wrap_ui(UI_HEADERS
aboutdialog.ui
addnewtorrentdialog.ui
autoexpandabledialog.ui
banlistoptionsdialog.ui
cookiesdialog.ui
deletionconfirmationdialog.ui
downloadfromurldialog.ui
executionlogwidget.ui
ipsubnetwhitelistoptionsdialog.ui
mainwindow.ui
optionsdialog.ui
previewselectdialog.ui
properties/peersadditiondialog.ui
properties/propertieswidget.ui
properties/trackersadditiondialog.ui
rss/automatedrssdownloader.ui
rss/rsswidget.ui
search/pluginselectdialog.ui
search/pluginsourcedialog.ui
search/searchjobwidget.ui
search/searchwidget.ui
shutdownconfirmdialog.ui
speedlimitdialog.ui
statsdialog.ui
torrentcategorydialog.ui
torrentcreatordialog.ui
torrentoptionsdialog.ui
trackerentriesdialog.ui
watchedfolderoptionsdialog.ui
)
add_library(qbt_gui STATIC
# headers
aboutdialog.h
@ -161,40 +195,15 @@ add_library(qbt_gui STATIC @@ -161,40 +195,15 @@ add_library(qbt_gui STATIC
watchedfolderoptionsdialog.cpp
watchedfoldersmodel.cpp
# forms
aboutdialog.ui
addnewtorrentdialog.ui
autoexpandabledialog.ui
banlistoptionsdialog.ui
cookiesdialog.ui
deletionconfirmationdialog.ui
downloadfromurldialog.ui
executionlogwidget.ui
ipsubnetwhitelistoptionsdialog.ui
mainwindow.ui
optionsdialog.ui
previewselectdialog.ui
properties/peersadditiondialog.ui
properties/propertieswidget.ui
properties/trackersadditiondialog.ui
rss/automatedrssdownloader.ui
rss/rsswidget.ui
search/pluginselectdialog.ui
search/pluginsourcedialog.ui
search/searchjobwidget.ui
search/searchwidget.ui
shutdownconfirmdialog.ui
speedlimitdialog.ui
statsdialog.ui
torrentcategorydialog.ui
torrentcreatordialog.ui
torrentoptionsdialog.ui
trackerentriesdialog.ui
watchedfolderoptionsdialog.ui
# generated .ui headers
${UI_HEADERS}
)
target_sources(qbt_gui INTERFACE about.qrc)
# UI headers will be generated in ${CMAKE_CURRENT_BINARY_DIR}
target_include_directories(qbt_gui PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(qbt_gui
PRIVATE
qbt_base

Loading…
Cancel
Save