Upgrade to Qt 6 (#130)

Why? Open Source Qt 5 will stop receiving updates rather sooner than later so it's worth switching to Qt 6 to remain compatible with modern systems.

Reviewed-on: http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/torzu-emu/torzu/pulls/130
This commit is contained in:
spectranator
2025-07-02 20:27:29 +00:00
parent 25c6aaec18
commit 59bda52beb
19 changed files with 615 additions and 169 deletions

View File

@@ -218,6 +218,10 @@ if(ARCHITECTURE_x86_64)
target_link_libraries(common PRIVATE xbyak::xbyak)
endif()
if (TARGET clang_rt_builtins)
target_link_libraries(common PUBLIC clang_rt_builtins)
endif()
if (HAS_NCE)
target_sources(common
PRIVATE

View File

@@ -19,6 +19,10 @@ if (MSVC)
endif()
target_link_libraries(yuzu-room PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
if (TARGET getopt)
target_link_libraries(yuzu-room PRIVATE getopt)
endif()
if(UNIX AND NOT APPLE)
install(TARGETS yuzu-room)
endif()

View File

@@ -250,7 +250,8 @@ bool Inst::AreAllArgsImmediates() const {
if (op == Opcode::Phi) {
throw LogicError("Testing for all arguments are immediates on phi instruction");
}
return std::all_of(args.begin(), args.begin() + NumArgs(),
return std::all_of(args.begin(),
args.begin() + static_cast<ptrdiff_t>(NumArgs()),
[](const IR::Value& value) { return value.IsImmediate(); });
}

View File

@@ -348,6 +348,15 @@ target_sources(yuzu
${THEMES}
)
target_compile_definitions(yuzu PUBLIC YUZU_QT_VERSION_STR="${Qt6Widgets_VERSION}")
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
qt_import_plugins(yuzu
INCLUDE Qt6::QXcbIntegrationPlugin
EXCLUDE_BY_TYPE sqldrivers
)
endif()
if (APPLE)
set(MACOSX_ICON "../../dist/yuzu.icns")
set_source_files_properties(${MACOSX_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
@@ -449,7 +458,8 @@ if(UNIX AND NOT APPLE)
install(TARGETS yuzu)
endif()
if (WIN32 AND QT_VERSION VERSION_GREATER_EQUAL 6)
get_target_property(QT_TARGET_TYPE Qt6::Widgets TYPE)
if (WIN32 AND QT_VERSION VERSION_GREATER_EQUAL 6 AND QT_TARGET_TYPE STREQUAL "SHARED_LIBRARY")
set(YUZU_EXE_DIR "$<TARGET_FILE_DIR:yuzu>")
add_custom_command(TARGET yuzu POST_BUILD COMMAND ${WINDEPLOYQT_EXECUTABLE} "${YUZU_EXE_DIR}/yuzu.exe" --dir "${YUZU_EXE_DIR}" --libdir "${YUZU_EXE_DIR}" --plugindir "${YUZU_EXE_DIR}/plugins" --no-compiler-runtime --no-opengl-sw --no-system-d3d-compiler --no-translations --verbose 0)
endif()

View File

@@ -3,6 +3,7 @@
#include <QIcon>
#include <fmt/format.h>
#include "common/scm_rev.h"
#include "ui_aboutdialog.h"
#include "yuzu/about_dialog.h"
@@ -24,9 +25,9 @@ AboutDialog::AboutDialog(QWidget* parent)
if (!yuzu_logo.isNull()) {
ui->labelLogo->setPixmap(yuzu_logo.pixmap(200));
}
ui->labelBuildInfo->setText(
ui->labelBuildInfo->text().arg(QString::fromStdString(yuzu_build_version),
QString::fromUtf8(Common::g_build_date).left(10)));
ui->labelBuildInfo->setText(ui->labelBuildInfo->text().arg(
QString::fromStdString(yuzu_build_version),
QString::fromUtf8(Common::g_build_date).left(10), QString::fromUtf8(YUZU_QT_VERSION_STR)));
}
AboutDialog::~AboutDialog() = default;

View File

@@ -82,7 +82,7 @@
</sizepolicy>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;%1 (%2)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;%1 (%2) with Qt %3&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>

View File

@@ -53,6 +53,7 @@
#include "yuzu/multiplayer/state.h"
#include "yuzu/util/controller_navigation.h"
// These are wrappers to avoid the calls to CreateDirectory and CreateFile because of the Windows
// defines.
static FileSys::VirtualDir VfsFilesystemCreateDirectoryWrapper(
@@ -5212,9 +5213,6 @@ static void SetHighDPIAttributes() {
QApplication::setHighDpiScaleFactorRoundingPolicy(
Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
#endif
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
}
int main(int argc, char* argv[]) {

View File

@@ -36,6 +36,10 @@ if (YUZU_CMD)
endif()
target_link_libraries(yuzu-cmd PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
if (TARGET getopt)
target_link_libraries(yuzu-cmd PRIVATE getopt)
endif()
create_resource("../../dist/yuzu.bmp" "yuzu_cmd/yuzu_icon.h" "yuzu_icon")
target_include_directories(yuzu-cmd PRIVATE ${RESOURCES_DIR})
@@ -64,4 +68,4 @@ if (YUZU_CMD)
endif()
create_target_directory_groups(yuzu-cmd)
endif()
endif()