mirror of
https://github.com/stenzek/duckstation.git
synced 2025-07-20 09:00:07 +00:00
Qt: Work around autouic bug causing unnecessary recompiles
This commit is contained in:
parent
a002fd2672
commit
6615fc79d6
@ -1,7 +1,8 @@
|
||||
include(CopyBaseTranslations)
|
||||
|
||||
set(CMAKE_AUTOUIC OFF)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(SRCS
|
||||
aboutdialog.cpp
|
||||
@ -125,6 +126,7 @@ set(SRCS
|
||||
postprocessingsettingswidget.cpp
|
||||
postprocessingsettingswidget.h
|
||||
postprocessingchainconfigwidget.ui
|
||||
postprocessingoverlayconfigwidget.ui
|
||||
qthost.cpp
|
||||
qthost.h
|
||||
qtkeycodes.cpp
|
||||
@ -179,6 +181,22 @@ target_compile_definitions(duckstation-qt PRIVATE QT_NO_EXCEPTIONS)
|
||||
|
||||
add_core_resources(duckstation-qt)
|
||||
|
||||
# Automatically generate a list of .ui calls and call qt_wrap_ui() to generate targets.
|
||||
# This is needed because otherwise CMake rebuilds all source files if any unrelated files change.
|
||||
# See https://gitlab.kitware.com/cmake/cmake/-/issues/22531 and https://gitlab.kitware.com/cmake/cmake/-/issues/16776
|
||||
# Documentation says to use qt_add_ui(), but this generates a separate directory for every file.
|
||||
# I'm concerned about arg length limits, so I manually invoke qt_wrap_ui().
|
||||
# Also see https://github.com/thorntonryan/autouic_example.
|
||||
set(UI_FILES "")
|
||||
foreach(src ${SRCS})
|
||||
if(src MATCHES "\\.ui$")
|
||||
list(APPEND UI_FILES ${src})
|
||||
endif()
|
||||
endforeach()
|
||||
qt_wrap_ui(UI_SRCS SOURCES ${UI_FILES})
|
||||
target_sources(duckstation-qt PRIVATE ${UI_SRCS})
|
||||
target_include_directories(duckstation-qt PRIVATE "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
|
||||
|
||||
if(WIN32)
|
||||
target_sources(duckstation-qt PRIVATE
|
||||
duckstation-qt.rc
|
||||
|
Loading…
x
Reference in New Issue
Block a user