summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Kyle Kienapfel2022-10-17 16:55:40 -0700
committerGravatar Kyle Kienapfel2022-11-24 06:28:42 -0800
commita75542ad2dd028f9aa3adfb00e92817ada12ccd8 (patch)
tree1ee95f8a10eb450aebd88c8940f1ea371bf226af /src
parentqt: Add Qt version to LogRuntimes (diff)
downloadyuzu-a75542ad2dd028f9aa3adfb00e92817ada12ccd8.tar.gz
yuzu-a75542ad2dd028f9aa3adfb00e92817ada12ccd8.tar.xz
yuzu-a75542ad2dd028f9aa3adfb00e92817ada12ccd8.zip
CMake: rework for Qt6 support
This PR rearranges things in the CMake system to make compiling with Qt6 possible 1. Camera API has changed in Qt6, so the camera feature is disabled 2. A previous fix involving QLocale is now version gated. 3. QRegExp replaced with QRegularExpression, see #5343 4. Qt6_LOCATION option added to specify a location to search for Qt6 (see examples below) 5. windeployqt is used to copy Qt6 files into the build directory on Windows Notes for Arch Linux Arch install happened to have qt6-base qt6-declarative qt6-translations installed mkdir build && cd build cmake .. -GNinja -DYUZU_USE_BUNDLED_VCPKG=ON -DYUZU_TESTS=OFF -DENABLE_QT6=YES -DYUZU_USE_BUNDLED_QT=NO Windows (MSVC) Qt wants users to download precompiled libraries via an online installer, it is worth noting that the GPL/LGPL takes precendence over any ... In the Qt Maintenance tool, under a version, such as 6.3.1 Select "MSVC 2019 64-bit" Under Additional Libraries Qt Multimedia may be of use for Camera support For the Web Applet I had to select the following: PDF Positioning WebChannel WebEngine mkdir build && cd build cmake -G "Visual Studio 16 2019" -DQt6_LOCATION=C:/Qt/6.4.0/msvc2019_64/ \ -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=YES -DYUZU_USE_BUNDLED_QT=NO \ -DENABLE_QT_TRANSLATION=YES -DENABLE_QT6=YES .. Some numbers for reference (msvc2019_64) Qt5 (slimmed down) 508 MB Qt5.15.2 all in 929 MB Qt6.3.1 1.71 GB Qt6.3.2 1.73 GB Qt6.4.0-beta3 1.83 GB Qt6.4.0 1.67 GB
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/CMakeLists.txt26
-rw-r--r--src/yuzu/multiplayer/direct_connect.cpp2
-rw-r--r--src/yuzu/multiplayer/validation.h16
3 files changed, 30 insertions, 14 deletions
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt
index 5cc1fbf32..ec9246e74 100644
--- a/src/yuzu/CMakeLists.txt
+++ b/src/yuzu/CMakeLists.txt
@@ -292,7 +292,7 @@ if (APPLE)
292 set_target_properties(yuzu PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist) 292 set_target_properties(yuzu PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
293elseif(WIN32) 293elseif(WIN32)
294 # compile as a win32 gui application instead of a console application 294 # compile as a win32 gui application instead of a console application
295 if (QT_VERSION VERSION_GREATER 6) 295 if (QT_VERSION VERSION_GREATER_EQUAL 6)
296 target_link_libraries(yuzu PRIVATE Qt6::EntryPointPrivate) 296 target_link_libraries(yuzu PRIVATE Qt6::EntryPointPrivate)
297 else() 297 else()
298 target_link_libraries(yuzu PRIVATE Qt5::WinMain) 298 target_link_libraries(yuzu PRIVATE Qt5::WinMain)
@@ -308,15 +308,15 @@ endif()
308create_target_directory_groups(yuzu) 308create_target_directory_groups(yuzu)
309 309
310target_link_libraries(yuzu PRIVATE common core input_common network video_core) 310target_link_libraries(yuzu PRIVATE common core input_common network video_core)
311target_link_libraries(yuzu PRIVATE Boost::boost glad Qt::Widgets Qt::Multimedia) 311target_link_libraries(yuzu PRIVATE Boost::boost glad Qt${QT_MAJOR_VERSION}::Widgets)
312target_link_libraries(yuzu PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads) 312target_link_libraries(yuzu PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
313 313
314target_include_directories(yuzu PRIVATE ../../externals/Vulkan-Headers/include) 314target_include_directories(yuzu PRIVATE ../../externals/Vulkan-Headers/include)
315if (NOT WIN32) 315if (NOT WIN32)
316 target_include_directories(yuzu PRIVATE ${Qt5Gui_PRIVATE_INCLUDE_DIRS}) 316 target_include_directories(yuzu PRIVATE ${Qt${QT_MAJOR_VERSION}Gui_PRIVATE_INCLUDE_DIRS})
317endif() 317endif()
318if (UNIX AND NOT APPLE) 318if (UNIX AND NOT APPLE)
319 target_link_libraries(yuzu PRIVATE Qt::DBus) 319 target_link_libraries(yuzu PRIVATE Qt${QT_MAJOR_VERSION}::DBus)
320endif() 320endif()
321 321
322target_compile_definitions(yuzu PRIVATE 322target_compile_definitions(yuzu PRIVATE
@@ -355,8 +355,13 @@ if (ENABLE_WEB_SERVICE)
355 target_compile_definitions(yuzu PRIVATE -DENABLE_WEB_SERVICE) 355 target_compile_definitions(yuzu PRIVATE -DENABLE_WEB_SERVICE)
356endif() 356endif()
357 357
358if (YUZU_USE_QT_MULTIMEDIA)
359 target_link_libraries(yuzu PRIVATE Qt${QT_MAJOR_VERSION}::Multimedia)
360 target_compile_definitions(yuzu PRIVATE -DYUZU_USE_QT_MULTIMEDIA)
361endif ()
362
358if (YUZU_USE_QT_WEB_ENGINE) 363if (YUZU_USE_QT_WEB_ENGINE)
359 target_link_libraries(yuzu PRIVATE Qt::WebEngineCore Qt::WebEngineWidgets) 364 target_link_libraries(yuzu PRIVATE Qt${QT_MAJOR_VERSION}::WebEngineCore Qt${QT_MAJOR_VERSION}::WebEngineWidgets)
360 target_compile_definitions(yuzu PRIVATE -DYUZU_USE_QT_WEB_ENGINE) 365 target_compile_definitions(yuzu PRIVATE -DYUZU_USE_QT_WEB_ENGINE)
361endif () 366endif ()
362 367
@@ -364,7 +369,16 @@ if(UNIX AND NOT APPLE)
364 install(TARGETS yuzu) 369 install(TARGETS yuzu)
365endif() 370endif()
366 371
367if (YUZU_USE_BUNDLED_QT) 372if (WIN32 AND QT_VERSION VERSION_GREATER_EQUAL 6)
373 if (MSVC AND NOT ${CMAKE_GENERATOR} STREQUAL "Ninja")
374 set(YUZU_EXE_DIR "${CMAKE_BINARY_DIR}/bin/$<CONFIG>")
375 else()
376 set(YUZU_EXE_DIR "${CMAKE_BINARY_DIR}/bin")
377 endif()
378 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)
379endif()
380
381if (YUZU_USE_BUNDLED_QT AND QT_VERSION VERSION_LESS 6)
368 include(CopyYuzuQt5Deps) 382 include(CopyYuzuQt5Deps)
369 copy_yuzu_Qt5_deps(yuzu) 383 copy_yuzu_Qt5_deps(yuzu)
370endif() 384endif()
diff --git a/src/yuzu/multiplayer/direct_connect.cpp b/src/yuzu/multiplayer/direct_connect.cpp
index 10bf0a4fb..cbd52da85 100644
--- a/src/yuzu/multiplayer/direct_connect.cpp
+++ b/src/yuzu/multiplayer/direct_connect.cpp
@@ -4,7 +4,7 @@
4#include <QComboBox> 4#include <QComboBox>
5#include <QFuture> 5#include <QFuture>
6#include <QIntValidator> 6#include <QIntValidator>
7#include <QRegExpValidator> 7#include <QRegularExpressionValidator>
8#include <QString> 8#include <QString>
9#include <QtConcurrent/QtConcurrentRun> 9#include <QtConcurrent/QtConcurrentRun>
10#include "common/settings.h" 10#include "common/settings.h"
diff --git a/src/yuzu/multiplayer/validation.h b/src/yuzu/multiplayer/validation.h
index dabf860be..dd25af280 100644
--- a/src/yuzu/multiplayer/validation.h
+++ b/src/yuzu/multiplayer/validation.h
@@ -3,7 +3,7 @@
3 3
4#pragma once 4#pragma once
5 5
6#include <QRegExp> 6#include <QRegularExpression>
7#include <QString> 7#include <QString>
8#include <QValidator> 8#include <QValidator>
9 9
@@ -29,19 +29,21 @@ public:
29 29
30private: 30private:
31 /// room name can be alphanumeric and " " "_" "." and "-" and must have a size of 4-20 31 /// room name can be alphanumeric and " " "_" "." and "-" and must have a size of 4-20
32 QRegExp room_name_regex = QRegExp(QStringLiteral("^[a-zA-Z0-9._- ]{4,20}$")); 32 QRegularExpression room_name_regex =
33 QRegExpValidator room_name; 33 QRegularExpression(QStringLiteral("^[a-zA-Z0-9._ -]{4,20}"));
34 QRegularExpressionValidator room_name;
34 35
35 /// nickname can be alphanumeric and " " "_" "." and "-" and must have a size of 4-20 36 /// nickname can be alphanumeric and " " "_" "." and "-" and must have a size of 4-20
36 QRegExp nickname_regex = QRegExp(QStringLiteral("^[a-zA-Z0-9._- ]{4,20}$")); 37 const QRegularExpression nickname_regex =
37 QRegExpValidator nickname; 38 QRegularExpression(QStringLiteral("^[a-zA-Z0-9._ -]{4,20}"));
39 QRegularExpressionValidator nickname;
38 40
39 /// ipv4 address only 41 /// ipv4 address only
40 // TODO remove this when we support hostnames in direct connect 42 // TODO remove this when we support hostnames in direct connect
41 QRegExp ip_regex = QRegExp(QStringLiteral( 43 QRegularExpression ip_regex = QRegularExpression(QStringLiteral(
42 "(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|" 44 "(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|"
43 "2[0-4][0-9]|25[0-5])")); 45 "2[0-4][0-9]|25[0-5])"));
44 QRegExpValidator ip; 46 QRegularExpressionValidator ip;
45 47
46 /// port must be between 0 and 65535 48 /// port must be between 0 and 65535
47 QIntValidator port; 49 QIntValidator port;