Truly independent web browser
UI/Qt: Share dependency discovery between the UI and tests
Timothy Flynn4b1252cdb8ab
diff --git a/Meta/CMake/check_for_dependencies.cmake b/Meta/CMake/check_for_dependencies.cmakeindex c6d079c3f54..db582e3c31e 100644--- a/Meta/CMake/check_for_dependencies.cmake+++ b/Meta/CMake/check_for_dependencies.cmake@@ -146,3 +146,19 @@ if (WIN32)else()set(HAS_DIRECTX OFF CACHE BOOL "" FORCE)endif()++if (ENABLE_GUI_TARGETS AND NOT (ANDROID OR VCPKG_TARGET_ANDROID))+ set(LADYBIRD_QT_COMPONENTS Core Gui Widgets)+ if (NOT APPLE)+ list(APPEND LADYBIRD_QT_COMPONENTS Positioning)+ endif()++ if (APPLE OR (LINUX AND NOT ANDROID) OR HAS_DIRECTX)+ # The native presentation paths use platform GPU buffer handles directly instead of copying frames through CPU+ # memory. Wayland activation also uses Qt platform APIs.+ list(APPEND LADYBIRD_QT_COMPONENTS GuiPrivate)+ set(QT_NO_PRIVATE_MODULE_WARNING ON)+ endif()++ find_package(Qt6 6.10 REQUIRED COMPONENTS ${LADYBIRD_QT_COMPONENTS})+endif()diff --git a/Tests/UI/Qt/CMakeLists.txt b/Tests/UI/Qt/CMakeLists.txtindex 17bad8d15ae..db733d54365 100644--- a/Tests/UI/Qt/CMakeLists.txt+++ b/Tests/UI/Qt/CMakeLists.txt@@ -1,20 +1,14 @@-find_package(Qt6 QUIET COMPONENTS Core)if (NOT Qt6_FOUND)return()endif()-find_package(Qt6 QUIET COMPONENTS Gui Widgets)-if (Qt6_FOUND)- add_library(QtTestMain OBJECT- QtTestMain.cpp- "${LADYBIRD_SOURCE_DIR}/Libraries/LibTest/AssertionHandler.cpp"- )- target_link_libraries(QtTestMain PRIVATE AK LibCore LibTest Qt::Core Qt::Gui Qt::Widgets)- ladybird_test_suite(UI/Qt NO_TEST CUSTOM_MAIN "$<TARGET_OBJECTS:QtTestMain>")- target_link_libraries(TestUIQt PRIVATE LibCore LibFileSystem LibGfx LibIPC LibURL LibWeb LibWebCommon LibWebView ladybird_impl)-else()- ladybird_test_suite(UI/Qt)-endif()+add_library(QtTestMain OBJECT+ QtTestMain.cpp+ "${LADYBIRD_SOURCE_DIR}/Libraries/LibTest/AssertionHandler.cpp"+)+target_link_libraries(QtTestMain PRIVATE AK LibCore LibTest Qt::Core Qt::Gui Qt::Widgets)+ladybird_test_suite(UI/Qt NO_TEST CUSTOM_MAIN "$<TARGET_OBJECTS:QtTestMain>")+target_link_libraries(TestUIQt PRIVATE LibCore LibFileSystem LibGfx LibIPC LibURL LibWeb LibWebCommon LibWebView ladybird_impl)add_library(QtEventLoopTestMain OBJECTQtEventLoopTestMain.cpp@@ -32,10 +26,6 @@ ladybird_test("TestFullscreenDebounce.cpp" UI/QtLIBS LibThreading ladybird_impl)-if (NOT Qt6_FOUND)- return()-endif()-set(TEST_SOURCESTestBackingStoreRelease.cppTestChromeIcons.cppdiff --git a/UI/Qt/CMakeLists.txt b/UI/Qt/CMakeLists.txtindex 830feaa98dd..76fb4564328 100644--- a/UI/Qt/CMakeLists.txt+++ b/UI/Qt/CMakeLists.txt@@ -2,19 +2,6 @@ set(CMAKE_AUTOMOC ON)set(CMAKE_AUTORCC ON)set(CMAKE_AUTOUIC ON)-find_package(Qt6 6.10 REQUIRED COMPONENTS Core Widgets)--if (NOT APPLE)- find_package(Qt6 6.10 REQUIRED COMPONENTS Positioning)-endif()--if (APPLE OR (LINUX AND NOT ANDROID) OR HAS_DIRECTX)- # The native presentation paths use platform GPU buffer handles directly instead of copying frames through CPU memory.- # Wayland activation also uses Qt platform APIs.- set(QT_NO_PRIVATE_MODULE_WARNING ON)- find_package(Qt6 6.10 REQUIRED COMPONENTS GuiPrivate)-endif()-if (LINUX AND NOT ANDROID)find_package(PkgConfig REQUIRED)pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0 gio-unix-2.0)