From ce9413e5494b7025a2f73f54f7438a756fcecf82 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Wed, 19 Apr 2023 12:05:24 -0700 Subject: [PATCH] cmake: drop qt5 --- Source/Core/DolphinQt/CMakeLists.txt | 49 ++++++++-------------------- 1 file changed, 14 insertions(+), 35 deletions(-) diff --git a/Source/Core/DolphinQt/CMakeLists.txt b/Source/Core/DolphinQt/CMakeLists.txt index 1ef8c0cb64..8b3f72f580 100644 --- a/Source/Core/DolphinQt/CMakeLists.txt +++ b/Source/Core/DolphinQt/CMakeLists.txt @@ -13,16 +13,10 @@ endif() set(CMAKE_AUTOMOC ON) -# For some reason the method in Qt6 documentation is not working (at least on ubuntu jammy) -# When Qt5 and Qt6 are given in same NAMES entry, only Qt5 is ever found. -find_package(QT NAMES Qt6 COMPONENTS Core Gui Widgets) -if(NOT QT_DIR) - find_package(QT NAMES Qt5 COMPONENTS Core Gui Widgets) -endif() -find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets) -message(STATUS "Found Qt version ${QT_VERSION}") +find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets) +message(STATUS "Found Qt version ${Qt6_VERSION}") -set_property(TARGET Qt${QT_VERSION_MAJOR}::Core PROPERTY INTERFACE_COMPILE_FEATURES "") +set_property(TARGET Qt6::Core PROPERTY INTERFACE_COMPILE_FEATURES "") add_executable(dolphin-emu AboutDialog.cpp @@ -374,13 +368,13 @@ PRIVATE target_include_directories(dolphin-emu PRIVATE ${CMAKE_CURRENT_BINARY_DIR} - ${Qt${QT_VERSION_MAJOR}Gui_PRIVATE_INCLUDE_DIRS} + ${Qt6Gui_PRIVATE_INCLUDE_DIRS} ) target_link_libraries(dolphin-emu PRIVATE core - Qt${QT_VERSION_MAJOR}::Widgets + Qt6::Widgets uicommon imgui implot @@ -408,14 +402,9 @@ if (MSVC) # Qt 6.3.0 headers use std::aligned_storage instead of alignas target_compile_definitions(dolphin-emu PRIVATE _SILENCE_CXX23_ALIGNED_STORAGE_DEPRECATION_WARNING) - if ("${QT_VERSION_MAJOR}" GREATER_EQUAL 6) - # Qt6 requires RTTI - remove_cxx_flag_from_target(dolphin-emu "/GR-") - target_compile_options(dolphin-emu PRIVATE "/GR") - else() - # Add precompiled header - target_link_libraries(audiocommon PRIVATE use_pch) - endif() + # Qt6 requires RTTI + remove_cxx_flag_from_target(dolphin-emu "/GR-") + target_compile_options(dolphin-emu PRIVATE "/GR") endif() if(WIN32) @@ -448,17 +437,10 @@ if(WIN32) ) # Delegate to Qt's official deployment binary on Windows to copy over the necessary Qt-specific libraries, etc. - get_target_property(MOC_EXECUTABLE_LOCATION Qt${QT_VERSION_MAJOR}::moc IMPORTED_LOCATION) + get_target_property(MOC_EXECUTABLE_LOCATION Qt6::moc IMPORTED_LOCATION) get_filename_component(QT_BINARY_DIRECTORY "${MOC_EXECUTABLE_LOCATION}" DIRECTORY) find_program(WINDEPLOYQT_EXE windeployqt HINTS "${QT_BINARY_DIRECTORY}") - if ("${QT_VERSION_MAJOR}" LESS 6) - set(NO_ANGLE_PARAM "--no-angle") - else() - # parameter no longer exists in Qt6 - set(NO_ANGLE_PARAM "") - endif() - # Note: We set the PATH for the duration of this command so that the # deployment application is able to locate the Qt libraries to copy. # if the necessary paths aren't already set beforehand. @@ -481,7 +463,6 @@ if(WIN32) --no-translations --no-compiler-runtime --no-system-d3d-compiler - "${NO_ANGLE_PARAM}" --no-opengl-sw "$" ) @@ -560,18 +541,16 @@ if(APPLE) target_sources(dolphin-emu PRIVATE "${CMAKE_SOURCE_DIR}/Data/Dolphin.icns") set_source_files_properties("${CMAKE_SOURCE_DIR}/Data/Dolphin.icns" PROPERTIES MACOSX_PACKAGE_LOCATION Resources) - # Plugins have to be manually included with Qt 6 - if (QT_VERSION_MAJOR EQUAL 6) - find_package(Qt6QMacStylePlugin REQUIRED PATHS ${Qt6Widgets_DIR}) - find_package(Qt6QCocoaIntegrationPlugin REQUIRED PATHS ${Qt6Gui_DIR}) - endif() + # Manually include plugins + find_package(Qt6QMacStylePlugin REQUIRED PATHS ${Qt6Widgets_DIR}) + find_package(Qt6QCocoaIntegrationPlugin REQUIRED PATHS ${Qt6Gui_DIR}) # Copy Qt plugins into the bundle - get_target_property(qtcocoa_location Qt${QT_VERSION_MAJOR}::QCocoaIntegrationPlugin LOCATION) + get_target_property(qtcocoa_location Qt6::QCocoaIntegrationPlugin LOCATION) target_sources(dolphin-emu PRIVATE "${qtcocoa_location}") set_source_files_properties("${qtcocoa_location}" PROPERTIES MACOSX_PACKAGE_LOCATION MacOS/platforms) - get_target_property(qtmacstyle_location Qt${QT_VERSION_MAJOR}::QMacStylePlugin LOCATION) + get_target_property(qtmacstyle_location Qt6::QMacStylePlugin LOCATION) target_sources(dolphin-emu PRIVATE "${qtmacstyle_location}") set_source_files_properties("${qtmacstyle_location}" PROPERTIES MACOSX_PACKAGE_LOCATION MacOS/styles)