Qt: Move resources out of exe into rcc file

This commit is contained in:
Stenzek
2024-06-30 12:36:05 +10:00
parent 8c0af03448
commit 0d3e674500
6 changed files with 27 additions and 14 deletions

View File

@@ -3,11 +3,9 @@ find_package(Qt6 6.7.2 COMPONENTS Core Gui Widgets LinguistTools REQUIRED)
include(CopyBaseTranslations)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(SRCS
resources/resources.qrc
aboutdialog.cpp
aboutdialog.h
aboutdialog.ui
@@ -253,6 +251,20 @@ elseif(APPLE)
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/DuckStation.icns" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
endif()
# Compile qrc to a binary file.
if(NOT APPLE)
set(RCC_FILE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/resources/duckstation-qt.rcc")
qt_add_binary_resources(duckstation-qt-rcc resources/duckstation-qt.qrc DESTINATION ${RCC_FILE} OPTIONS -no-compress)
add_dependencies(duckstation-qt duckstation-qt-rcc)
else()
set(RCC_FILE "${CMAKE_CURRENT_BINARY_DIR}/duckstation-qt.rcc")
qt_add_binary_resources(duckstation-qt-rcc resources/duckstation-qt.qrc DESTINATION ${RCC_FILE} OPTIONS -no-compress)
add_dependencies(duckstation-qt duckstation-qt-rcc)
target_sources(duckstation-qt PRIVATE ${RCC_FILE})
set_source_files_properties(${RCC_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
endif()
# Translation setup.
qt_add_lrelease(duckstation-qt TS_FILES ${TS_FILES} QM_FILES_OUTPUT_VARIABLE QM_FILES)
if(NOT APPLE)