From a82b1149803322e76f4fcdb40df6a773bdfa8a58 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 19 Feb 2022 16:20:08 +0400 Subject: [PATCH 001/215] Generate pkg-config file manually for wayland-protocols Meson is unneeded that way --- external/kwayland/CMakeLists.txt | 25 ++++++----------------- external/kwayland/wayland-protocols.pc.in | 5 +++++ 2 files changed, 11 insertions(+), 19 deletions(-) create mode 100644 external/kwayland/wayland-protocols.pc.in diff --git a/external/kwayland/CMakeLists.txt b/external/kwayland/CMakeLists.txt index 2630bc1..2abc96e 100644 --- a/external/kwayland/CMakeLists.txt +++ b/external/kwayland/CMakeLists.txt @@ -38,23 +38,11 @@ ExternalProject_Add(extra-cmake-modules ExternalProject_Get_property(extra-cmake-modules BINARY_DIR) set(extra_cmake_modules_binary_dir ${BINARY_DIR}) -ExternalProject_Add(wayland-protocols - URL ${third_party_loc}/wayland-protocols - CONFIGURE_COMMAND meson - --prefix= - --libdir=lib - --buildtype=release - -Dtests=false - - BUILD_COMMAND meson compile -C - COMMAND meson install -C - STEP_TARGETS build - EXCLUDE_FROM_ALL TRUE - BUILD_BYPRODUCTS /share/pkgconfig/wayland-protocols.pc -) - -ExternalProject_Get_property(wayland-protocols BINARY_DIR) -set(wayland_protocols_binary_dir ${BINARY_DIR}) +set(wayland_protocols_source_dir ${third_party_loc}/wayland-protocols) +file(READ "${wayland_protocols_source_dir}/meson.build" wayland_protocols_meson_build) +string(REGEX MATCH "\n[ \t]*version: '([0-9.]+)'" _ ${wayland_protocols_meson_build}) +set(wayland_protocols_version ${CMAKE_MATCH_1}) +configure_file("wayland-protocols.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/share/pkgconfig/wayland-protocols.pc" @ONLY) ExternalProject_Add(plasma-wayland-protocols URL ${third_party_loc}/plasma-wayland-protocols @@ -85,7 +73,7 @@ ExternalProject_Add(kwayland -DBUILD_TESTING=OFF -DBUILD_WITH_QT6=${DESKTOP_APP_QT6} -DEXCLUDE_DEPRECATED_BEFORE_AND_AT=5.91.0 - -DCMAKE_PREFIX_PATH=${wayland_protocols_binary_dir} + -DCMAKE_PREFIX_PATH=${CMAKE_CURRENT_BINARY_DIR} -DECM_DIR=${extra_cmake_modules_binary_dir}/share/ECM/cmake -DPlasmaWaylandProtocols_DIR=${plasma_wayland_protocols_binary_dir}/lib/cmake/PlasmaWaylandProtocols STEP_TARGETS build @@ -94,7 +82,6 @@ ExternalProject_Add(kwayland ) ExternalProject_Add_StepDependencies(kwayland configure extra-cmake-modules-build) -ExternalProject_Add_StepDependencies(kwayland configure wayland-protocols-build) ExternalProject_Add_StepDependencies(kwayland configure plasma-wayland-protocols-build) ExternalProject_Get_property(kwayland SOURCE_DIR) diff --git a/external/kwayland/wayland-protocols.pc.in b/external/kwayland/wayland-protocols.pc.in new file mode 100644 index 0000000..abb3894 --- /dev/null +++ b/external/kwayland/wayland-protocols.pc.in @@ -0,0 +1,5 @@ +pkgdatadir=@wayland_protocols_source_dir@ + +Name: Wayland Protocols +Description: Wayland protocol files +Version: @wayland_protocols_version@ From ddd1ee547deff4df5ae0100723fc471371440b94 Mon Sep 17 00:00:00 2001 From: Klemens Nanni Date: Sat, 26 Feb 2022 01:56:59 +0100 Subject: [PATCH 002/215] Introduce DESKTOP_APP_DISABLE_JEMALLOC to enable using system malloc On at least OpenBSD, malloc(3) is preferred to other implementations like jemalloc for various reasons. It is common for portable third-party software (ports) to provide a switch for en/disabling jemalloc. tdesktop makes this easy since it does not contain any (je)malloc specific code (anymore). Introduce a new default-off option that disables jemalloc when enabled explicitly; this also allow developers and package maintainers more easily to try different malloc implementations, e.g. for debugging. Memory leaks reported in the slightly old issue "The app consumes an unexpectedly large amount of RAM" https://github.com/telegramdesktop/tdesktop/issues/16084 could not be reproduced on OpenBSD/amd64 with malloc(3) using tdesktop >= 3.3.1. --- CMakeLists.txt | 2 +- external/CMakeLists.txt | 2 +- options_linux.cmake | 10 ++++++++-- variables.cmake | 1 + 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 465f5f7..45db2f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ # https://github.com/desktop-app/legal/blob/master/LEGAL add_subdirectory(external) -if (LINUX) +if (LINUX AND NOT DESKTOP_APP_DISABLE_JEMALLOC) add_subdirectory(linux_jemalloc_helper) endif() if (LINUX AND NOT DESKTOP_APP_USE_PACKAGED) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 0922a66..46b15a4 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -37,7 +37,7 @@ if (add_hunspell_library) add_checked_subdirectory(hunspell) endif() add_checked_subdirectory(iconv) -if (LINUX) +if (LINUX AND NOT DESKTOP_APP_DISABLE_JEMALLOC) add_checked_subdirectory(jemalloc) endif() add_checked_subdirectory(jpeg) diff --git a/options_linux.cmake b/options_linux.cmake index 9312468..5a4c298 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -62,10 +62,16 @@ if (DESKTOP_APP_SPECIAL_TARGET) target_link_options(common_options INTERFACE $,,-g -flto -fuse-linker-plugin>) endif() +if (NOT DESKTOP_APP_DISABLE_JEMALLOC) + target_link_libraries(common_options + INTERFACE + $ + $ + ) +endif() + target_link_libraries(common_options INTERFACE - $ - $ ${CMAKE_DL_LIBS} ) diff --git a/variables.cmake b/variables.cmake index 4d6c9bd..aaafc6a 100644 --- a/variables.cmake +++ b/variables.cmake @@ -31,6 +31,7 @@ option(DESKTOP_APP_DISABLE_AUTOUPDATE "Disable autoupdate." ${disable_autoupdate option(DESKTOP_APP_USE_HUNSPELL_ONLY "Disable system spellchecker and use bundled Hunspell only. (For debugging purposes)" OFF) option(DESKTOP_APP_USE_ENCHANT "Use Enchant instead of bundled Hunspell. (Linux only)" OFF) option(DESKTOP_APP_NO_PDB "Disable PDB file generation. (Windows only)" OFF) +option(DESKTOP_APP_DISABLE_JEMALLOC "Disable jemalloc, use system malloc (Linux only)." OFF) if (DESKTOP_APP_USE_PACKAGED AND DEFINED CMAKE_OSX_ARCHITECTURES) set(DESKTOP_APP_MAC_ARCH "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING "Target macOS arch. (macOS only)") From f05023bb10c69de6395a16f00f9003ee6256e4e4 Mon Sep 17 00:00:00 2001 From: Nicholas Guriev Date: Thu, 30 Dec 2021 11:41:41 +0300 Subject: [PATCH 003/215] Find headers of QR Code Generator of version 1.6.0 as well. --- external/qr_code_generator/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/qr_code_generator/CMakeLists.txt b/external/qr_code_generator/CMakeLists.txt index b75b7ae..f5ca1ef 100644 --- a/external/qr_code_generator/CMakeLists.txt +++ b/external/qr_code_generator/CMakeLists.txt @@ -9,7 +9,7 @@ add_library(desktop-app::external_qr_code_generator ALIAS external_qr_code_gener if (DESKTOP_APP_USE_PACKAGED) find_library(QRCODE_LIBRARIES NAMES qrcodegencpp) - find_path(QRCODE_INCLUDE_DIRS qrcodegen.hpp PATH_SUFFIXES qrcodegencpp qrcodegen) + find_path(QRCODE_INCLUDE_DIRS NAMES qrcodegen.hpp QrCode.hpp PATH_SUFFIXES qrcodegencpp qrcodegen) if (QRCODE_LIBRARIES AND QRCODE_INCLUDE_DIRS) target_include_directories(external_qr_code_generator SYSTEM INTERFACE ${QRCODE_INCLUDE_DIRS}) From aa71b768bd6e958753a5e5ced5203d65cc93a6b1 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sat, 5 Mar 2022 17:02:35 +0400 Subject: [PATCH 004/215] Update Qt to 6.2.3 on macOS and Linux. --- external/qt/package.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/qt/package.cmake b/external/qt/package.cmake index 52933d5..645fd21 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -6,7 +6,7 @@ if (NOT DESKTOP_APP_USE_PACKAGED) if (DESKTOP_APP_QT6) - set(qt_version 6.2.2) + set(qt_version 6.2.3) else() set(qt_version 5.15.2) endif() From 205f90ab9e78990c41029a1fe465ba3b195fab00 Mon Sep 17 00:00:00 2001 From: Klemens Nanni Date: Sun, 6 Mar 2022 22:13:07 +0100 Subject: [PATCH 005/215] Replace deprecated -W with explicit -Wextra `-W` looks odd in build logs, I thought it was a missing warning option... Turns out this has long been superseeded by `-Wexta`, so use that. --- options_linux.cmake | 2 +- options_mac.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/options_linux.cmake b/options_linux.cmake index 5a4c298..de6f7db 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -12,7 +12,7 @@ INTERFACE $,,-fno-strict-aliasing> -pipe -Wall - -W + -Wextra -Wno-unused-parameter -Wno-switch -Wno-missing-field-initializers diff --git a/options_mac.cmake b/options_mac.cmake index c7792c7..8da4ab4 100644 --- a/options_mac.cmake +++ b/options_mac.cmake @@ -22,7 +22,7 @@ target_compile_options(common_options INTERFACE -pipe -Wall - -W + -Wextra -fPIE $<$:-fobjc-weak> -fvisibility-inlines-hidden From 3aa9ec0ed16b6a83bb3af14ba803ab59b512397f Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 8 Mar 2022 22:24:05 +0400 Subject: [PATCH 006/215] Move Qt 5 version to 5.15.3 open source. --- external/qt/package.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/qt/package.cmake b/external/qt/package.cmake index 645fd21..3be118d 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -8,7 +8,7 @@ if (NOT DESKTOP_APP_USE_PACKAGED) if (DESKTOP_APP_QT6) set(qt_version 6.2.3) else() - set(qt_version 5.15.2) + set(qt_version 5.15.3) endif() if (WIN32) From 425a0dc56601b89fbfd1592c5147fef72d3c3ce4 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 9 Mar 2022 21:24:01 +0400 Subject: [PATCH 007/215] libjpeg is a required dependency now --- external/jpeg/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/jpeg/CMakeLists.txt b/external/jpeg/CMakeLists.txt index 5ed56cf..a52635d 100644 --- a/external/jpeg/CMakeLists.txt +++ b/external/jpeg/CMakeLists.txt @@ -8,7 +8,7 @@ add_library(external_jpeg INTERFACE IMPORTED GLOBAL) add_library(desktop-app::external_jpeg ALIAS external_jpeg) if (DESKTOP_APP_USE_PACKAGED) - find_package(JPEG) + find_package(JPEG REQUIRED) target_link_libraries(external_jpeg INTERFACE JPEG::JPEG) elseif (WIN32) target_include_directories(external_jpeg SYSTEM INTERFACE ${libs_loc}/mozjpeg) From 250a405b0750252dc2a7804768ce36f62491d583 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 19 Mar 2022 06:19:28 +0400 Subject: [PATCH 008/215] Add a missing DESKTOP_APP_USE_PACKAGED_LAZY condition --- external/kwayland/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/external/kwayland/CMakeLists.txt b/external/kwayland/CMakeLists.txt index 2abc96e..c97f00b 100644 --- a/external/kwayland/CMakeLists.txt +++ b/external/kwayland/CMakeLists.txt @@ -8,7 +8,11 @@ add_library(external_kwayland INTERFACE IMPORTED GLOBAL) add_library(desktop-app::external_kwayland ALIAS external_kwayland) if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_QT6) - find_package(KF5Wayland) + if (DESKTOP_APP_USE_PACKAGED_LAZY) + find_package(KF5Wayland QUIET) + else() + find_package(KF5Wayland) + endif() if (KF5Wayland_FOUND) target_link_libraries(external_kwayland INTERFACE KF5::WaylandClient) From 77f023b65d161291b43946f67b24bcd63816234c Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 21 Mar 2022 13:08:52 +0400 Subject: [PATCH 009/215] Ensure libjpeg is linked in the right order --- external/jpeg/CMakeLists.txt | 35 ++++++++++++++++++++++++---------- external/qt/CMakeLists.txt | 1 + external/qt/qt6/CMakeLists.txt | 1 + external/webrtc/CMakeLists.txt | 1 + 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/external/jpeg/CMakeLists.txt b/external/jpeg/CMakeLists.txt index a52635d..a76fc87 100644 --- a/external/jpeg/CMakeLists.txt +++ b/external/jpeg/CMakeLists.txt @@ -4,17 +4,32 @@ # For license and copyright information please follow this link: # https://github.com/desktop-app/legal/blob/master/LEGAL -add_library(external_jpeg INTERFACE IMPORTED GLOBAL) -add_library(desktop-app::external_jpeg ALIAS external_jpeg) - if (DESKTOP_APP_USE_PACKAGED) + add_library(external_jpeg INTERFACE IMPORTED GLOBAL) + add_library(desktop-app::external_jpeg ALIAS external_jpeg) + find_package(JPEG REQUIRED) target_link_libraries(external_jpeg INTERFACE JPEG::JPEG) -elseif (WIN32) - target_include_directories(external_jpeg SYSTEM INTERFACE ${libs_loc}/mozjpeg) - target_link_libraries(external_jpeg INTERFACE ${libs_loc}/mozjpeg/$,Debug,Release>/jpeg-static.lib) -elseif (APPLE) - target_link_libraries(external_jpeg INTERFACE ${libs_loc}/local/lib/libjpeg.a) -else() - target_link_static_libraries(external_jpeg INTERFACE jpeg) + return() +endif() + +add_library(external_jpeg STATIC IMPORTED GLOBAL) +add_library(desktop-app::external_jpeg ALIAS external_jpeg) + +elseif (WIN32) + set(jpeg_lib_loc ${libs_loc}/mozjpeg) + target_include_directories(external_jpeg SYSTEM INTERFACE ${jpeg_lib_loc}) + set_target_properties(external_jpeg PROPERTIES + IMPORTED_LOCATION "${jpeg_lib_loc}/Release/jpeg-static.lib" + IMPORTED_LOCATION_DEBUG "${jpeg_lib_loc}/Debug/jpeg-static.lib" + ) +elseif (APPLE) + set_target_properties(external_jpeg PROPERTIES + IMPORTED_LOCATION ${libs_loc}/local/lib/libjpeg.a + ) +else() + find_library(JPEG_LIBRARY libjpeg.a REQUIRED) + set_target_properties(external_jpeg PROPERTIES + IMPORTED_LOCATION "${JPEG_LIBRARY}" + ) endif() diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 5279fad..3bddf48 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -263,6 +263,7 @@ INTERFACE $ $ $ + $ $ $ ) diff --git a/external/qt/qt6/CMakeLists.txt b/external/qt/qt6/CMakeLists.txt index 1ea1c0e..bc36e14 100644 --- a/external/qt/qt6/CMakeLists.txt +++ b/external/qt/qt6/CMakeLists.txt @@ -238,6 +238,7 @@ INTERFACE $ $ $ + $ $ $ ) diff --git a/external/webrtc/CMakeLists.txt b/external/webrtc/CMakeLists.txt index f6ce939..cf474df 100644 --- a/external/webrtc/CMakeLists.txt +++ b/external/webrtc/CMakeLists.txt @@ -89,6 +89,7 @@ INTERFACE ${webrtc_libs_list} $ $ + $ $ $ $ From 171169781056354dd9598869395bda142e8b09c1 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 21 Mar 2022 16:55:41 +0400 Subject: [PATCH 010/215] Fix a syntax error in external_jpeg --- external/jpeg/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/jpeg/CMakeLists.txt b/external/jpeg/CMakeLists.txt index a76fc87..f1d3fa4 100644 --- a/external/jpeg/CMakeLists.txt +++ b/external/jpeg/CMakeLists.txt @@ -16,7 +16,7 @@ endif() add_library(external_jpeg STATIC IMPORTED GLOBAL) add_library(desktop-app::external_jpeg ALIAS external_jpeg) -elseif (WIN32) +if (WIN32) set(jpeg_lib_loc ${libs_loc}/mozjpeg) target_include_directories(external_jpeg SYSTEM INTERFACE ${jpeg_lib_loc}) set_target_properties(external_jpeg PROPERTIES From 9a043ab5ad8436c2a621bba7d1d38ba2b4e2a12e Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 28 Mar 2022 01:26:56 +0400 Subject: [PATCH 011/215] Update Qt version to 6.2.4 on macOS and Linux. --- external/qt/package.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/qt/package.cmake b/external/qt/package.cmake index 3be118d..44e7c6e 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -6,7 +6,7 @@ if (NOT DESKTOP_APP_USE_PACKAGED) if (DESKTOP_APP_QT6) - set(qt_version 6.2.3) + set(qt_version 6.2.4) else() set(qt_version 5.15.3) endif() From b30865ced9cf43cf8974473274d76f65e0a43732 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 11 Apr 2022 01:34:07 +0400 Subject: [PATCH 012/215] Restore original xdg-shell linking --- external/qt/CMakeLists.txt | 1 + external/qt/qt6/CMakeLists.txt | 1 + external/qt/qt_static_plugins/qt_static_plugins.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 3bddf48..439738c 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -224,6 +224,7 @@ else() plugins/platforms/${qt_lib_prefix}qwayland-generic plugins/platforms/${qt_lib_prefix}qwayland-egl plugins/wayland-graphics-integration-client/${qt_lib_prefix}qt-plugin-wayland-egl + plugins/wayland-shell-integration/${qt_lib_prefix}xdg-shell plugins/wayland-decoration-client/${qt_lib_prefix}bradient ) endif() diff --git a/external/qt/qt6/CMakeLists.txt b/external/qt/qt6/CMakeLists.txt index bc36e14..9f84ffb 100644 --- a/external/qt/qt6/CMakeLists.txt +++ b/external/qt/qt6/CMakeLists.txt @@ -201,6 +201,7 @@ else() plugins/platforms/${qt_lib_prefix}qwayland-generic plugins/platforms/${qt_lib_prefix}qwayland-egl plugins/wayland-graphics-integration-client/${qt_lib_prefix}qt-plugin-wayland-egl + plugins/wayland-shell-integration/${qt_lib_prefix}xdg-shell plugins/wayland-decoration-client/${qt_lib_prefix}bradient ) endif() diff --git a/external/qt/qt_static_plugins/qt_static_plugins.cpp b/external/qt/qt_static_plugins/qt_static_plugins.cpp index b420a52..7768185 100644 --- a/external/qt/qt_static_plugins/qt_static_plugins.cpp +++ b/external/qt/qt_static_plugins/qt_static_plugins.cpp @@ -46,6 +46,7 @@ Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin) Q_IMPORT_PLUGIN(QWaylandIntegrationPlugin) Q_IMPORT_PLUGIN(QWaylandEglPlatformIntegrationPlugin) Q_IMPORT_PLUGIN(QWaylandEglClientBufferPlugin) +Q_IMPORT_PLUGIN(QWaylandXdgShellIntegrationPlugin) Q_IMPORT_PLUGIN(QWaylandBradientDecorationPlugin) #endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION Q_IMPORT_PLUGIN(QGtk3ThemePlugin) From ed1411f129fb3c5b819911be083a3b961864eedb Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 12 Apr 2022 18:27:07 +0400 Subject: [PATCH 013/215] Update for Qt 6.3 --- external/qt/package.cmake | 3 ++- external/qt/qt6/CMakeLists.txt | 36 ++++++++++++++++++++++------------ 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/external/qt/package.cmake b/external/qt/package.cmake index 44e7c6e..0730148 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -6,7 +6,7 @@ if (NOT DESKTOP_APP_USE_PACKAGED) if (DESKTOP_APP_QT6) - set(qt_version 6.2.4) + set(qt_version 6.3.0) else() set(qt_version 5.15.3) endif() @@ -32,6 +32,7 @@ if (LINUX) if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) if (DESKTOP_APP_QT6) find_package(Qt6 COMPONENTS WaylandClient REQUIRED) + find_package(Qt6 OPTIONAL_COMPONENTS WaylandGlobalPrivate QUIET) else() find_package(Qt5 COMPONENTS WaylandClient REQUIRED) find_package(Qt5 OPTIONAL_COMPONENTS XkbCommonSupport QUIET) diff --git a/external/qt/qt6/CMakeLists.txt b/external/qt/qt6/CMakeLists.txt index 9f84ffb..9189c5c 100644 --- a/external/qt/qt6/CMakeLists.txt +++ b/external/qt/qt6/CMakeLists.txt @@ -11,8 +11,10 @@ if (DESKTOP_APP_USE_PACKAGED) target_link_libraries(external_qt INTERFACE Qt6::Core + Qt6::CorePrivate Qt6::Core5Compat Qt6::Gui + Qt6::GuiPrivate Qt6::OpenGL Qt6::Widgets Qt6::OpenGLWidgets @@ -20,23 +22,26 @@ if (DESKTOP_APP_USE_PACKAGED) Qt6::Svg ) - target_include_directories(external_qt SYSTEM - INTERFACE - ${Qt6Core_PRIVATE_INCLUDE_DIRS} - ${Qt6Gui_PRIVATE_INCLUDE_DIRS} - ) - if (Qt6DBus_FOUND) - target_link_libraries(external_qt INTERFACE Qt6::DBus) + target_link_libraries(external_qt + INTERFACE + Qt6::DBus + ) endif() if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) - target_link_libraries(external_qt INTERFACE Qt6::WaylandClient) - - target_include_directories(external_qt SYSTEM + target_link_libraries(external_qt INTERFACE - ${Qt6WaylandClient_PRIVATE_INCLUDE_DIRS} + Qt6::WaylandClient + Qt6::WaylandClientPrivate ) + + if (Qt6WaylandGlobalPrivate_FOUND) + target_link_libraries(external_qt + INTERFACE + Qt6::WaylandGlobalPrivate + ) + endif() endif() return() @@ -69,8 +74,11 @@ if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) target_include_directories(external_qt SYSTEM INTERFACE ${qt_loc}/include/QtWaylandClient + ${qt_loc}/include/QtWaylandGlobal ${qt_loc}/include/QtWaylandClient/${qt_version} + ${qt_loc}/include/QtWaylandGlobal/${qt_version} ${qt_loc}/include/QtWaylandClient/${qt_version}/QtWaylandClient + ${qt_loc}/include/QtWaylandGlobal/${qt_version}/QtWaylandGlobal ) endif() @@ -100,6 +108,7 @@ if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) target_compile_definitions(external_qt INTERFACE QT_WAYLANDCLIENT_LIB + QT_WAYLANDGLOBAL_LIB ) endif() @@ -252,7 +261,6 @@ if (LINUX) target_link_static_libraries(external_qt INTERFACE proxy - epoxy xkbcommon xkbcommon-x11 xcb-glx @@ -263,7 +271,6 @@ if (LINUX) xcb-render xcb-image xcb-xfixes - xcb-xinput xcb-shape xcb-sync xcb-util @@ -281,8 +288,11 @@ if (LINUX) desktop-app::linux_xcb_helper fontconfig freetype + EGL + GL xcb X11 X11-xcb + glib-2.0 ) endif() From 8ca7ff848477ccd8687a5ed0fe3dabf1070f7726 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 17 Apr 2022 07:29:07 +0400 Subject: [PATCH 014/215] Don't require breakpad/ffmpeg build directories on Linux --- .../crash_reports/breakpad/CMakeLists.txt | 17 ++++++--- external/ffmpeg/CMakeLists.txt | 36 +++++++++++++------ 2 files changed, 39 insertions(+), 14 deletions(-) diff --git a/external/crash_reports/breakpad/CMakeLists.txt b/external/crash_reports/breakpad/CMakeLists.txt index d57a17e..1a36e06 100644 --- a/external/crash_reports/breakpad/CMakeLists.txt +++ b/external/crash_reports/breakpad/CMakeLists.txt @@ -7,10 +7,19 @@ add_library(external_breakpad INTERFACE IMPORTED GLOBAL) add_library(desktop-app::external_breakpad ALIAS external_breakpad) -target_include_directories(external_breakpad SYSTEM -INTERFACE - ${libs_loc}/breakpad/src -) +if (LINUX) + find_package(PkgConfig REQUIRED) + pkg_check_modules(BREAKPAD REQUIRED breakpad) + target_include_directories(external_breakpad SYSTEM + INTERFACE + ${BREAKPAD_INCLUDE_DIRS} + ) +else() + target_include_directories(external_breakpad SYSTEM + INTERFACE + ${libs_loc}/breakpad/src + ) +endif() if (build_win64) set(breakpad_config_add _x64) diff --git a/external/ffmpeg/CMakeLists.txt b/external/ffmpeg/CMakeLists.txt index 39f0a36..a83053f 100644 --- a/external/ffmpeg/CMakeLists.txt +++ b/external/ffmpeg/CMakeLists.txt @@ -25,25 +25,41 @@ if (DESKTOP_APP_USE_PACKAGED) PkgConfig::SWRESAMPLE ) else() - target_include_directories(external_ffmpeg SYSTEM - INTERFACE - ${libs_loc}/ffmpeg - ) + if (LINUX) + target_link_static_libraries(external_ffmpeg + INTERFACE + avformat + avcodec + swresample + swscale + avutil + ) + else() + set(ffmpeg_lib_loc ${libs_loc}/ffmpeg) - set(ffmpeg_lib_loc ${libs_loc}/ffmpeg) + target_include_directories(external_ffmpeg SYSTEM + INTERFACE + ${ffmpeg_lib_loc} + ) + + target_link_libraries(external_ffmpeg + INTERFACE + ${ffmpeg_lib_loc}/libavformat/libavformat.a + ${ffmpeg_lib_loc}/libavcodec/libavcodec.a + ${ffmpeg_lib_loc}/libswresample/libswresample.a + ${ffmpeg_lib_loc}/libswscale/libswscale.a + ${ffmpeg_lib_loc}/libavutil/libavutil.a + ) + endif() target_link_libraries(external_ffmpeg INTERFACE - ${ffmpeg_lib_loc}/libavformat/libavformat.a - ${ffmpeg_lib_loc}/libavcodec/libavcodec.a - ${ffmpeg_lib_loc}/libswresample/libswresample.a - ${ffmpeg_lib_loc}/libswscale/libswscale.a - ${ffmpeg_lib_loc}/libavutil/libavutil.a $ $ $ $ ) + if (APPLE) target_link_libraries(external_ffmpeg INTERFACE bz2) elseif (LINUX) From 941f8fcc4e5ab7cebb15caa84f183b6c2a022629 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 18 Apr 2022 21:10:14 +0400 Subject: [PATCH 015/215] Link Qt 6 resources without hardcoding the build type --- external/qt/qt6/CMakeLists.txt | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/external/qt/qt6/CMakeLists.txt b/external/qt/qt6/CMakeLists.txt index 9189c5c..f5254b0 100644 --- a/external/qt/qt6/CMakeLists.txt +++ b/external/qt/qt6/CMakeLists.txt @@ -124,12 +124,6 @@ else() endif() endif() -if (LINUX) - set(qt_lib_objects objects-RelWithDebInfo) -else() - set(qt_lib_objects objects-$,Debug,RelWithDebInfo>) -endif() - set(common_qt_libs plugins/imageformats/${qt_lib_prefix}qwebp plugins/imageformats/${qt_lib_prefix}qgif @@ -185,7 +179,7 @@ elseif (APPLE) list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}") endforeach() list(APPEND qt_libs_list - "${qt_loc}/lib/${qt_lib_objects}/QCocoaIntegrationPlugin_resources_1/.rcc/qrc_qcocoaresources.cpp.o" + $ ) else() set(qt_libs_dbus) @@ -235,10 +229,10 @@ else() endif() list(APPEND qt_libs_list - "${qt_loc}/lib/${qt_lib_objects}/Gui_resources_1/.rcc/qrc_qpdf.cpp.o" - "${qt_loc}/lib/${qt_lib_objects}/Widgets_resources_1/.rcc/qrc_qstyle.cpp.o" - "${qt_loc}/lib/${qt_lib_objects}/Widgets_resources_2/.rcc/qrc_qstyle1.cpp.o" - "${qt_loc}/lib/${qt_lib_objects}/Widgets_resources_3/.rcc/qrc_qmessagebox.cpp.o" + $ + $ + $ + $ ) target_link_libraries(external_qt From b8b517a5e02d6c878614c0c5f083eb46849d616e Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 19 Apr 2022 09:02:21 +0400 Subject: [PATCH 016/215] Check debug tg_owt library exists before using --- external/webrtc/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/external/webrtc/CMakeLists.txt b/external/webrtc/CMakeLists.txt index cf474df..36c96aa 100644 --- a/external/webrtc/CMakeLists.txt +++ b/external/webrtc/CMakeLists.txt @@ -62,6 +62,10 @@ else() ) endif() +if (NOT EXISTS ${libs_loc}/tg_owt/out/Debug/${webrtc_lib_prefix}tg_owt${webrtc_lib_suffix}) + set(webrtc_build_loc ${libs_loc}/tg_owt/out/Release) +endif() + target_include_directories(external_webrtc SYSTEM INTERFACE ${webrtc_loc} From 2e1d9c80d9ddc2807d6ef01abdcd4bf6b2083fa6 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 19 Apr 2022 15:54:00 +0400 Subject: [PATCH 017/215] Workaround cmake's random library order in external_ffmpeg --- external/ffmpeg/CMakeLists.txt | 91 ++++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 36 deletions(-) diff --git a/external/ffmpeg/CMakeLists.txt b/external/ffmpeg/CMakeLists.txt index a83053f..5b17ff7 100644 --- a/external/ffmpeg/CMakeLists.txt +++ b/external/ffmpeg/CMakeLists.txt @@ -24,45 +24,64 @@ if (DESKTOP_APP_USE_PACKAGED) PkgConfig::SWSCALE PkgConfig::SWRESAMPLE ) + + return() +endif() + +set(ffmpeg_lib_list) + +if (LINUX) + list(APPEND ffmpeg_lib_list + -lavformat + -lavcodec + -lswresample + -lswscale + -lavutil + ) else() - if (LINUX) - target_link_static_libraries(external_ffmpeg - INTERFACE - avformat - avcodec - swresample - swscale - avutil - ) - else() - set(ffmpeg_lib_loc ${libs_loc}/ffmpeg) + set(ffmpeg_lib_loc ${libs_loc}/ffmpeg) - target_include_directories(external_ffmpeg SYSTEM - INTERFACE - ${ffmpeg_lib_loc} - ) - - target_link_libraries(external_ffmpeg - INTERFACE - ${ffmpeg_lib_loc}/libavformat/libavformat.a - ${ffmpeg_lib_loc}/libavcodec/libavcodec.a - ${ffmpeg_lib_loc}/libswresample/libswresample.a - ${ffmpeg_lib_loc}/libswscale/libswscale.a - ${ffmpeg_lib_loc}/libavutil/libavutil.a - ) - endif() - - target_link_libraries(external_ffmpeg + target_include_directories(external_ffmpeg SYSTEM INTERFACE - $ - $ - $ - $ + ${ffmpeg_lib_loc} ) - if (APPLE) - target_link_libraries(external_ffmpeg INTERFACE bz2) - elseif (LINUX) - target_link_static_libraries(external_ffmpeg INTERFACE lzma) - endif() + list(APPEND ffmpeg_lib_list + ${ffmpeg_lib_loc}/libavformat/libavformat.a + ${ffmpeg_lib_loc}/libavcodec/libavcodec.a + ${ffmpeg_lib_loc}/libswresample/libswresample.a + ${ffmpeg_lib_loc}/libswscale/libswscale.a + ${ffmpeg_lib_loc}/libavutil/libavutil.a + ) endif() + +list(APPEND ffmpeg_lib_list + $ + $ +) + +if (APPLE) + list(APPEND ffmpeg_lib_list bz2) +elseif (LINUX) + list(APPEND ffmpeg_lib_list -llzma) +endif() + +# Workaround cmake's random order on Linux... +if (LINUX) + list(JOIN ffmpeg_lib_list , ffmpeg_lib_link) + target_link_libraries(external_ffmpeg + INTERFACE + -Wl,--push-state,-Bstatic,${ffmpeg_lib_link},--pop-state + ) +else() + target_link_libraries(external_ffmpeg + INTERFACE + ${ffmpeg_lib_list} + ) +endif() + +target_link_libraries(external_ffmpeg +INTERFACE + $ + $ +) From 87d46d81111d9ebfff560e1be3d52306c7475fe7 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 19 Apr 2022 16:56:35 +0400 Subject: [PATCH 018/215] Update WebView2 package version. --- nuget.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuget.cmake b/nuget.cmake index 7aba5c9..f6df582 100644 --- a/nuget.cmake +++ b/nuget.cmake @@ -45,7 +45,7 @@ function(nuget_add_package package_name package package_version) endfunction() function(nuget_add_webview target_name) - nuget_add_package(webview2 "Microsoft.Web.WebView2" 1.0.864.35) + nuget_add_package(webview2 "Microsoft.Web.WebView2" 1.0.1185.39) set(webview2_loc_native ${webview2_loc}/build/native) # target_link_libraries(${target_name} From 26d31dbdef488f9a29b58a8823de3b457829cba2 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 26 Apr 2022 02:41:13 +0400 Subject: [PATCH 019/215] Move -fstack-clash-protection to GCC-only flags --- options_linux.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options_linux.cmake b/options_linux.cmake index de6f7db..b46a98a 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -7,7 +7,6 @@ target_compile_options(common_options INTERFACE -fstack-protector-all - -fstack-clash-protection -fPIC $,,-fno-strict-aliasing> -pipe @@ -34,6 +33,7 @@ INTERFACE if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") target_compile_options(common_options INTERFACE + -fstack-clash-protection -Wno-maybe-uninitialized ) endif() From b4fff0175709d20041ddf60db4bf57335bc99af1 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 3 May 2022 19:11:07 +0400 Subject: [PATCH 020/215] Fix build with WebRTC M101. --- external/webrtc/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/external/webrtc/CMakeLists.txt b/external/webrtc/CMakeLists.txt index 36c96aa..26d1103 100644 --- a/external/webrtc/CMakeLists.txt +++ b/external/webrtc/CMakeLists.txt @@ -26,7 +26,8 @@ INTERFACE WEBRTC_USE_BUILTIN_ISAC_FLOAT WEBRTC_LIBRARY_IMPL WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=1 - WEBRTC_HAVE_USRSCTP + WEBRTC_HAVE_DCSCTP + WEBRTC_HAVE_SCTP ABSL_ALLOCATOR_NOTHROW=1 ) From 1be19c32defe95d083d035f9ea9622d74fe3bb65 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 31 May 2022 01:07:22 +0400 Subject: [PATCH 021/215] Get xdgdesktopportal back --- external/qt/CMakeLists.txt | 1 + external/qt/qt6/CMakeLists.txt | 1 + external/qt/qt_static_plugins/qt_static_plugins.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 439738c..c5ec893 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -210,6 +210,7 @@ else() set(qt_libs_dbus_support lib/${qt_lib_prefix}Qt5LinuxAccessibilitySupport) set(qt_libs_dbus_plugins plugins/platforminputcontexts/${qt_lib_prefix}ibusplatforminputcontextplugin + plugins/platformthemes/${qt_lib_prefix}qxdgdesktopportal ) set(qt_libs_dbus_bearers plugins/bearer/${qt_lib_prefix}qconnmanbearer diff --git a/external/qt/qt6/CMakeLists.txt b/external/qt/qt6/CMakeLists.txt index f5254b0..55dfc59 100644 --- a/external/qt/qt6/CMakeLists.txt +++ b/external/qt/qt6/CMakeLists.txt @@ -191,6 +191,7 @@ else() ) set(qt_libs_dbus_plugins plugins/platforminputcontexts/${qt_lib_prefix}ibusplatforminputcontextplugin + plugins/platformthemes/${qt_lib_prefix}qxdgdesktopportal ) endif() set(qt_libs_waylandclient) diff --git a/external/qt/qt_static_plugins/qt_static_plugins.cpp b/external/qt/qt_static_plugins/qt_static_plugins.cpp index 7768185..ae0babe 100644 --- a/external/qt/qt_static_plugins/qt_static_plugins.cpp +++ b/external/qt/qt_static_plugins/qt_static_plugins.cpp @@ -41,6 +41,7 @@ Q_IMPORT_PLUGIN(QConnmanEnginePlugin) Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin) #endif // Qt < 6.0.0 Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin) +Q_IMPORT_PLUGIN(QXdgDesktopPortalThemePlugin) #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION Q_IMPORT_PLUGIN(QWaylandIntegrationPlugin) From d53b2db48ed8f1790f8e547df8d63aa258659930 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 3 Jun 2022 19:57:23 +0400 Subject: [PATCH 022/215] Migrate from kwayland to QtWaylandScanner --- external/CMakeLists.txt | 6 +- external/kwayland/CMakeLists.txt | 125 ---------------------- external/kwayland/wayland-protocols.pc.in | 5 - external/wayland_client/CMakeLists.txt | 16 +++ 4 files changed, 19 insertions(+), 133 deletions(-) delete mode 100644 external/kwayland/CMakeLists.txt delete mode 100644 external/kwayland/wayland-protocols.pc.in create mode 100644 external/wayland_client/CMakeLists.txt diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 46b15a4..d27d914 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -41,9 +41,6 @@ if (LINUX AND NOT DESKTOP_APP_DISABLE_JEMALLOC) add_checked_subdirectory(jemalloc) endif() add_checked_subdirectory(jpeg) -if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) - add_checked_subdirectory(kwayland) -endif() add_checked_subdirectory(lz4) add_checked_subdirectory(minizip) if (LINUX) @@ -60,6 +57,9 @@ add_checked_subdirectory(rnnoise) add_checked_subdirectory(ton) add_checked_subdirectory(variant) add_checked_subdirectory(vpx) +if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) + add_checked_subdirectory(wayland_client) +endif() add_checked_subdirectory(webrtc) if (LINUX AND NOT DESKTOP_APP_DISABLE_X11_INTEGRATION) add_checked_subdirectory(xcb) diff --git a/external/kwayland/CMakeLists.txt b/external/kwayland/CMakeLists.txt deleted file mode 100644 index c97f00b..0000000 --- a/external/kwayland/CMakeLists.txt +++ /dev/null @@ -1,125 +0,0 @@ -# This file is part of Desktop App Toolkit, -# a set of libraries for developing nice desktop applications. -# -# For license and copyright information please follow this link: -# https://github.com/desktop-app/legal/blob/master/LEGAL - -add_library(external_kwayland INTERFACE IMPORTED GLOBAL) -add_library(desktop-app::external_kwayland ALIAS external_kwayland) - -if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_QT6) - if (DESKTOP_APP_USE_PACKAGED_LAZY) - find_package(KF5Wayland QUIET) - else() - find_package(KF5Wayland) - endif() - - if (KF5Wayland_FOUND) - target_link_libraries(external_kwayland INTERFACE KF5::WaylandClient) - return() - endif() -endif() - -add_library(external_kwayland_bundled STATIC IMPORTED) - -include(ExternalProject) - -ExternalProject_Add(extra-cmake-modules - URL ${third_party_loc}/extra-cmake-modules - CMAKE_GENERATOR Ninja - CMAKE_ARGS - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_INSTALL_PREFIX= - -DCMAKE_INSTALL_DATADIR=share - -DBUILD_TESTING=OFF - BUILD_COMMAND ${CMAKE_COMMAND} --build - COMMAND ${CMAKE_COMMAND} --install - STEP_TARGETS build - EXCLUDE_FROM_ALL TRUE - BUILD_BYPRODUCTS /share/ECM/cmake/ECMConfig.cmake -) - -ExternalProject_Get_property(extra-cmake-modules BINARY_DIR) -set(extra_cmake_modules_binary_dir ${BINARY_DIR}) - -set(wayland_protocols_source_dir ${third_party_loc}/wayland-protocols) -file(READ "${wayland_protocols_source_dir}/meson.build" wayland_protocols_meson_build) -string(REGEX MATCH "\n[ \t]*version: '([0-9.]+)'" _ ${wayland_protocols_meson_build}) -set(wayland_protocols_version ${CMAKE_MATCH_1}) -configure_file("wayland-protocols.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/share/pkgconfig/wayland-protocols.pc" @ONLY) - -ExternalProject_Add(plasma-wayland-protocols - URL ${third_party_loc}/plasma-wayland-protocols - CMAKE_GENERATOR Ninja - CMAKE_ARGS - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_INSTALL_PREFIX= - -DCMAKE_INSTALL_LIBDIR=lib - -DECM_DIR=${extra_cmake_modules_binary_dir}/share/ECM/cmake - BUILD_COMMAND ${CMAKE_COMMAND} --build - COMMAND ${CMAKE_COMMAND} --install - STEP_TARGETS build - EXCLUDE_FROM_ALL TRUE - BUILD_BYPRODUCTS /lib/cmake/PlasmaWaylandProtocols/PlasmaWaylandProtocolsConfig.cmake -) - -ExternalProject_Add_StepDependencies(plasma-wayland-protocols configure extra-cmake-modules-build) - -ExternalProject_Get_property(plasma-wayland-protocols BINARY_DIR) -set(plasma_wayland_protocols_binary_dir ${BINARY_DIR}) - -ExternalProject_Add(kwayland - URL ${third_party_loc}/kwayland - CMAKE_GENERATOR Ninja - CMAKE_ARGS - -DCMAKE_BUILD_TYPE=Release - -DBUILD_SHARED_LIBS=OFF - -DBUILD_TESTING=OFF - -DBUILD_WITH_QT6=${DESKTOP_APP_QT6} - -DEXCLUDE_DEPRECATED_BEFORE_AND_AT=5.91.0 - -DCMAKE_PREFIX_PATH=${CMAKE_CURRENT_BINARY_DIR} - -DECM_DIR=${extra_cmake_modules_binary_dir}/share/ECM/cmake - -DPlasmaWaylandProtocols_DIR=${plasma_wayland_protocols_binary_dir}/lib/cmake/PlasmaWaylandProtocols - STEP_TARGETS build - EXCLUDE_FROM_ALL TRUE - BUILD_BYPRODUCTS /lib/libKF5WaylandClient.a -) - -ExternalProject_Add_StepDependencies(kwayland configure extra-cmake-modules-build) -ExternalProject_Add_StepDependencies(kwayland configure plasma-wayland-protocols-build) - -ExternalProject_Get_property(kwayland SOURCE_DIR) -ExternalProject_Get_property(kwayland BINARY_DIR) - -file(MAKE_DIRECTORY "${SOURCE_DIR}/src/client") -file(MAKE_DIRECTORY "${BINARY_DIR}/src/client") - -set_target_properties(external_kwayland_bundled PROPERTIES - IMPORTED_LOCATION "${BINARY_DIR}/lib/libKF5WaylandClient.a" -) - -target_include_directories(external_kwayland_bundled SYSTEM -INTERFACE - ${SOURCE_DIR}/src/client - ${BINARY_DIR}/src/client -) - -target_link_libraries(external_kwayland_bundled -INTERFACE - desktop-app::external_qt -) - -if (DESKTOP_APP_USE_PACKAGED) - find_package(PkgConfig REQUIRED) - pkg_check_modules(WAYLAND_CLIENT REQUIRED IMPORTED_TARGET wayland-client) - target_link_libraries(external_kwayland_bundled INTERFACE PkgConfig::WAYLAND_CLIENT) -else() - target_link_libraries(external_kwayland_bundled INTERFACE desktop-app::linux_wayland_helper) -endif() - -add_dependencies(external_kwayland_bundled kwayland-build) - -target_link_libraries(external_kwayland -INTERFACE - external_kwayland_bundled -) diff --git a/external/kwayland/wayland-protocols.pc.in b/external/kwayland/wayland-protocols.pc.in deleted file mode 100644 index abb3894..0000000 --- a/external/kwayland/wayland-protocols.pc.in +++ /dev/null @@ -1,5 +0,0 @@ -pkgdatadir=@wayland_protocols_source_dir@ - -Name: Wayland Protocols -Description: Wayland protocol files -Version: @wayland_protocols_version@ diff --git a/external/wayland_client/CMakeLists.txt b/external/wayland_client/CMakeLists.txt new file mode 100644 index 0000000..c90082c --- /dev/null +++ b/external/wayland_client/CMakeLists.txt @@ -0,0 +1,16 @@ +# This file is part of Desktop App Toolkit, +# a set of libraries for developing nice desktop applications. +# +# For license and copyright information please follow this link: +# https://github.com/desktop-app/legal/blob/master/LEGAL + +add_library(external_wayland_client INTERFACE IMPORTED GLOBAL) +add_library(desktop-app::external_wayland_client ALIAS external_wayland_client) + +if (DESKTOP_APP_USE_PACKAGED) + find_package(PkgConfig REQUIRED) + pkg_check_modules(WAYLAND_CLIENT REQUIRED IMPORTED_TARGET wayland-client) + target_link_libraries(external_wayland_client PRIVATE PkgConfig::WAYLAND_CLIENT) +else() + target_link_libraries(external_wayland_client INTERFACE wayland-client) +endif() From 34a8698fcc07658e65ae2d23d2661f1610379c1b Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 3 Jun 2022 19:59:15 +0400 Subject: [PATCH 023/215] Revert "Use QtWidgets private include directories with Qt 5" This reverts commit f552ccb6e57c03cb06cfe1550fa45b17e0c519fc. --- external/qt/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index c5ec893..72071fc 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -27,7 +27,6 @@ if (DESKTOP_APP_USE_PACKAGED) INTERFACE ${Qt5Core_PRIVATE_INCLUDE_DIRS} ${Qt5Gui_PRIVATE_INCLUDE_DIRS} - ${Qt5Widgets_PRIVATE_INCLUDE_DIRS} ) if (Qt5DBus_FOUND) From 320fa8f2f83ac9a9c4ca0434311d80f2f114e24f Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 7 Jun 2022 00:52:51 +0400 Subject: [PATCH 024/215] Ensure wayland-client is not linked in non-packaged mode --- external/wayland_client/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/wayland_client/CMakeLists.txt b/external/wayland_client/CMakeLists.txt index c90082c..6dfb8fa 100644 --- a/external/wayland_client/CMakeLists.txt +++ b/external/wayland_client/CMakeLists.txt @@ -12,5 +12,5 @@ if (DESKTOP_APP_USE_PACKAGED) pkg_check_modules(WAYLAND_CLIENT REQUIRED IMPORTED_TARGET wayland-client) target_link_libraries(external_wayland_client PRIVATE PkgConfig::WAYLAND_CLIENT) else() - target_link_libraries(external_wayland_client INTERFACE wayland-client) + target_link_libraries(external_wayland_client INTERFACE desktop-app::linux_wayland_helper) endif() From 1263bf734acbb8e2e42c80717bae891e050c28ed Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 14 Jun 2022 18:04:50 +0400 Subject: [PATCH 025/215] Update Qt to 5.15.4 and 6.3.1. --- external/qt/package.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/external/qt/package.cmake b/external/qt/package.cmake index 0730148..88bb825 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -6,9 +6,9 @@ if (NOT DESKTOP_APP_USE_PACKAGED) if (DESKTOP_APP_QT6) - set(qt_version 6.3.0) + set(qt_version 6.3.1) else() - set(qt_version 5.15.3) + set(qt_version 5.15.4) endif() if (WIN32) From 06237779c2764ed926bb1160644b599f66e6e5a0 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 15 Jun 2022 07:43:37 +0400 Subject: [PATCH 026/215] Fix desktop-app::external_wayland_client in packaged mode --- external/wayland_client/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/wayland_client/CMakeLists.txt b/external/wayland_client/CMakeLists.txt index 6dfb8fa..cda9899 100644 --- a/external/wayland_client/CMakeLists.txt +++ b/external/wayland_client/CMakeLists.txt @@ -10,7 +10,7 @@ add_library(desktop-app::external_wayland_client ALIAS external_wayland_client) if (DESKTOP_APP_USE_PACKAGED) find_package(PkgConfig REQUIRED) pkg_check_modules(WAYLAND_CLIENT REQUIRED IMPORTED_TARGET wayland-client) - target_link_libraries(external_wayland_client PRIVATE PkgConfig::WAYLAND_CLIENT) + target_link_libraries(external_wayland_client INTERFACE PkgConfig::WAYLAND_CLIENT) else() target_link_libraries(external_wayland_client INTERFACE desktop-app::linux_wayland_helper) endif() From d8442d4d968f55e8804fea3cc2d2d84f60595982 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 20 Jun 2022 23:56:53 +0400 Subject: [PATCH 027/215] Automatically disable Wayland integration with Qt 5 --- variables.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/variables.cmake b/variables.cmake index aaafc6a..0f4f412 100644 --- a/variables.cmake +++ b/variables.cmake @@ -39,6 +39,11 @@ else() set(DESKTOP_APP_MAC_ARCH "x86_64;arm64" CACHE STRING "Target macOS arch. (macOS only)") endif() +# QtWaylandScanner cmake integration from Qt 6 is used +if (NOT DESKTOP_APP_QT6) + set(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION ON) +endif() + set(add_hunspell_library 0) if ((WIN32 OR (LINUX AND NOT DESKTOP_APP_USE_ENCHANT) From 3eb316573477930e92036c2ffae221f32e55ab67 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 4 Aug 2022 07:12:34 +0400 Subject: [PATCH 028/215] Rework Qt 5 private modules linking --- external/qt/CMakeLists.txt | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 72071fc..dece79f 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -17,37 +17,34 @@ if (DESKTOP_APP_USE_PACKAGED) target_link_libraries(external_qt INTERFACE Qt5::Core + Qt5::CorePrivate Qt5::Gui + Qt5::GuiPrivate Qt5::Widgets Qt5::Network Qt5::Svg ) - target_include_directories(external_qt SYSTEM - INTERFACE - ${Qt5Core_PRIVATE_INCLUDE_DIRS} - ${Qt5Gui_PRIVATE_INCLUDE_DIRS} - ) - if (Qt5DBus_FOUND) - target_link_libraries(external_qt INTERFACE Qt5::DBus) + target_link_libraries(external_qt + INTERFACE + Qt5::DBus + ) endif() if (Qt5XkbCommonSupport_FOUND) - target_link_libraries(external_qt INTERFACE Qt5::XkbCommonSupport) - - target_include_directories(external_qt SYSTEM + target_link_libraries(external_qt INTERFACE - ${Qt5XkbCommonSupport_PRIVATE_INCLUDE_DIRS} + Qt5::XkbCommonSupport + Qt5::XkbCommonSupportPrivate ) endif() if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) - target_link_libraries(external_qt INTERFACE Qt5::WaylandClient) - - target_include_directories(external_qt SYSTEM + target_link_libraries(external_qt INTERFACE - ${Qt5WaylandClient_PRIVATE_INCLUDE_DIRS} + Qt5::WaylandClient + Qt5::WaylandClientPrivate ) endif() From 00c2360aca08068fe9d23771fa4900b29b7e8ef1 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 4 Aug 2022 07:13:10 +0400 Subject: [PATCH 029/215] Use QtWidgets private headers --- external/qt/CMakeLists.txt | 3 +++ external/qt/qt6/CMakeLists.txt | 3 +++ 2 files changed, 6 insertions(+) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index dece79f..97e7bdb 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -21,6 +21,7 @@ if (DESKTOP_APP_USE_PACKAGED) Qt5::Gui Qt5::GuiPrivate Qt5::Widgets + Qt5::WidgetsPrivate Qt5::Network Qt5::Svg ) @@ -60,8 +61,10 @@ INTERFACE ${qt_loc}/include/QtSvg ${qt_loc}/include/QtCore/${qt_version} ${qt_loc}/include/QtGui/${qt_version} + ${qt_loc}/include/QtWidgets/${qt_version} ${qt_loc}/include/QtCore/${qt_version}/QtCore ${qt_loc}/include/QtGui/${qt_version}/QtGui + ${qt_loc}/include/QtWidgets/${qt_version}/QtWidgets ) if (Qt5DBus_FOUND) diff --git a/external/qt/qt6/CMakeLists.txt b/external/qt/qt6/CMakeLists.txt index 55dfc59..ebfd669 100644 --- a/external/qt/qt6/CMakeLists.txt +++ b/external/qt/qt6/CMakeLists.txt @@ -17,6 +17,7 @@ if (DESKTOP_APP_USE_PACKAGED) Qt6::GuiPrivate Qt6::OpenGL Qt6::Widgets + Qt6::WidgetsPrivate Qt6::OpenGLWidgets Qt6::Network Qt6::Svg @@ -59,8 +60,10 @@ INTERFACE ${qt_loc}/include/QtSvg ${qt_loc}/include/QtCore/${qt_version} ${qt_loc}/include/QtGui/${qt_version} + ${qt_loc}/include/QtWidgets/${qt_version} ${qt_loc}/include/QtCore/${qt_version}/QtCore ${qt_loc}/include/QtGui/${qt_version}/QtGui + ${qt_loc}/include/QtWidgets/${qt_version}/QtWidgets ) if (Qt6DBus_FOUND) From 3e6a8fc1924bea4d886867515b56003c88287867 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 4 Aug 2022 07:21:01 +0400 Subject: [PATCH 030/215] Use QtWaylandEglClientHwIntegrationPrivate module --- external/qt/package.cmake | 2 +- external/qt/qt6/CMakeLists.txt | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/external/qt/package.cmake b/external/qt/package.cmake index 88bb825..780a876 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -31,7 +31,7 @@ endif() if (LINUX) if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) if (DESKTOP_APP_QT6) - find_package(Qt6 COMPONENTS WaylandClient REQUIRED) + find_package(Qt6 COMPONENTS WaylandClient WaylandEglClientHwIntegrationPrivate REQUIRED) find_package(Qt6 OPTIONAL_COMPONENTS WaylandGlobalPrivate QUIET) else() find_package(Qt5 COMPONENTS WaylandClient REQUIRED) diff --git a/external/qt/qt6/CMakeLists.txt b/external/qt/qt6/CMakeLists.txt index ebfd669..e5fc246 100644 --- a/external/qt/qt6/CMakeLists.txt +++ b/external/qt/qt6/CMakeLists.txt @@ -35,6 +35,7 @@ if (DESKTOP_APP_USE_PACKAGED) INTERFACE Qt6::WaylandClient Qt6::WaylandClientPrivate + Qt6::WaylandEglClientHwIntegrationPrivate ) if (Qt6WaylandGlobalPrivate_FOUND) @@ -78,10 +79,13 @@ if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) INTERFACE ${qt_loc}/include/QtWaylandClient ${qt_loc}/include/QtWaylandGlobal + ${qt_loc}/include/QtWaylandEglClientHwIntegration ${qt_loc}/include/QtWaylandClient/${qt_version} ${qt_loc}/include/QtWaylandGlobal/${qt_version} + ${qt_loc}/include/QtWaylandEglClientHwIntegration/${qt_version} ${qt_loc}/include/QtWaylandClient/${qt_version}/QtWaylandClient ${qt_loc}/include/QtWaylandGlobal/${qt_version}/QtWaylandGlobal + ${qt_loc}/include/QtWaylandEglClientHwIntegration/${qt_version}/QtWaylandEglClientHwIntegration ) endif() @@ -112,6 +116,7 @@ if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) INTERFACE QT_WAYLANDCLIENT_LIB QT_WAYLANDGLOBAL_LIB + QT_WAYLAND_EGL_CLIENT_HW_INTEGRATION_LIB ) endif() From f1c974379030951bf42d34830f9f05268e6e9cde Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 7 Aug 2022 04:04:16 +0400 Subject: [PATCH 031/215] Simplify Qt library list on Linux --- external/qt/CMakeLists.txt | 54 +++++++++++++--------------------- external/qt/qt6/CMakeLists.txt | 50 ++++++++++++------------------- 2 files changed, 39 insertions(+), 65 deletions(-) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 97e7bdb..3bb59b8 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -200,38 +200,8 @@ elseif (APPLE) cups ) else() - set(qt_libs_dbus) - set(qt_libs_dbus_support) - set(qt_libs_dbus_plugins) - set(qt_libs_dbus_bearers) - if (Qt5DBus_FOUND) - set(qt_libs_dbus lib/${qt_lib_prefix}Qt5DBus) - set(qt_libs_dbus_support lib/${qt_lib_prefix}Qt5LinuxAccessibilitySupport) - set(qt_libs_dbus_plugins - plugins/platforminputcontexts/${qt_lib_prefix}ibusplatforminputcontextplugin - plugins/platformthemes/${qt_lib_prefix}qxdgdesktopportal - ) - set(qt_libs_dbus_bearers - plugins/bearer/${qt_lib_prefix}qconnmanbearer - plugins/bearer/${qt_lib_prefix}qnmbearer - ) - endif() - set(qt_libs_waylandclient) - set(qt_libs_waylandclient_plugins) - if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) - set(qt_libs_waylandclient lib/${qt_lib_prefix}Qt5WaylandClient) - set(qt_libs_waylandclient_plugins - plugins/platforms/${qt_lib_prefix}qwayland-generic - plugins/platforms/${qt_lib_prefix}qwayland-egl - plugins/wayland-graphics-integration-client/${qt_lib_prefix}qt-plugin-wayland-egl - plugins/wayland-shell-integration/${qt_lib_prefix}xdg-shell - plugins/wayland-decoration-client/${qt_lib_prefix}bradient - ) - endif() set(qt_libs plugins/platforminputcontexts/${qt_lib_prefix}composeplatforminputcontextplugin - ${qt_libs_dbus_plugins} - ${qt_libs_waylandclient_plugins} plugins/platformthemes/${qt_lib_prefix}qgtk3 plugins/platforms/${qt_lib_prefix}qxcb plugins/xcbglintegrations/${qt_lib_prefix}qxcb-egl-integration @@ -243,15 +213,31 @@ else() lib/${qt_lib_prefix}Qt5ServiceSupport lib/${qt_lib_prefix}Qt5EdidSupport lib/${qt_lib_prefix}Qt5XkbCommonSupport - ${qt_libs_dbus_support} - ${qt_libs_dbus_bearers} - ${qt_libs_waylandclient} lib/${qt_lib_prefix}Qt5ServiceSupport ${common_qt_libs} - ${qt_libs_dbus} lib/${qt_lib_prefix}Qt5Core lib/${qt_lib_prefix}qtpcre2 ) + if (Qt5DBus_FOUND) + list(APPEND qt_libs + plugins/bearer/${qt_lib_prefix}qconnmanbearer + plugins/bearer/${qt_lib_prefix}qnmbearer + plugins/platforminputcontexts/${qt_lib_prefix}ibusplatforminputcontextplugin + plugins/platformthemes/${qt_lib_prefix}qxdgdesktopportal + lib/${qt_lib_prefix}Qt5LinuxAccessibilitySupport + lib/${qt_lib_prefix}Qt5DBus + ) + endif() + if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) + list(PREPEND qt_libs + plugins/platforms/${qt_lib_prefix}qwayland-generic + plugins/platforms/${qt_lib_prefix}qwayland-egl + plugins/wayland-graphics-integration-client/${qt_lib_prefix}qt-plugin-wayland-egl + plugins/wayland-shell-integration/${qt_lib_prefix}xdg-shell + plugins/wayland-decoration-client/${qt_lib_prefix}bradient + lib/${qt_lib_prefix}Qt5WaylandClient + ) + endif() foreach (lib ${qt_libs}) list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}") endforeach() diff --git a/external/qt/qt6/CMakeLists.txt b/external/qt/qt6/CMakeLists.txt index e5fc246..afc27f5 100644 --- a/external/qt/qt6/CMakeLists.txt +++ b/external/qt/qt6/CMakeLists.txt @@ -190,37 +190,8 @@ elseif (APPLE) $ ) else() - set(qt_libs_dbus) - set(qt_libs_dbus_plugins) - if (Qt6DBus_FOUND) - set(qt_libs_dbus - lib/${qt_lib_prefix}Qt6DBus - lib/${qt_lib_prefix}Qt6Core - ) - set(qt_libs_dbus_plugins - plugins/platforminputcontexts/${qt_lib_prefix}ibusplatforminputcontextplugin - plugins/platformthemes/${qt_lib_prefix}qxdgdesktopportal - ) - endif() - set(qt_libs_waylandclient) - set(qt_libs_waylandclient_plugins) - if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) - set(qt_libs_waylandclient - lib/${qt_lib_prefix}Qt6WaylandEglClientHwIntegration - lib/${qt_lib_prefix}Qt6WaylandClient - ) - set(qt_libs_waylandclient_plugins - plugins/platforms/${qt_lib_prefix}qwayland-generic - plugins/platforms/${qt_lib_prefix}qwayland-egl - plugins/wayland-graphics-integration-client/${qt_lib_prefix}qt-plugin-wayland-egl - plugins/wayland-shell-integration/${qt_lib_prefix}xdg-shell - plugins/wayland-decoration-client/${qt_lib_prefix}bradient - ) - endif() set(qt_libs plugins/platforminputcontexts/${qt_lib_prefix}composeplatforminputcontextplugin - ${qt_libs_dbus_plugins} - ${qt_libs_waylandclient_plugins} plugins/platformthemes/${qt_lib_prefix}qgtk3 plugins/platforms/${qt_lib_prefix}qxcb plugins/tls/${qt_lib_prefix}qopensslbackend @@ -228,10 +199,27 @@ else() plugins/xcbglintegrations/${qt_lib_prefix}qxcb-glx-integration plugins/iconengines/${qt_lib_prefix}qsvgicon lib/${qt_lib_prefix}Qt6XcbQpa - ${qt_libs_waylandclient} ${common_qt_libs} - ${qt_libs_dbus} ) + if (Qt6DBus_FOUND) + list(APPEND qt_libs + plugins/platforminputcontexts/${qt_lib_prefix}ibusplatforminputcontextplugin + plugins/platformthemes/${qt_lib_prefix}qxdgdesktopportal + lib/${qt_lib_prefix}Qt6DBus + lib/${qt_lib_prefix}Qt6Core + ) + endif() + if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) + list(PREPEND qt_libs + plugins/platforms/${qt_lib_prefix}qwayland-generic + plugins/platforms/${qt_lib_prefix}qwayland-egl + plugins/wayland-graphics-integration-client/${qt_lib_prefix}qt-plugin-wayland-egl + plugins/wayland-shell-integration/${qt_lib_prefix}xdg-shell + plugins/wayland-decoration-client/${qt_lib_prefix}bradient + lib/${qt_lib_prefix}Qt6WaylandEglClientHwIntegration + lib/${qt_lib_prefix}Qt6WaylandClient + ) + endif() foreach (lib ${qt_libs}) list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}") endforeach() From eacf0c8d644fac8c7e7171b17ea1f8e0917ba68e Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 8 Aug 2022 09:39:29 +0300 Subject: [PATCH 032/215] Revert "Use QtWaylandEglClientHwIntegrationPrivate module" This reverts commit 3e6a8fc1924bea4d886867515b56003c88287867. --- external/qt/package.cmake | 2 +- external/qt/qt6/CMakeLists.txt | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/external/qt/package.cmake b/external/qt/package.cmake index 780a876..88bb825 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -31,7 +31,7 @@ endif() if (LINUX) if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) if (DESKTOP_APP_QT6) - find_package(Qt6 COMPONENTS WaylandClient WaylandEglClientHwIntegrationPrivate REQUIRED) + find_package(Qt6 COMPONENTS WaylandClient REQUIRED) find_package(Qt6 OPTIONAL_COMPONENTS WaylandGlobalPrivate QUIET) else() find_package(Qt5 COMPONENTS WaylandClient REQUIRED) diff --git a/external/qt/qt6/CMakeLists.txt b/external/qt/qt6/CMakeLists.txt index afc27f5..d2b5eef 100644 --- a/external/qt/qt6/CMakeLists.txt +++ b/external/qt/qt6/CMakeLists.txt @@ -35,7 +35,6 @@ if (DESKTOP_APP_USE_PACKAGED) INTERFACE Qt6::WaylandClient Qt6::WaylandClientPrivate - Qt6::WaylandEglClientHwIntegrationPrivate ) if (Qt6WaylandGlobalPrivate_FOUND) @@ -79,13 +78,10 @@ if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) INTERFACE ${qt_loc}/include/QtWaylandClient ${qt_loc}/include/QtWaylandGlobal - ${qt_loc}/include/QtWaylandEglClientHwIntegration ${qt_loc}/include/QtWaylandClient/${qt_version} ${qt_loc}/include/QtWaylandGlobal/${qt_version} - ${qt_loc}/include/QtWaylandEglClientHwIntegration/${qt_version} ${qt_loc}/include/QtWaylandClient/${qt_version}/QtWaylandClient ${qt_loc}/include/QtWaylandGlobal/${qt_version}/QtWaylandGlobal - ${qt_loc}/include/QtWaylandEglClientHwIntegration/${qt_version}/QtWaylandEglClientHwIntegration ) endif() @@ -116,7 +112,6 @@ if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) INTERFACE QT_WAYLANDCLIENT_LIB QT_WAYLANDGLOBAL_LIB - QT_WAYLAND_EGL_CLIENT_HW_INTEGRATION_LIB ) endif() From 76459183d9560817f2a562d61ef57754505f8205 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 8 Aug 2022 09:39:40 +0300 Subject: [PATCH 033/215] Revert "Use QtWidgets private headers" This reverts commit 00c2360aca08068fe9d23771fa4900b29b7e8ef1. --- external/qt/CMakeLists.txt | 3 --- external/qt/qt6/CMakeLists.txt | 3 --- 2 files changed, 6 deletions(-) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 3bb59b8..aab5b6d 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -21,7 +21,6 @@ if (DESKTOP_APP_USE_PACKAGED) Qt5::Gui Qt5::GuiPrivate Qt5::Widgets - Qt5::WidgetsPrivate Qt5::Network Qt5::Svg ) @@ -61,10 +60,8 @@ INTERFACE ${qt_loc}/include/QtSvg ${qt_loc}/include/QtCore/${qt_version} ${qt_loc}/include/QtGui/${qt_version} - ${qt_loc}/include/QtWidgets/${qt_version} ${qt_loc}/include/QtCore/${qt_version}/QtCore ${qt_loc}/include/QtGui/${qt_version}/QtGui - ${qt_loc}/include/QtWidgets/${qt_version}/QtWidgets ) if (Qt5DBus_FOUND) diff --git a/external/qt/qt6/CMakeLists.txt b/external/qt/qt6/CMakeLists.txt index d2b5eef..3d066f4 100644 --- a/external/qt/qt6/CMakeLists.txt +++ b/external/qt/qt6/CMakeLists.txt @@ -17,7 +17,6 @@ if (DESKTOP_APP_USE_PACKAGED) Qt6::GuiPrivate Qt6::OpenGL Qt6::Widgets - Qt6::WidgetsPrivate Qt6::OpenGLWidgets Qt6::Network Qt6::Svg @@ -60,10 +59,8 @@ INTERFACE ${qt_loc}/include/QtSvg ${qt_loc}/include/QtCore/${qt_version} ${qt_loc}/include/QtGui/${qt_version} - ${qt_loc}/include/QtWidgets/${qt_version} ${qt_loc}/include/QtCore/${qt_version}/QtCore ${qt_loc}/include/QtGui/${qt_version}/QtGui - ${qt_loc}/include/QtWidgets/${qt_version}/QtWidgets ) if (Qt6DBus_FOUND) From c65bf3b1348e95cddd842d7c38a3dc2f97b5ff64 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 8 Aug 2022 19:14:33 +0400 Subject: [PATCH 034/215] Remove unused now wayland symbols --- linux_wayland_helper/linux_wayland_helper.cpp | 50 ------------------- 1 file changed, 50 deletions(-) diff --git a/linux_wayland_helper/linux_wayland_helper.cpp b/linux_wayland_helper/linux_wayland_helper.cpp index 9fb3b1f..d4ee1a0 100644 --- a/linux_wayland_helper/linux_wayland_helper.cpp +++ b/linux_wayland_helper/linux_wayland_helper.cpp @@ -53,9 +53,6 @@ int (*wl_cursor_frame_and_duration)( void (*wl_proxy_destroy)(struct wl_proxy *proxy); uint32_t (*wl_proxy_get_version)(struct wl_proxy *proxy); -void (*wl_array_init)(struct wl_array *array); -void (*wl_array_release)(struct wl_array *array); -void *(*wl_array_add)(struct wl_array *array, size_t size); int (*wl_proxy_add_listener)( struct wl_proxy *proxy, void (**implementation)(void), @@ -75,16 +72,13 @@ int (*wl_display_prepare_read_queue)( int (*wl_display_flush)(struct wl_display *display); void (*wl_display_cancel_read)(struct wl_display *display); int (*wl_display_read_events)(struct wl_display *display); -void (*wl_event_queue_destroy)(struct wl_event_queue *queue); int (*wl_display_prepare_read)(struct wl_display *display); int (*wl_display_dispatch_pending)(struct wl_display *display); struct wl_display *(*wl_display_connect)(const char *name); -struct wl_display *(*wl_display_connect_to_fd)(int fd); void (*wl_display_disconnect)(struct wl_display *display); void *(*wl_proxy_create_wrapper)(void *proxy); void (*wl_proxy_wrapper_destroy)(void *proxy_wrapper); void (*wl_proxy_set_queue)(struct wl_proxy *proxy, struct wl_event_queue *queue); -int (*wl_display_roundtrip)(struct wl_display *display); struct wl_proxy *(*wl_proxy_marshal_array_constructor)( struct wl_proxy *proxy, uint32_t opcode, @@ -230,9 +224,6 @@ bool Resolve() { && LoadLibrary(client, "libwayland-client.so.0") && LOAD_SYMBOL(client, wl_proxy_destroy) && LOAD_SYMBOL(client, wl_proxy_get_version) - && LOAD_SYMBOL(client, wl_array_init) - && LOAD_SYMBOL(client, wl_array_release) - && LOAD_SYMBOL(client, wl_array_add) && LOAD_SYMBOL(client, wl_proxy_add_listener) && LOAD_SYMBOL(client, wl_proxy_set_user_data) && LOAD_SYMBOL(client, wl_proxy_get_user_data) @@ -245,16 +236,13 @@ bool Resolve() { && LOAD_SYMBOL(client, wl_display_flush) && LOAD_SYMBOL(client, wl_display_cancel_read) && LOAD_SYMBOL(client, wl_display_read_events) - && LOAD_SYMBOL(client, wl_event_queue_destroy) && LOAD_SYMBOL(client, wl_display_prepare_read) && LOAD_SYMBOL(client, wl_display_dispatch_pending) && LOAD_SYMBOL(client, wl_display_connect) - && LOAD_SYMBOL(client, wl_display_connect_to_fd) && LOAD_SYMBOL(client, wl_display_disconnect) && LOAD_SYMBOL(client, wl_proxy_create_wrapper) && LOAD_SYMBOL(client, wl_proxy_wrapper_destroy) && LOAD_SYMBOL(client, wl_proxy_set_queue) - && LOAD_SYMBOL(client, wl_display_roundtrip) && LOAD_SYMBOL(client, wl_proxy_marshal_array_constructor) && LOAD_SYMBOL(client, wl_proxy_marshal_array_constructor_versioned) && LOAD_SYMBOL(client, wl_proxy_get_id) @@ -357,24 +345,6 @@ uint32_t wl_proxy_get_version(struct wl_proxy *proxy) { return W::wl_proxy_get_version(proxy); } -void wl_array_init(struct wl_array *array) { - Expects(W::wl_array_init != nullptr); - - W::wl_array_init(array); -} - -void wl_array_release(struct wl_array *array) { - Expects(W::wl_array_release != nullptr); - - W::wl_array_release(array); -} - -void *wl_array_add(struct wl_array *array, size_t size) { - Expects(W::wl_array_add != nullptr); - - return W::wl_array_add(array, size); -} - int wl_proxy_add_listener( struct wl_proxy *proxy, void (**implementation)(void), @@ -454,12 +424,6 @@ int wl_display_read_events(struct wl_display *display) { return W::wl_display_read_events(display); } -void wl_event_queue_destroy(struct wl_event_queue *queue) { - Expects(W::wl_event_queue_destroy != nullptr); - - W::wl_event_queue_destroy(queue); -} - int wl_display_prepare_read(struct wl_display *display) { Expects(W::wl_display_prepare_read != nullptr); @@ -480,14 +444,6 @@ struct wl_display *wl_display_connect(const char *name) { return W::wl_display_connect(name); } -struct wl_display *wl_display_connect_to_fd(int fd) { - if (!W::Resolve()) { - errno = ENOENT; - return nullptr; - } - return W::wl_display_connect_to_fd(fd); -} - void wl_display_disconnect(struct wl_display *display) { Expects(W::wl_display_disconnect != nullptr); @@ -514,12 +470,6 @@ void wl_proxy_set_queue( W::wl_proxy_set_queue(proxy, queue); } -int wl_display_roundtrip(struct wl_display *display) { - Expects(W::wl_display_roundtrip != nullptr); - - return W::wl_display_roundtrip(display); -} - struct wl_proxy *wl_proxy_marshal_array_constructor( struct wl_proxy *proxy, uint32_t opcode, From 9615515b069a1d3174fc45f9de69a23b616b80b3 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 8 Aug 2022 12:34:32 +0400 Subject: [PATCH 035/215] Use version-less Qt targets and functions whenever possible --- external/fcitx5_qt/CMakeLists.txt | 7 +- .../fcitx5_qt_dbusaddons/CMakeLists.txt | 16 +- external/fcitx_qt5/CMakeLists.txt | 22 +- external/qt/CMakeLists.txt | 237 +++++++-------- external/qt/package.cmake | 31 +- external/qt/qt6/CMakeLists.txt | 281 ------------------ target_prepare_qrc.cmake | 7 +- 7 files changed, 133 insertions(+), 468 deletions(-) delete mode 100644 external/qt/qt6/CMakeLists.txt diff --git a/external/fcitx5_qt/CMakeLists.txt b/external/fcitx5_qt/CMakeLists.txt index 8827162..b002d59 100644 --- a/external/fcitx5_qt/CMakeLists.txt +++ b/external/fcitx5_qt/CMakeLists.txt @@ -15,12 +15,7 @@ add_library(desktop-app::external_fcitx5_qt ALIAS external_fcitx5_qt) init_target(external_fcitx5_qt "(external)") set(fcitx5_qt_loc ${third_party_loc}/fcitx5-qt) - -if (DESKTOP_APP_QT6) - set(fcitx5_qt_src ${fcitx5_qt_loc}/qt6/platforminputcontext) -else() - set(fcitx5_qt_src ${fcitx5_qt_loc}/qt5/platforminputcontext) -endif() +set(fcitx5_qt_src ${fcitx5_qt_loc}/qt${QT_VERSION_MAJOR}/platforminputcontext) set_target_properties(external_fcitx5_qt PROPERTIES AUTOMOC ON) set(FCITX5_QT_EXTRA_PLUGIN_NAME "") diff --git a/external/fcitx5_qt/fcitx5_qt_dbusaddons/CMakeLists.txt b/external/fcitx5_qt/fcitx5_qt_dbusaddons/CMakeLists.txt index 53370f1..c8e3ce1 100644 --- a/external/fcitx5_qt/fcitx5_qt_dbusaddons/CMakeLists.txt +++ b/external/fcitx5_qt/fcitx5_qt_dbusaddons/CMakeLists.txt @@ -15,12 +15,7 @@ add_library(desktop-app::external_fcitx5_qt_dbusaddons ALIAS external_fcitx5_qt_ init_target(external_fcitx5_qt_dbusaddons "(external)") set(fcitx5_qt_loc ${third_party_loc}/fcitx5-qt) - -if (DESKTOP_APP_QT6) - set(fcitx5_qt_dbusaddons_src ${fcitx5_qt_loc}/qt6/dbusaddons) -else() - set(fcitx5_qt_dbusaddons_src ${fcitx5_qt_loc}/qt5/dbusaddons) -endif() +set(fcitx5_qt_dbusaddons_src ${fcitx5_qt_loc}/qt${QT_VERSION_MAJOR}/dbusaddons) set_target_properties(external_fcitx5_qt_dbusaddons PROPERTIES AUTOMOC ON) @@ -40,12 +35,7 @@ PRIVATE ) include(GenerateExportHeader) - -if (DESKTOP_APP_QT6) - generate_export_header(external_fcitx5_qt_dbusaddons BASE_NAME Fcitx5Qt6DBusAddons) -else() - generate_export_header(external_fcitx5_qt_dbusaddons BASE_NAME Fcitx5Qt5DBusAddons) -endif() +generate_export_header(external_fcitx5_qt_dbusaddons BASE_NAME Fcitx5Qt${QT_VERSION_MAJOR}DBusAddons) target_include_directories(external_fcitx5_qt_dbusaddons PUBLIC @@ -53,7 +43,7 @@ PUBLIC "${CMAKE_CURRENT_BINARY_DIR}" ) -if (NOT DESKTOP_APP_QT6) +if (QT_VERSION_MAJOR EQUAL 5) target_compile_definitions(external_fcitx5_qt_dbusaddons PRIVATE FCITX5QT5DBUSADDONS_STATIC_DEFINE diff --git a/external/fcitx_qt5/CMakeLists.txt b/external/fcitx_qt5/CMakeLists.txt index 6cc0312..7f4a8b5 100644 --- a/external/fcitx_qt5/CMakeLists.txt +++ b/external/fcitx_qt5/CMakeLists.txt @@ -15,12 +15,7 @@ add_library(desktop-app::external_fcitx_qt5 ALIAS external_fcitx_qt5) init_target(external_fcitx_qt5 "(external)") set(fcitx_qt5_loc ${third_party_loc}/fcitx-qt5) - -if (DESKTOP_APP_QT6) - set(fcitx_qt5_src ${fcitx_qt5_loc}/qt6/platforminputcontext) -else() - set(fcitx_qt5_src ${fcitx_qt5_loc}/qt5/platforminputcontext) -endif() +set(fcitx_qt5_src ${fcitx_qt5_loc}/qt${QT_VERSION_MAJOR}/platforminputcontext) set_target_properties(external_fcitx_qt5 PROPERTIES AUTOMOC ON) @@ -43,17 +38,10 @@ INCLUDE ${fcitx_qt5_src}/fcitxqtdbustypes.h) set_source_files_properties(${fcitx_qt5_src}/org.fcitx.Fcitx.InputMethod1.xml PROPERTIES INCLUDE ${fcitx_qt5_src}/fcitxqtdbustypes.h) -if (DESKTOP_APP_QT6) - qt6_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputContext.xml inputcontextproxy) - qt6_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputContext1.xml inputcontext1proxy) - qt6_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputMethod.xml inputmethodproxy) - qt6_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputMethod1.xml inputmethod1proxy) -else() - qt5_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputContext.xml inputcontextproxy) - qt5_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputContext1.xml inputcontext1proxy) - qt5_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputMethod.xml inputmethodproxy) - qt5_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputMethod1.xml inputmethod1proxy) -endif() +qt_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputContext.xml inputcontextproxy) +qt_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputContext1.xml inputcontext1proxy) +qt_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputMethod.xml inputmethodproxy) +qt_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputMethod1.xml inputmethod1proxy) target_sources(external_fcitx_qt5 PRIVATE ${fcitx_qt5_adaptors}) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index aab5b6d..5a72731 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -4,50 +4,32 @@ # For license and copyright information please follow this link: # https://github.com/desktop-app/legal/blob/master/LEGAL -add_subdirectory(qt_static_plugins) -if (DESKTOP_APP_QT6) - add_subdirectory(qt6) - return() -endif() - add_library(external_qt INTERFACE IMPORTED GLOBAL) add_library(desktop-app::external_qt ALIAS external_qt) +add_subdirectory(qt_static_plugins) + if (DESKTOP_APP_USE_PACKAGED) target_link_libraries(external_qt INTERFACE - Qt5::Core - Qt5::CorePrivate - Qt5::Gui - Qt5::GuiPrivate - Qt5::Widgets - Qt5::Network - Qt5::Svg + Qt::Core + Qt::CorePrivate + $ + Qt::Gui + Qt::GuiPrivate + $ + Qt::Widgets + $ + Qt::Network + Qt::Svg + $ + $ + $ + $ + $ + $ ) - if (Qt5DBus_FOUND) - target_link_libraries(external_qt - INTERFACE - Qt5::DBus - ) - endif() - - if (Qt5XkbCommonSupport_FOUND) - target_link_libraries(external_qt - INTERFACE - Qt5::XkbCommonSupport - Qt5::XkbCommonSupportPrivate - ) - endif() - - if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) - target_link_libraries(external_qt - INTERFACE - Qt5::WaylandClient - Qt5::WaylandClientPrivate - ) - endif() - return() endif() @@ -55,73 +37,46 @@ target_include_directories(external_qt SYSTEM INTERFACE ${qt_loc}/include ${qt_loc}/include/QtCore + $<$:${qt_loc}/include/QtCore5Compat> ${qt_loc}/include/QtGui + $<$:${qt_loc}/include/QtOpenGL> ${qt_loc}/include/QtWidgets + $<$:${qt_loc}/include/QtOpenGLWidgets> ${qt_loc}/include/QtSvg + $<$:${qt_loc}/include/QtDBus> + $<$:${qt_loc}/include/QtXkbCommonSupport> + $<$:${qt_loc}/include/QtWaylandClient> ${qt_loc}/include/QtCore/${qt_version} ${qt_loc}/include/QtGui/${qt_version} + $<$:${qt_loc}/include/QtXkbCommonSupport/${qt_version}> + $<$:${qt_loc}/include/QtWaylandClient/${qt_version}> + $<$:${qt_loc}/include/QtWaylandGlobal/${qt_version}> ${qt_loc}/include/QtCore/${qt_version}/QtCore ${qt_loc}/include/QtGui/${qt_version}/QtGui + $<$:${qt_loc}/include/QtXkbCommonSupport/${qt_version}/QtXkbCommonSupport> + $<$:${qt_loc}/include/QtWaylandClient/${qt_version}/QtWaylandClient> + $<$:${qt_loc}/include/QtWaylandGlobal/${qt_version}/QtWaylandGlobal> ) -if (Qt5DBus_FOUND) - target_include_directories(external_qt SYSTEM - INTERFACE - ${qt_loc}/include/QtDBus - ) -endif() - -if (Qt5XkbCommonSupport_FOUND) - target_include_directories(external_qt SYSTEM - INTERFACE - ${qt_loc}/include/QtXkbCommonSupport - ${qt_loc}/include/QtXkbCommonSupport/${qt_version} - ${qt_loc}/include/QtXkbCommonSupport/${qt_version}/QtXkbCommonSupport - ) -endif() - -if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) - target_include_directories(external_qt SYSTEM - INTERFACE - ${qt_loc}/include/QtWaylandClient - ${qt_loc}/include/QtWaylandClient/${qt_version} - ${qt_loc}/include/QtWaylandClient/${qt_version}/QtWaylandClient - ) -endif() - target_compile_definitions(external_qt INTERFACE _REENTRANT QT_STATICPLUGIN QT_PLUGIN - QT_WIDGETS_LIB - QT_NETWORK_LIB - QT_GUI_LIB QT_CORE_LIB + $<$:QT_CORE5COMPAT_LIB> + QT_GUI_LIB + $<$:QT_OPENGL_LIB> + QT_WIDGETS_LIB + $<$:QT_OPENGLWIDGETS_LIB> + QT_NETWORK_LIB QT_SVG_LIB + $<$:QT_DBUS_LIB> + $<$:QT_XKBCOMMON_SUPPORT_LIB> + $<$:QT_WAYLANDCLIENT_LIB> + $<$:QT_WAYLANDGLOBAL_LIB> ) -if (Qt5DBus_FOUND) - target_compile_definitions(external_qt - INTERFACE - QT_DBUS_LIB - ) -endif() - -if (Qt5XkbCommonSupport_FOUND) - target_compile_definitions(external_qt - INTERFACE - QT_XKBCOMMON_SUPPORT_LIB - ) -endif() - -if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) - target_compile_definitions(external_qt - INTERFACE - QT_WAYLANDCLIENT_LIB - ) -endif() - if (WIN32) set(qt_lib_prefix "") set(qt_lib_suffix $<$:d>.lib) @@ -135,23 +90,48 @@ else() endif() set(common_qt_libs - plugins/bearer/${qt_lib_prefix}qgenericbearer plugins/imageformats/${qt_lib_prefix}qwebp plugins/imageformats/${qt_lib_prefix}qgif plugins/imageformats/${qt_lib_prefix}qjpeg - lib/${qt_lib_prefix}Qt5PrintSupport - lib/${qt_lib_prefix}Qt5AccessibilitySupport - lib/${qt_lib_prefix}Qt5FontDatabaseSupport - lib/${qt_lib_prefix}Qt5EventDispatcherSupport - lib/${qt_lib_prefix}Qt5ThemeSupport - lib/${qt_lib_prefix}Qt5Network - lib/${qt_lib_prefix}Qt5Widgets - lib/${qt_lib_prefix}Qt5Gui - lib/${qt_lib_prefix}Qt5Svg - lib/${qt_lib_prefix}qtharfbuzz - lib/${qt_lib_prefix}qtlibpng + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Svg + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Network + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Widgets + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Gui + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Core ) +if (TARGET Qt::Core5Compat) + list(PREPEND common_qt_libs + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Core5Compat + ) +endif() + +if (TARGET Qt::OpenGL) + list(PREPEND common_qt_libs + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}OpenGL + ) +endif() + +if (TARGET Qt::OpenGLWidgets) + list(PREPEND common_qt_libs + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}OpenGLWidgets + ) +endif() + +if (QT_VERSION_MAJOR GREATER_EQUAL 6) + list(APPEND common_qt_libs + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}BundledHarfbuzz + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}BundledLibpng + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}BundledPcre2 + ) +else() + list(APPEND common_qt_libs + lib/${qt_lib_prefix}qtharfbuzz + lib/${qt_lib_prefix}qtlibpng + lib/${qt_lib_prefix}qtpcre2 + ) +endif() + set(qt_libs_list "") if (WIN32) target_include_directories(external_qt SYSTEM @@ -159,12 +139,15 @@ if (WIN32) ${qt_loc}/mkspecs/win32-msvc ) set(qt_libs + plugins/bearer/${qt_lib_prefix}qgenericbearer + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}AccessibilitySupport + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}FontDatabaseSupport + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}EventDispatcherSupport + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}ThemeSupport ${common_qt_libs} - lib/${qt_lib_prefix}Qt5Core - lib/${qt_lib_prefix}Qt5WindowsUIAutomationSupport + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}WindowsUIAutomationSupport lib/${qt_lib_prefix}qtmain lib/${qt_lib_prefix}qtfreetype - lib/${qt_lib_prefix}qtpcre2 plugins/platforms/${qt_lib_prefix}qwindows ) foreach (lib ${qt_libs}) @@ -182,57 +165,46 @@ elseif (APPLE) ) set(qt_libs ${common_qt_libs} - lib/${qt_lib_prefix}Qt5Core - lib/${qt_lib_prefix}Qt5GraphicsSupport - lib/${qt_lib_prefix}Qt5ClipboardSupport - lib/${qt_lib_prefix}qtfreetype - lib/${qt_lib_prefix}qtpcre2 + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}BundledFreetype plugins/platforms/${qt_lib_prefix}qcocoa + plugins/tls/${qt_lib_prefix}qsecuretransportbackend + plugins/networkinformation/${qt_lib_prefix}qscnetworkreachability ) foreach (lib ${qt_libs}) list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}") endforeach() - target_link_libraries(external_qt - INTERFACE - cups + list(APPEND qt_libs_list + $ ) else() set(qt_libs plugins/platforminputcontexts/${qt_lib_prefix}composeplatforminputcontextplugin plugins/platformthemes/${qt_lib_prefix}qgtk3 plugins/platforms/${qt_lib_prefix}qxcb + plugins/tls/${qt_lib_prefix}qopensslbackend plugins/xcbglintegrations/${qt_lib_prefix}qxcb-egl-integration plugins/xcbglintegrations/${qt_lib_prefix}qxcb-glx-integration plugins/iconengines/${qt_lib_prefix}qsvgicon - lib/${qt_lib_prefix}Qt5XcbQpa - lib/${qt_lib_prefix}Qt5EglSupport - lib/${qt_lib_prefix}Qt5GlxSupport - lib/${qt_lib_prefix}Qt5ServiceSupport - lib/${qt_lib_prefix}Qt5EdidSupport - lib/${qt_lib_prefix}Qt5XkbCommonSupport - lib/${qt_lib_prefix}Qt5ServiceSupport + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}XcbQpa ${common_qt_libs} - lib/${qt_lib_prefix}Qt5Core - lib/${qt_lib_prefix}qtpcre2 ) - if (Qt5DBus_FOUND) + if (TARGET Qt::DBus) list(APPEND qt_libs - plugins/bearer/${qt_lib_prefix}qconnmanbearer - plugins/bearer/${qt_lib_prefix}qnmbearer plugins/platforminputcontexts/${qt_lib_prefix}ibusplatforminputcontextplugin plugins/platformthemes/${qt_lib_prefix}qxdgdesktopportal - lib/${qt_lib_prefix}Qt5LinuxAccessibilitySupport - lib/${qt_lib_prefix}Qt5DBus + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}DBus + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Core ) endif() - if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) + if (TARGET Qt::WaylandClient) list(PREPEND qt_libs plugins/platforms/${qt_lib_prefix}qwayland-generic plugins/platforms/${qt_lib_prefix}qwayland-egl plugins/wayland-graphics-integration-client/${qt_lib_prefix}qt-plugin-wayland-egl plugins/wayland-shell-integration/${qt_lib_prefix}xdg-shell plugins/wayland-decoration-client/${qt_lib_prefix}bradient - lib/${qt_lib_prefix}Qt5WaylandClient + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}WaylandEglClientHwIntegration + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}WaylandClient ) endif() foreach (lib ${qt_libs}) @@ -240,6 +212,15 @@ else() endforeach() endif() +if (QT_VERSION_MAJOR GREATER_EQUAL 6) + list(APPEND qt_libs_list + $ + $ + $ + $ + ) +endif() + target_link_libraries(external_qt INTERFACE ${qt_libs_list} @@ -260,7 +241,6 @@ if (LINUX) target_link_static_libraries(external_qt INTERFACE proxy - epoxy xkbcommon xkbcommon-x11 xcb-glx @@ -271,15 +251,13 @@ if (LINUX) xcb-render xcb-image xcb-xfixes - xcb-xinerama - xcb-xinput xcb-shape xcb-sync xcb-util xcb-render-util xcb-keysyms ) - if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) + if (TARGET Qt::WaylandClient) target_link_libraries(external_qt INTERFACE desktop-app::linux_wayland_helper @@ -290,8 +268,11 @@ if (LINUX) desktop-app::linux_xcb_helper fontconfig freetype + EGL + GL xcb X11 X11-xcb + glib-2.0 ) endif() diff --git a/external/qt/package.cmake b/external/qt/package.cmake index 88bb825..bae8405 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -23,36 +23,33 @@ if (NOT DESKTOP_APP_USE_PACKAGED) endif() if (DESKTOP_APP_QT6) - find_package(Qt6 COMPONENTS Core Core5Compat Gui OpenGL Widgets OpenGLWidgets Network Svg REQUIRED) + find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) else() - find_package(Qt5 COMPONENTS Core Gui Widgets Network Svg REQUIRED) + find_package(QT NAMES Qt5 REQUIRED COMPONENTS Core) +endif() + +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets Network Svg REQUIRED) + +if (QT_VERSION_MAJOR GREATER_EQUAL 6) + find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core5Compat OpenGL OpenGLWidgets REQUIRED) endif() if (LINUX) if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) - if (DESKTOP_APP_QT6) - find_package(Qt6 COMPONENTS WaylandClient REQUIRED) - find_package(Qt6 OPTIONAL_COMPONENTS WaylandGlobalPrivate QUIET) + find_package(Qt${QT_VERSION_MAJOR} COMPONENTS WaylandClient REQUIRED) + if (QT_VERSION_MAJOR GREATER_EQUAL 6) + find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS WaylandGlobalPrivate QUIET) else() - find_package(Qt5 COMPONENTS WaylandClient REQUIRED) - find_package(Qt5 OPTIONAL_COMPONENTS XkbCommonSupport QUIET) + find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS XkbCommonSupport QUIET) endif() endif() if ((NOT DESKTOP_APP_USE_PACKAGED OR (DESKTOP_APP_USE_PACKAGED AND DESKTOP_APP_USE_PACKAGED_LAZY)) AND NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) - if (DESKTOP_APP_QT6) - find_package(Qt6 COMPONENTS DBus REQUIRED) - else() - find_package(Qt5 COMPONENTS DBus REQUIRED) - endif() + find_package(Qt${QT_VERSION_MAJOR} COMPONENTS DBus REQUIRED) elseif (NOT DESKTOP_APP_USE_PACKAGED) - if (DESKTOP_APP_QT6) - find_package(Qt6 OPTIONAL_COMPONENTS DBus QUIET) - else() - find_package(Qt5 OPTIONAL_COMPONENTS DBus QUIET) - endif() + find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS DBus QUIET) endif() endif() diff --git a/external/qt/qt6/CMakeLists.txt b/external/qt/qt6/CMakeLists.txt deleted file mode 100644 index 3d066f4..0000000 --- a/external/qt/qt6/CMakeLists.txt +++ /dev/null @@ -1,281 +0,0 @@ -# This file is part of Desktop App Toolkit, -# a set of libraries for developing nice desktop applications. -# -# For license and copyright information please follow this link: -# https://github.com/desktop-app/legal/blob/master/LEGAL - -add_library(external_qt INTERFACE IMPORTED GLOBAL) -add_library(desktop-app::external_qt ALIAS external_qt) - -if (DESKTOP_APP_USE_PACKAGED) - target_link_libraries(external_qt - INTERFACE - Qt6::Core - Qt6::CorePrivate - Qt6::Core5Compat - Qt6::Gui - Qt6::GuiPrivate - Qt6::OpenGL - Qt6::Widgets - Qt6::OpenGLWidgets - Qt6::Network - Qt6::Svg - ) - - if (Qt6DBus_FOUND) - target_link_libraries(external_qt - INTERFACE - Qt6::DBus - ) - endif() - - if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) - target_link_libraries(external_qt - INTERFACE - Qt6::WaylandClient - Qt6::WaylandClientPrivate - ) - - if (Qt6WaylandGlobalPrivate_FOUND) - target_link_libraries(external_qt - INTERFACE - Qt6::WaylandGlobalPrivate - ) - endif() - endif() - - return() -endif() - -target_include_directories(external_qt SYSTEM -INTERFACE - ${qt_loc}/include - ${qt_loc}/include/QtCore - ${qt_loc}/include/QtCore5Compat - ${qt_loc}/include/QtGui - ${qt_loc}/include/QtOpenGL - ${qt_loc}/include/QtWidgets - ${qt_loc}/include/QtOpenGLWidgets - ${qt_loc}/include/QtSvg - ${qt_loc}/include/QtCore/${qt_version} - ${qt_loc}/include/QtGui/${qt_version} - ${qt_loc}/include/QtCore/${qt_version}/QtCore - ${qt_loc}/include/QtGui/${qt_version}/QtGui -) - -if (Qt6DBus_FOUND) - target_include_directories(external_qt SYSTEM - INTERFACE - ${qt_loc}/include/QtDBus - ) -endif() - -if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) - target_include_directories(external_qt SYSTEM - INTERFACE - ${qt_loc}/include/QtWaylandClient - ${qt_loc}/include/QtWaylandGlobal - ${qt_loc}/include/QtWaylandClient/${qt_version} - ${qt_loc}/include/QtWaylandGlobal/${qt_version} - ${qt_loc}/include/QtWaylandClient/${qt_version}/QtWaylandClient - ${qt_loc}/include/QtWaylandGlobal/${qt_version}/QtWaylandGlobal - ) -endif() - -target_compile_definitions(external_qt -INTERFACE - _REENTRANT - QT_STATICPLUGIN - QT_PLUGIN - QT_SVG_LIB - QT_NETWORK_LIB - QT_OPENGLWIDGETS_LIB - QT_WIDGETS_LIB - QT_OPENGL_LIB - QT_GUI_LIB - QT_CORE5COMPAT_LIB - QT_CORE_LIB -) - -if (Qt6DBus_FOUND) - target_compile_definitions(external_qt - INTERFACE - QT_DBUS_LIB - ) -endif() - -if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) - target_compile_definitions(external_qt - INTERFACE - QT_WAYLANDCLIENT_LIB - QT_WAYLANDGLOBAL_LIB - ) -endif() - -if (WIN32) - set(qt_lib_prefix "") - set(qt_lib_suffix $<$:d>.lib) -else() - set(qt_lib_prefix lib) - if (APPLE) - set(qt_lib_suffix $<$:_debug>.a) - else() - set(qt_lib_suffix .a) - endif() -endif() - -set(common_qt_libs - plugins/imageformats/${qt_lib_prefix}qwebp - plugins/imageformats/${qt_lib_prefix}qgif - plugins/imageformats/${qt_lib_prefix}qjpeg - lib/${qt_lib_prefix}Qt6Svg - lib/${qt_lib_prefix}Qt6Network - lib/${qt_lib_prefix}Qt6OpenGLWidgets - lib/${qt_lib_prefix}Qt6Widgets - lib/${qt_lib_prefix}Qt6OpenGL - lib/${qt_lib_prefix}Qt6Gui - lib/${qt_lib_prefix}Qt6Core5Compat - lib/${qt_lib_prefix}Qt6Core - lib/${qt_lib_prefix}Qt6BundledHarfbuzz - lib/${qt_lib_prefix}Qt6BundledLibpng - lib/${qt_lib_prefix}Qt6BundledPcre2 -) - -set(qt_libs_list "") -if (WIN32) - target_include_directories(external_qt SYSTEM - INTERFACE - ${qt_loc}/mkspecs/win32-msvc - ) - set(qt_libs - ${common_qt_libs} - lib/${qt_lib_prefix}Qt6WindowsUIAutomationSupport - lib/${qt_lib_prefix}qtmain - lib/${qt_lib_prefix}Qt6BundledFreetype - plugins/platforms/${qt_lib_prefix}qwindows - plugins/tls/${qt_lib_prefix}qopensslbackend - ) - foreach (lib ${qt_libs}) - list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}") - endforeach() - - target_link_libraries(external_qt - INTERFACE - desktop-app::external_angle - ) -elseif (APPLE) - target_include_directories(external_qt SYSTEM - INTERFACE - ${qt_loc}/mkspecs/macx-clang - ) - set(qt_libs - ${common_qt_libs} - lib/${qt_lib_prefix}Qt6BundledFreetype - plugins/platforms/${qt_lib_prefix}qcocoa - plugins/tls/${qt_lib_prefix}qsecuretransportbackend - plugins/networkinformation/${qt_lib_prefix}qscnetworkreachability - ) - foreach (lib ${qt_libs}) - list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}") - endforeach() - list(APPEND qt_libs_list - $ - ) -else() - set(qt_libs - plugins/platforminputcontexts/${qt_lib_prefix}composeplatforminputcontextplugin - plugins/platformthemes/${qt_lib_prefix}qgtk3 - plugins/platforms/${qt_lib_prefix}qxcb - plugins/tls/${qt_lib_prefix}qopensslbackend - plugins/xcbglintegrations/${qt_lib_prefix}qxcb-egl-integration - plugins/xcbglintegrations/${qt_lib_prefix}qxcb-glx-integration - plugins/iconengines/${qt_lib_prefix}qsvgicon - lib/${qt_lib_prefix}Qt6XcbQpa - ${common_qt_libs} - ) - if (Qt6DBus_FOUND) - list(APPEND qt_libs - plugins/platforminputcontexts/${qt_lib_prefix}ibusplatforminputcontextplugin - plugins/platformthemes/${qt_lib_prefix}qxdgdesktopportal - lib/${qt_lib_prefix}Qt6DBus - lib/${qt_lib_prefix}Qt6Core - ) - endif() - if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) - list(PREPEND qt_libs - plugins/platforms/${qt_lib_prefix}qwayland-generic - plugins/platforms/${qt_lib_prefix}qwayland-egl - plugins/wayland-graphics-integration-client/${qt_lib_prefix}qt-plugin-wayland-egl - plugins/wayland-shell-integration/${qt_lib_prefix}xdg-shell - plugins/wayland-decoration-client/${qt_lib_prefix}bradient - lib/${qt_lib_prefix}Qt6WaylandEglClientHwIntegration - lib/${qt_lib_prefix}Qt6WaylandClient - ) - endif() - foreach (lib ${qt_libs}) - list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}") - endforeach() -endif() - -list(APPEND qt_libs_list - $ - $ - $ - $ -) - -target_link_libraries(external_qt -INTERFACE - ${qt_libs_list} - $ - $ - $ - $ - $ - $ - $ -) - -if (LINUX) - target_include_directories(external_qt SYSTEM - INTERFACE - ${qt_loc}/mkspecs/linux-g++ - ) - target_link_static_libraries(external_qt - INTERFACE - proxy - xkbcommon - xkbcommon-x11 - xcb-glx - xcb-xkb - xcb-randr - xcb-icccm - xcb-shm - xcb-render - xcb-image - xcb-xfixes - xcb-shape - xcb-sync - xcb-util - xcb-render-util - xcb-keysyms - ) - if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) - target_link_libraries(external_qt - INTERFACE - desktop-app::linux_wayland_helper - ) - endif() - target_link_libraries(external_qt - INTERFACE - desktop-app::linux_xcb_helper - fontconfig - freetype - EGL - GL - xcb - X11 - X11-xcb - glib-2.0 - ) -endif() diff --git a/target_prepare_qrc.cmake b/target_prepare_qrc.cmake index 0e2ec4b..99ebcd9 100644 --- a/target_prepare_qrc.cmake +++ b/target_prepare_qrc.cmake @@ -34,14 +34,9 @@ function(target_prepare_qrc target_name) set(rcc_file ${target_name}.rcc) set(rcc_path "${CMAKE_BINARY_DIR}/${rcc_file}") source_group(TREE ${CMAKE_BINARY_DIR} PREFIX Resources FILES ${rcc_path}) - if (DESKTOP_APP_QT6) - set(rcc_binary Qt6::rcc) - else() - set(rcc_binary Qt5::rcc) - endif() add_custom_command(OUTPUT ${rcc_path} DEPENDS ${qrc_files} - COMMAND ${rcc_binary} ${rcc_flags} -o ${rcc_path} ${qrc_files} + COMMAND Qt::rcc ${rcc_flags} -o ${rcc_path} ${qrc_files} COMMAND_EXPAND_LISTS VERBATIM ) target_add_resource(${target_name} ${rcc_path}) From 50a67393abfc8b9d1fb69035dd373d394f78b477 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 11 Aug 2022 03:19:29 +0400 Subject: [PATCH 036/215] Use cmake_dependent_option to better declare variables that relate on other variables --- validate_special_target.cmake | 55 +++++++++++++++++++++---- variables.cmake | 75 ++++++++--------------------------- 2 files changed, 64 insertions(+), 66 deletions(-) diff --git a/validate_special_target.cmake b/validate_special_target.cmake index dc55e50..00f180d 100644 --- a/validate_special_target.cmake +++ b/validate_special_target.cmake @@ -4,19 +4,58 @@ # For license and copyright information please follow this link: # https://github.com/desktop-app/legal/blob/master/LEGAL +include(CMakeDependentOption) + set(DESKTOP_APP_SPECIAL_TARGET "" CACHE STRING "Use special platform target, like 'macstore' for Mac App Store.") -set(no_special_target 0) -if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "") - set(no_special_target 1) -endif() -option(DESKTOP_APP_USE_PACKAGED "Find libraries using CMake instead of exact paths." ${no_special_target}) +set(build_macstore 0) +set(build_winstore 0) # 32 or 64 bit +set(build_win64 0) # normal or uwp +set(build_winstore64 0) -set(default_to_qt6 1) if (WIN32) - set(default_to_qt6 0) + if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "win64") + set(build_win64 1) + elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp") + set(build_winstore 1) + elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp64") + set(build_win64 1) + set(build_winstore 1) + set(build_winstore64 1) + elseif (CMAKE_SIZEOF_VOID_P EQUAL 8) + set(build_win64 1) + endif() +elseif (APPLE) + if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "macstore") + set(build_macstore 1) + endif() +else() + if (DESKTOP_APP_SPECIAL_TARGET) + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(CMAKE_AR "gcc-ar") + set(CMAKE_RANLIB "gcc-ranlib") + set(CMAKE_NM "gcc-nm") + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set(CMAKE_AR "llvm-ar") + set(CMAKE_RANLIB "llvm-ranlib") + set(CMAKE_NM "llvm-nm") + endif() + endif() endif() -option(DESKTOP_APP_QT6 "Build with Qt 6" ${default_to_qt6}) + +if (build_win64) + get_filename_component(libs_loc "../Libraries/win64" REALPATH) +else() + get_filename_component(libs_loc "../Libraries" REALPATH) +endif() + +set(libs_loc_exists 0) +if (EXISTS ${libs_loc}) + set(libs_loc_exists 1) +endif() + +cmake_dependent_option(DESKTOP_APP_USE_PACKAGED "Find libraries using CMake instead of exact paths." OFF libs_loc_exists ON) +cmake_dependent_option(DESKTOP_APP_QT6 "Build with Qt 6." ON "NOT WIN32" OFF) function(report_bad_special_target) if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "") diff --git a/variables.cmake b/variables.cmake index 0f4f412..9a201fb 100644 --- a/variables.cmake +++ b/variables.cmake @@ -4,6 +4,8 @@ # For license and copyright information please follow this link: # https://github.com/desktop-app/legal/blob/master/LEGAL +include(CMakeDependentOption) + set(no_special_target 0) if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "") set(no_special_target 1) @@ -18,30 +20,28 @@ if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "" endif() option(DESKTOP_APP_LOTTIE_USE_CACHE "Use caching in lottie animations." ON) -option(DESKTOP_APP_DISABLE_DBUS_INTEGRATION "Disable all code for D-Bus integration (Linux only)." OFF) -option(DESKTOP_APP_DISABLE_X11_INTEGRATION "Disable all code for X11 integration (Linux only)." OFF) -option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code for Wayland integration (Linux only)." OFF) -option(DESKTOP_APP_USE_ALLOCATION_TRACER "Use simple allocation tracer (Linux only)." OFF) -option(DESKTOP_APP_USE_PACKAGED_LAZY "Bundle recommended Qt plugins for self-contained packages. (Linux only)" OFF) +cmake_dependent_option(DESKTOP_APP_DISABLE_DBUS_INTEGRATION "Disable all code for D-Bus integration." OFF LINUX ON) +cmake_dependent_option(DESKTOP_APP_DISABLE_X11_INTEGRATION "Disable all code for X11 integration." OFF LINUX ON) +# QtWaylandScanner cmake integration from Qt 6 is used +cmake_dependent_option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code for Wayland integration." OFF "LINUX; DESKTOP_APP_QT6" ON) +cmake_dependent_option(DESKTOP_APP_USE_ALLOCATION_TRACER "Use simple allocation tracer." OFF LINUX OFF) +cmake_dependent_option(DESKTOP_APP_USE_PACKAGED_LAZY "Bundle recommended Qt plugins for self-contained packages." OFF LINUX OFF) option(DESKTOP_APP_USE_PACKAGED_FONTS "Use preinstalled fonts instead of bundled patched ones." OFF) option(DESKTOP_APP_USE_PACKAGED_RLOTTIE "Find rlottie using CMake instead of bundled patched one." OFF) option(DESKTOP_APP_DISABLE_SPELLCHECK "Disable spellcheck library." OFF) option(DESKTOP_APP_DISABLE_CRASH_REPORTS "Disable crash report generation." ${no_special_target}) option(DESKTOP_APP_DISABLE_AUTOUPDATE "Disable autoupdate." ${disable_autoupdate}) option(DESKTOP_APP_USE_HUNSPELL_ONLY "Disable system spellchecker and use bundled Hunspell only. (For debugging purposes)" OFF) -option(DESKTOP_APP_USE_ENCHANT "Use Enchant instead of bundled Hunspell. (Linux only)" OFF) -option(DESKTOP_APP_NO_PDB "Disable PDB file generation. (Windows only)" OFF) -option(DESKTOP_APP_DISABLE_JEMALLOC "Disable jemalloc, use system malloc (Linux only)." OFF) +cmake_dependent_option(DESKTOP_APP_USE_ENCHANT "Use Enchant instead of bundled Hunspell." OFF LINUX OFF) +cmake_dependent_option(DESKTOP_APP_NO_PDB "Disable PDB file generation." OFF WIN32 OFF) +cmake_dependent_option(DESKTOP_APP_DISABLE_JEMALLOC "Disable jemalloc, use system malloc." OFF LINUX OFF) -if (DESKTOP_APP_USE_PACKAGED AND DEFINED CMAKE_OSX_ARCHITECTURES) - set(DESKTOP_APP_MAC_ARCH "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING "Target macOS arch. (macOS only)") -else() - set(DESKTOP_APP_MAC_ARCH "x86_64;arm64" CACHE STRING "Target macOS arch. (macOS only)") -endif() - -# QtWaylandScanner cmake integration from Qt 6 is used -if (NOT DESKTOP_APP_QT6) - set(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION ON) +if (APPLE) + if (DESKTOP_APP_USE_PACKAGED AND DEFINED CMAKE_OSX_ARCHITECTURES) + set(DESKTOP_APP_MAC_ARCH "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING "Target macOS arch.") + else() + set(DESKTOP_APP_MAC_ARCH "x86_64;arm64" CACHE STRING "Target macOS arch.") + endif() endif() set(add_hunspell_library 0) @@ -51,44 +51,3 @@ if ((WIN32 AND NOT DESKTOP_APP_DISABLE_SPELLCHECK) set(add_hunspell_library 1) endif() - -set(build_macstore 0) -set(build_winstore 0) # 32 or 64 bit -set(build_win64 0) # normal or uwp -set(build_winstore64 0) - -if (WIN32) - if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "win64") - set(build_win64 1) - elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp") - set(build_winstore 1) - elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp64") - set(build_win64 1) - set(build_winstore 1) - set(build_winstore64 1) - elseif (CMAKE_SIZEOF_VOID_P EQUAL 8) - set(build_win64 1) - endif() -elseif (APPLE) - if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "macstore") - set(build_macstore 1) - endif() -else() - if (DESKTOP_APP_SPECIAL_TARGET) - if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(CMAKE_AR "gcc-ar") - set(CMAKE_RANLIB "gcc-ranlib") - set(CMAKE_NM "gcc-nm") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set(CMAKE_AR "llvm-ar") - set(CMAKE_RANLIB "llvm-ranlib") - set(CMAKE_NM "llvm-nm") - endif() - endif() -endif() - -if (build_win64) - get_filename_component(libs_loc "../Libraries/win64" REALPATH) -else() - get_filename_component(libs_loc "../Libraries" REALPATH) -endif() From 1a24c441a83ff1df65b6c29f866fab1fcbeee6a8 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 11 Aug 2022 10:22:31 +0400 Subject: [PATCH 037/215] Fix a warning about using uninitialized variable --- init_target.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/init_target.cmake b/init_target.cmake index 21570d9..abc7922 100644 --- a/init_target.cmake +++ b/init_target.cmake @@ -54,7 +54,9 @@ endfunction() # This code is not supposed to run on build machine, only on target machine. function(init_non_host_target target_name) init_target(${target_name}) - set_target_properties(${target_name} PROPERTIES - OSX_ARCHITECTURES "${DESKTOP_APP_MAC_ARCH}" - ) + if (APPLE) + set_target_properties(${target_name} PROPERTIES + OSX_ARCHITECTURES "${DESKTOP_APP_MAC_ARCH}" + ) + endif() endfunction() From 5cf73fe21b7aa17f056a7b50b54c6f791ded2c5d Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 12 Aug 2022 08:43:08 +0400 Subject: [PATCH 038/215] Restore some symbols in linux_wayland_helper They're used in the upcoming Qt 6.4 --- linux_wayland_helper/linux_wayland_helper.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/linux_wayland_helper/linux_wayland_helper.cpp b/linux_wayland_helper/linux_wayland_helper.cpp index d4ee1a0..4b4a60a 100644 --- a/linux_wayland_helper/linux_wayland_helper.cpp +++ b/linux_wayland_helper/linux_wayland_helper.cpp @@ -72,6 +72,7 @@ int (*wl_display_prepare_read_queue)( int (*wl_display_flush)(struct wl_display *display); void (*wl_display_cancel_read)(struct wl_display *display); int (*wl_display_read_events)(struct wl_display *display); +void (*wl_event_queue_destroy)(struct wl_event_queue *queue); int (*wl_display_prepare_read)(struct wl_display *display); int (*wl_display_dispatch_pending)(struct wl_display *display); struct wl_display *(*wl_display_connect)(const char *name); @@ -79,6 +80,7 @@ void (*wl_display_disconnect)(struct wl_display *display); void *(*wl_proxy_create_wrapper)(void *proxy); void (*wl_proxy_wrapper_destroy)(void *proxy_wrapper); void (*wl_proxy_set_queue)(struct wl_proxy *proxy, struct wl_event_queue *queue); +int (*wl_display_roundtrip)(struct wl_display *display); struct wl_proxy *(*wl_proxy_marshal_array_constructor)( struct wl_proxy *proxy, uint32_t opcode, @@ -236,6 +238,7 @@ bool Resolve() { && LOAD_SYMBOL(client, wl_display_flush) && LOAD_SYMBOL(client, wl_display_cancel_read) && LOAD_SYMBOL(client, wl_display_read_events) + && LOAD_SYMBOL(client, wl_event_queue_destroy) && LOAD_SYMBOL(client, wl_display_prepare_read) && LOAD_SYMBOL(client, wl_display_dispatch_pending) && LOAD_SYMBOL(client, wl_display_connect) @@ -243,6 +246,7 @@ bool Resolve() { && LOAD_SYMBOL(client, wl_proxy_create_wrapper) && LOAD_SYMBOL(client, wl_proxy_wrapper_destroy) && LOAD_SYMBOL(client, wl_proxy_set_queue) + && LOAD_SYMBOL(client, wl_display_roundtrip) && LOAD_SYMBOL(client, wl_proxy_marshal_array_constructor) && LOAD_SYMBOL(client, wl_proxy_marshal_array_constructor_versioned) && LOAD_SYMBOL(client, wl_proxy_get_id) @@ -424,6 +428,12 @@ int wl_display_read_events(struct wl_display *display) { return W::wl_display_read_events(display); } +void wl_event_queue_destroy(struct wl_event_queue *queue) { + Expects(W::wl_event_queue_destroy != nullptr); + + W::wl_event_queue_destroy(queue); +} + int wl_display_prepare_read(struct wl_display *display) { Expects(W::wl_display_prepare_read != nullptr); @@ -470,6 +480,12 @@ void wl_proxy_set_queue( W::wl_proxy_set_queue(proxy, queue); } +int wl_display_roundtrip(struct wl_display *display) { + Expects(W::wl_display_roundtrip != nullptr); + + return W::wl_display_roundtrip(display); +} + struct wl_proxy *wl_proxy_marshal_array_constructor( struct wl_proxy *proxy, uint32_t opcode, From 4b36e4644824b6d0a1d34aaa238c910c49431071 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 13 Aug 2022 04:56:24 +0400 Subject: [PATCH 039/215] Don't depend on Qt::WaylandClient target when linking Wayland libraries --- external/qt/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 5a72731..746a960 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -196,7 +196,7 @@ else() lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Core ) endif() - if (TARGET Qt::WaylandClient) + if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) list(PREPEND qt_libs plugins/platforms/${qt_lib_prefix}qwayland-generic plugins/platforms/${qt_lib_prefix}qwayland-egl @@ -257,7 +257,7 @@ if (LINUX) xcb-render-util xcb-keysyms ) - if (TARGET Qt::WaylandClient) + if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) target_link_libraries(external_qt INTERFACE desktop-app::linux_wayland_helper From 0702ef4cdd8ab888fdadaa4f5b2eb0c9d5844b69 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 14 Aug 2022 09:27:07 +0400 Subject: [PATCH 040/215] Get rid of DESKTOP_APP_QT6 --- external/qt/package.cmake | 15 +++++++-------- options_linux.cmake | 9 +-------- validate_special_target.cmake | 7 +------ variables.cmake | 2 -- 4 files changed, 9 insertions(+), 24 deletions(-) diff --git a/external/qt/package.cmake b/external/qt/package.cmake index bae8405..e982891 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -5,11 +5,7 @@ # https://github.com/desktop-app/legal/blob/master/LEGAL if (NOT DESKTOP_APP_USE_PACKAGED) - if (DESKTOP_APP_QT6) - set(qt_version 6.3.1) - else() - set(qt_version 5.15.4) - endif() + set(qt_version $ENV{QT}) if (WIN32) set(qt_loc ${libs_loc}/Qt-${qt_version}) @@ -22,18 +18,21 @@ if (NOT DESKTOP_APP_USE_PACKAGED) set(CMAKE_PREFIX_PATH ${qt_loc}) endif() -if (DESKTOP_APP_QT6) +if (NOT DEFINED QT_VERSION_MAJOR) find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) -else() - find_package(QT NAMES Qt5 REQUIRED COMPONENTS Core) endif() find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets Network Svg REQUIRED) +set(qt_version_6_or_greater 0) if (QT_VERSION_MAJOR GREATER_EQUAL 6) + set(qt_version_6_or_greater 1) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core5Compat OpenGL OpenGLWidgets REQUIRED) endif() +# QtWaylandScanner cmake integration from Qt 6 is used +cmake_dependent_option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code for Wayland integration." OFF "LINUX; qt_version_6_or_greater" ON) + if (LINUX) if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS WaylandClient REQUIRED) diff --git a/options_linux.cmake b/options_linux.cmake index b46a98a..c915501 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -17,6 +17,7 @@ INTERFACE -Wno-missing-field-initializers -Wno-sign-compare -Wno-deprecated # implicit capture of 'this' via '[=]' is deprecated in C++20 + -Wno-deprecated-declarations # TODO: Remove when there will be no Qt 5 support ) target_compile_definitions(common_options @@ -38,14 +39,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") ) endif() -# TODO: Remove when there will be no Qt 5 support -if (DESKTOP_APP_QT6) - target_compile_options(common_options - INTERFACE - -Wno-deprecated-declarations - ) -endif() - if (DESKTOP_APP_SPECIAL_TARGET) target_compile_options(common_options INTERFACE diff --git a/validate_special_target.cmake b/validate_special_target.cmake index 00f180d..91a9968 100644 --- a/validate_special_target.cmake +++ b/validate_special_target.cmake @@ -55,7 +55,6 @@ if (EXISTS ${libs_loc}) endif() cmake_dependent_option(DESKTOP_APP_USE_PACKAGED "Find libraries using CMake instead of exact paths." OFF libs_loc_exists ON) -cmake_dependent_option(DESKTOP_APP_QT6 "Build with Qt 6." ON "NOT WIN32" OFF) function(report_bad_special_target) if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "") @@ -65,11 +64,7 @@ endfunction() if (NOT DESKTOP_APP_USE_PACKAGED) set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Minimum macOS deployment version" FORCE) - if (DESKTOP_APP_QT6) - set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Target macOS architectures" FORCE) - else() - set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Target macOS architectures" FORCE) - endif() + set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Target macOS architectures" FORCE) endif() if (WIN32) diff --git a/variables.cmake b/variables.cmake index 9a201fb..b867325 100644 --- a/variables.cmake +++ b/variables.cmake @@ -22,8 +22,6 @@ endif() option(DESKTOP_APP_LOTTIE_USE_CACHE "Use caching in lottie animations." ON) cmake_dependent_option(DESKTOP_APP_DISABLE_DBUS_INTEGRATION "Disable all code for D-Bus integration." OFF LINUX ON) cmake_dependent_option(DESKTOP_APP_DISABLE_X11_INTEGRATION "Disable all code for X11 integration." OFF LINUX ON) -# QtWaylandScanner cmake integration from Qt 6 is used -cmake_dependent_option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code for Wayland integration." OFF "LINUX; DESKTOP_APP_QT6" ON) cmake_dependent_option(DESKTOP_APP_USE_ALLOCATION_TRACER "Use simple allocation tracer." OFF LINUX OFF) cmake_dependent_option(DESKTOP_APP_USE_PACKAGED_LAZY "Bundle recommended Qt plugins for self-contained packages." OFF LINUX OFF) option(DESKTOP_APP_USE_PACKAGED_FONTS "Use preinstalled fonts instead of bundled patched ones." OFF) From 6f77ab1f864373dac2a10743a6f7f1e60adf9a3c Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 16 Aug 2022 20:47:09 +0400 Subject: [PATCH 041/215] Cache Qt version --- external/qt/package.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/external/qt/package.cmake b/external/qt/package.cmake index e982891..4723562 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -5,7 +5,13 @@ # https://github.com/desktop-app/legal/blob/master/LEGAL if (NOT DESKTOP_APP_USE_PACKAGED) - set(qt_version $ENV{QT}) + if (DEFINED ENV{QT}) + set(qt_version $ENV{QT} CACHE STRING "Qt version" FORCE) + endif() + + if (NOT DEFINED qt_version) + message(FATAL_ERROR "Qt version is unknown, set `QT' environment variable") + endif() if (WIN32) set(qt_loc ${libs_loc}/Qt-${qt_version}) From 5f980167f72de3118f2baf31474b57c891841f4f Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 22 Aug 2022 03:12:18 +0400 Subject: [PATCH 042/215] Move build_* variable computation back to variables.cmake --- validate_special_target.cmake | 43 +---------------------------------- variables.cmake | 41 +++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/validate_special_target.cmake b/validate_special_target.cmake index 91a9968..37a5e87 100644 --- a/validate_special_target.cmake +++ b/validate_special_target.cmake @@ -8,52 +8,11 @@ include(CMakeDependentOption) set(DESKTOP_APP_SPECIAL_TARGET "" CACHE STRING "Use special platform target, like 'macstore' for Mac App Store.") -set(build_macstore 0) -set(build_winstore 0) # 32 or 64 bit -set(build_win64 0) # normal or uwp -set(build_winstore64 0) - -if (WIN32) - if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "win64") - set(build_win64 1) - elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp") - set(build_winstore 1) - elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp64") - set(build_win64 1) - set(build_winstore 1) - set(build_winstore64 1) - elseif (CMAKE_SIZEOF_VOID_P EQUAL 8) - set(build_win64 1) - endif() -elseif (APPLE) - if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "macstore") - set(build_macstore 1) - endif() -else() - if (DESKTOP_APP_SPECIAL_TARGET) - if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(CMAKE_AR "gcc-ar") - set(CMAKE_RANLIB "gcc-ranlib") - set(CMAKE_NM "gcc-nm") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set(CMAKE_AR "llvm-ar") - set(CMAKE_RANLIB "llvm-ranlib") - set(CMAKE_NM "llvm-nm") - endif() - endif() -endif() - -if (build_win64) - get_filename_component(libs_loc "../Libraries/win64" REALPATH) -else() - get_filename_component(libs_loc "../Libraries" REALPATH) -endif() - +get_filename_component(libs_loc "../Libraries" REALPATH) set(libs_loc_exists 0) if (EXISTS ${libs_loc}) set(libs_loc_exists 1) endif() - cmake_dependent_option(DESKTOP_APP_USE_PACKAGED "Find libraries using CMake instead of exact paths." OFF libs_loc_exists ON) function(report_bad_special_target) diff --git a/variables.cmake b/variables.cmake index b867325..2740fec 100644 --- a/variables.cmake +++ b/variables.cmake @@ -49,3 +49,44 @@ if ((WIN32 AND NOT DESKTOP_APP_DISABLE_SPELLCHECK) set(add_hunspell_library 1) endif() + +set(build_macstore 0) +set(build_winstore 0) # 32 or 64 bit +set(build_win64 0) # normal or uwp +set(build_winstore64 0) + +if (WIN32) + if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "win64") + set(build_win64 1) + elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp") + set(build_winstore 1) + elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp64") + set(build_win64 1) + set(build_winstore 1) + set(build_winstore64 1) + elseif (CMAKE_SIZEOF_VOID_P EQUAL 8) + set(build_win64 1) + endif() +elseif (APPLE) + if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "macstore") + set(build_macstore 1) + endif() +else() + if (DESKTOP_APP_SPECIAL_TARGET) + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(CMAKE_AR "gcc-ar") + set(CMAKE_RANLIB "gcc-ranlib") + set(CMAKE_NM "gcc-nm") + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set(CMAKE_AR "llvm-ar") + set(CMAKE_RANLIB "llvm-ranlib") + set(CMAKE_NM "llvm-nm") + endif() + endif() +endif() + +if (build_win64) + get_filename_component(libs_loc "../Libraries/win64" REALPATH) +else() + get_filename_component(libs_loc "../Libraries" REALPATH) +endif() From 96e9bf770c4267843d2729375f221a53a414909c Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 27 Aug 2022 04:01:29 +0400 Subject: [PATCH 043/215] Add external_kcoreaddons --- external/CMakeLists.txt | 1 + external/kcoreaddons/CMakeLists.txt | 49 +++++++++++++++++++++++++++++ external/kcoreaddons/KUrlMimeData | 26 +++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 external/kcoreaddons/CMakeLists.txt create mode 100644 external/kcoreaddons/KUrlMimeData diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index d27d914..75f608a 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -41,6 +41,7 @@ if (LINUX AND NOT DESKTOP_APP_DISABLE_JEMALLOC) add_checked_subdirectory(jemalloc) endif() add_checked_subdirectory(jpeg) +add_checked_subdirectory(kcoreaddons) add_checked_subdirectory(lz4) add_checked_subdirectory(minizip) if (LINUX) diff --git a/external/kcoreaddons/CMakeLists.txt b/external/kcoreaddons/CMakeLists.txt new file mode 100644 index 0000000..5ef0eb6 --- /dev/null +++ b/external/kcoreaddons/CMakeLists.txt @@ -0,0 +1,49 @@ +# This file is part of Desktop App Toolkit, +# a set of libraries for developing nice desktop applications. +# +# For license and copyright information please follow this link: +# https://github.com/desktop-app/legal/blob/master/LEGAL + +if (NOT LINUX) + add_library(external_kcoreaddons INTERFACE IMPORTED GLOBAL) + add_library(desktop-app::external_kcoreaddons ALIAS external_kcoreaddons) + + target_include_directories(external_kcoreaddons SYSTEM + INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR} + ) + + target_link_libraries(external_kcoreaddons + INTERFACE + desktop-app::external_qt + ) + + return() +endif() + +if (DESKTOP_APP_USE_PACKAGED) + add_library(external_kcoreaddons INTERFACE IMPORTED GLOBAL) + add_library(desktop-app::external_kcoreaddons ALIAS external_kcoreaddons) + + find_package(KF5CoreAddons REQUIRED) + target_link_libraries(external_kcoreaddons INTERFACE KF5:CoreAddons) + return() +endif() + +add_library(external_kcoreaddons STATIC IMPORTED GLOBAL) +add_library(desktop-app::external_kcoreaddons ALIAS external_kcoreaddons) + +find_library(DESKTOP_APP_KCOREADDONS_LIBRARIES libKF5CoreAddons.a) +set_target_properties(external_kcoreaddons PROPERTIES + IMPORTED_LOCATION "${DESKTOP_APP_KCOREADDONS_LIBRARIES}" +) + +target_include_directories(external_kcoreaddons SYSTEM +INTERFACE + /usr/local/include/KF${QT_VERSION_MAJOR}/KCoreAddons +) + +target_link_libraries(external_kcoreaddons +INTERFACE + desktop-app::external_qt +) diff --git a/external/kcoreaddons/KUrlMimeData b/external/kcoreaddons/KUrlMimeData new file mode 100644 index 0000000..23e0485 --- /dev/null +++ b/external/kcoreaddons/KUrlMimeData @@ -0,0 +1,26 @@ +// This file is part of Desktop App Toolkit, +// a set of libraries for developing nice desktop applications. +// +// For license and copyright information please follow this link: +// https://github.com/desktop-app/legal/blob/master/LEGAL +// +#pragma once + +#include + +namespace KUrlMimeData { + +enum DecodeOptions { + PreferLocalUrls, + PreferKdeUrls, +}; + +inline bool exportUrlsToPortal(QMimeData *mimeData) { + return false; +} + +inline auto urlsFromMimeData(const QMimeData *mimeData, ...) { + return mimeData->urls(); +} + +} // namespace KUrlMimeData From 017f5d4e358bbe544526061b51fd550d47ab0754 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 27 Aug 2022 12:11:43 +0400 Subject: [PATCH 044/215] Fix a typo in kcoreaddons target name --- external/kcoreaddons/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/kcoreaddons/CMakeLists.txt b/external/kcoreaddons/CMakeLists.txt index 5ef0eb6..7ed3421 100644 --- a/external/kcoreaddons/CMakeLists.txt +++ b/external/kcoreaddons/CMakeLists.txt @@ -26,7 +26,7 @@ if (DESKTOP_APP_USE_PACKAGED) add_library(desktop-app::external_kcoreaddons ALIAS external_kcoreaddons) find_package(KF5CoreAddons REQUIRED) - target_link_libraries(external_kcoreaddons INTERFACE KF5:CoreAddons) + target_link_libraries(external_kcoreaddons INTERFACE KF5::CoreAddons) return() endif() From 1e0b42d295c80dead04741529eaa37bc38b1e80e Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 23 Aug 2022 17:12:47 +0400 Subject: [PATCH 045/215] Don't set LINK_SEARCH_START_STATIC on targets There's target_link_static_libraries to search static variants of libraries, so having such behavior by default is not something wanted --- init_target.cmake | 3 --- 1 file changed, 3 deletions(-) diff --git a/init_target.cmake b/init_target.cmake index abc7922..d9c0fc5 100644 --- a/init_target.cmake +++ b/init_target.cmake @@ -28,9 +28,6 @@ function(init_target target_name) # init_target(my_target folder_name) MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") endif() target_link_libraries(${target_name} PRIVATE desktop-app::common_options) - if (NOT DESKTOP_APP_USE_PACKAGED) - set_target_properties(${target_name} PROPERTIES LINK_SEARCH_START_STATIC 1) - endif() set_target_properties(${target_name} PROPERTIES XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_WEAK YES XCODE_ATTRIBUTE_GCC_INLINES_ARE_PRIVATE_EXTERN YES From 41ff5e28cd25aa60ded04329bef867748978c538 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 23 Aug 2022 17:13:50 +0400 Subject: [PATCH 046/215] Prepend cache variables for libraries searching with DESKTOP_APP_ To avoid confusion with exports of various cmake packages --- external/dispatch/CMakeLists.txt | 12 ++++++------ external/jpeg/CMakeLists.txt | 4 ++-- external/opus/CMakeLists.txt | 4 ++-- external/qr_code_generator/CMakeLists.txt | 10 +++++----- external/rnnoise/CMakeLists.txt | 4 ++-- external/variant/CMakeLists.txt | 6 +++--- external/vpx/CMakeLists.txt | 4 ++-- external/zlib/CMakeLists.txt | 4 ++-- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/external/dispatch/CMakeLists.txt b/external/dispatch/CMakeLists.txt index b6bba91..316daa9 100644 --- a/external/dispatch/CMakeLists.txt +++ b/external/dispatch/CMakeLists.txt @@ -9,11 +9,11 @@ set(dispatch_prefix ${CMAKE_CURRENT_BINARY_DIR}/dispatch-prefix) set(dispatch_binary_dir ${dispatch_prefix}/src/dispatch-build) if (DESKTOP_APP_USE_PACKAGED) - find_library(DISPATCH_LIBRARIES dispatch) - find_path(DISPATCH_INCLUDE_DIRS dispatch/dispatch.h) + find_library(DESKTOP_APP_DISPATCH_LIBRARIES dispatch) + find_path(DESKTOP_APP_DISPATCH_INCLUDE_DIRS dispatch/dispatch.h) endif() -if (NOT DISPATCH_LIBRARIES OR NOT DISPATCH_INCLUDE_DIRS) +if (NOT DESKTOP_APP_DISPATCH_LIBRARIES OR NOT DESKTOP_APP_DISPATCH_INCLUDE_DIRS) execute_process( COMMAND ${CMAKE_COMMAND} ${dispatch_loc} -B ${dispatch_binary_dir} @@ -41,9 +41,9 @@ endif() add_library(external_dispatch INTERFACE IMPORTED GLOBAL) add_library(desktop-app::external_dispatch ALIAS external_dispatch) -if (DESKTOP_APP_USE_PACKAGED AND DISPATCH_LIBRARIES AND DISPATCH_INCLUDE_DIRS) - target_include_directories(external_dispatch SYSTEM INTERFACE ${DISPATCH_INCLUDE_DIRS}) - target_link_libraries(external_dispatch INTERFACE ${DISPATCH_LIBRARIES}) +if (DESKTOP_APP_USE_PACKAGED AND DESKTOP_APP_DISPATCH_LIBRARIES AND DESKTOP_APP_DISPATCH_INCLUDE_DIRS) + target_include_directories(external_dispatch SYSTEM INTERFACE ${DESKTOP_APP_DISPATCH_INCLUDE_DIRS}) + target_link_libraries(external_dispatch INTERFACE ${DESKTOP_APP_DISPATCH_LIBRARIES}) return() endif() diff --git a/external/jpeg/CMakeLists.txt b/external/jpeg/CMakeLists.txt index f1d3fa4..cfa4c26 100644 --- a/external/jpeg/CMakeLists.txt +++ b/external/jpeg/CMakeLists.txt @@ -28,8 +28,8 @@ elseif (APPLE) IMPORTED_LOCATION ${libs_loc}/local/lib/libjpeg.a ) else() - find_library(JPEG_LIBRARY libjpeg.a REQUIRED) + find_library(DESKTOP_APP_JPEG_LIBRARIES libjpeg.a REQUIRED) set_target_properties(external_jpeg PROPERTIES - IMPORTED_LOCATION "${JPEG_LIBRARY}" + IMPORTED_LOCATION "${DESKTOP_APP_JPEG_LIBRARIES}" ) endif() diff --git a/external/opus/CMakeLists.txt b/external/opus/CMakeLists.txt index c9a7d8e..54da4eb 100644 --- a/external/opus/CMakeLists.txt +++ b/external/opus/CMakeLists.txt @@ -41,8 +41,8 @@ else() INTERFACE /usr/local/include/opus ) - find_library(OPUS_LIBRARY libopus.a REQUIRED) + find_library(DESKTOP_APP_OPUS_LIBRARIES libopus.a REQUIRED) set_target_properties(external_opus PROPERTIES - IMPORTED_LOCATION "${OPUS_LIBRARY}" + IMPORTED_LOCATION "${DESKTOP_APP_OPUS_LIBRARIES}" ) endif() diff --git a/external/qr_code_generator/CMakeLists.txt b/external/qr_code_generator/CMakeLists.txt index f5ca1ef..74dabb1 100644 --- a/external/qr_code_generator/CMakeLists.txt +++ b/external/qr_code_generator/CMakeLists.txt @@ -8,12 +8,12 @@ add_library(external_qr_code_generator INTERFACE IMPORTED GLOBAL) add_library(desktop-app::external_qr_code_generator ALIAS external_qr_code_generator) if (DESKTOP_APP_USE_PACKAGED) - find_library(QRCODE_LIBRARIES NAMES qrcodegencpp) - find_path(QRCODE_INCLUDE_DIRS NAMES qrcodegen.hpp QrCode.hpp PATH_SUFFIXES qrcodegencpp qrcodegen) + find_library(DESKTOP_APP_QRCODE_LIBRARIES NAMES qrcodegencpp) + find_path(DESKTOP_APP_QRCODE_INCLUDE_DIRS NAMES qrcodegen.hpp QrCode.hpp PATH_SUFFIXES qrcodegencpp qrcodegen) - if (QRCODE_LIBRARIES AND QRCODE_INCLUDE_DIRS) - target_include_directories(external_qr_code_generator SYSTEM INTERFACE ${QRCODE_INCLUDE_DIRS}) - target_link_libraries(external_qr_code_generator INTERFACE ${QRCODE_LIBRARIES}) + if (DESKTOP_APP_QRCODE_LIBRARIES AND DESKTOP_APP_QRCODE_INCLUDE_DIRS) + target_include_directories(external_qr_code_generator SYSTEM INTERFACE ${DESKTOP_APP_QRCODE_INCLUDE_DIRS}) + target_link_libraries(external_qr_code_generator INTERFACE ${DESKTOP_APP_QRCODE_LIBRARIES}) return() endif() endif() diff --git a/external/rnnoise/CMakeLists.txt b/external/rnnoise/CMakeLists.txt index 7d68d93..31f2d3a 100644 --- a/external/rnnoise/CMakeLists.txt +++ b/external/rnnoise/CMakeLists.txt @@ -42,8 +42,8 @@ else() INTERFACE /usr/local/include ) - find_library(RNNOISE_LIBRARY librnnoise.a REQUIRED) + find_library(DESKTOP_APP_RNNOISE_LIBRARIES librnnoise.a REQUIRED) set_target_properties(external_rnnoise PROPERTIES - IMPORTED_LOCATION "${RNNOISE_LIBRARY}" + IMPORTED_LOCATION "${DESKTOP_APP_RNNOISE_LIBRARIES}" ) endif() diff --git a/external/variant/CMakeLists.txt b/external/variant/CMakeLists.txt index 910f21c..b4e27fa 100644 --- a/external/variant/CMakeLists.txt +++ b/external/variant/CMakeLists.txt @@ -8,11 +8,11 @@ add_library(external_variant INTERFACE IMPORTED GLOBAL) add_library(desktop-app::external_variant ALIAS external_variant) if (DESKTOP_APP_USE_PACKAGED) - find_path(VARIANT_INCLUDE_DIRS mapbox/variant.hpp) - if (VARIANT_INCLUDE_DIRS) + find_path(DESKTOP_APP_VARIANT_INCLUDE_DIRS mapbox/variant.hpp) + if (DESKTOP_APP_VARIANT_INCLUDE_DIRS) target_include_directories(external_variant SYSTEM INTERFACE - ${VARIANT_INCLUDE_DIRS} + ${DESKTOP_APP_VARIANT_INCLUDE_DIRS} ) return() endif() diff --git a/external/vpx/CMakeLists.txt b/external/vpx/CMakeLists.txt index 2149b3d..39c58b0 100644 --- a/external/vpx/CMakeLists.txt +++ b/external/vpx/CMakeLists.txt @@ -46,8 +46,8 @@ else() INTERFACE /usr/local/include ) - find_library(VPX_LIBRARY libvpx.a REQUIRED) + find_library(DESKTOP_APP_VPX_LIBRARIES libvpx.a REQUIRED) set_target_properties(external_vpx PROPERTIES - IMPORTED_LOCATION "${VPX_LIBRARY}" + IMPORTED_LOCATION "${DESKTOP_APP_VPX_LIBRARIES}" ) endif() diff --git a/external/zlib/CMakeLists.txt b/external/zlib/CMakeLists.txt index 95f58e1..796caa5 100644 --- a/external/zlib/CMakeLists.txt +++ b/external/zlib/CMakeLists.txt @@ -34,8 +34,8 @@ elseif (APPLE) IMPORTED_LOCATION ${libs_loc}/local/lib/libz.a ) else() - find_library(ZLIB_LIBRARY libz.a REQUIRED) + find_library(DESKTOP_APP_ZLIB_LIBRARIES libz.a REQUIRED) set_target_properties(external_zlib PROPERTIES - IMPORTED_LOCATION "${ZLIB_LIBRARY}" + IMPORTED_LOCATION "${DESKTOP_APP_ZLIB_LIBRARIES}" ) endif() From f9b8a354649b6582a4e5e8ed44c3aa38b9d14a08 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 27 Sep 2021 09:24:08 +0400 Subject: [PATCH 047/215] Use zlib built with cmake on Windows --- external/minizip/CMakeLists.txt | 13 +++++-------- external/zlib/CMakeLists.txt | 14 ++++---------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/external/minizip/CMakeLists.txt b/external/minizip/CMakeLists.txt index cf77a71..9936ca3 100644 --- a/external/minizip/CMakeLists.txt +++ b/external/minizip/CMakeLists.txt @@ -17,14 +17,6 @@ if (DESKTOP_APP_USE_PACKAGED) endif() endif() -if (WIN32) - target_include_directories(external_minizip SYSTEM - INTERFACE - ${libs_loc}/zlib/contrib/minizip - ) - return() -endif() - add_library(external_minizip_bundled STATIC) init_target(external_minizip_bundled "(external)") @@ -46,6 +38,11 @@ PUBLIC ${minizip_loc} ) +target_link_libraries(external_minizip_bundled +PRIVATE + desktop-app::external_zlib +) + target_link_libraries(external_minizip INTERFACE external_minizip_bundled diff --git a/external/zlib/CMakeLists.txt b/external/zlib/CMakeLists.txt index 796caa5..ccd4285 100644 --- a/external/zlib/CMakeLists.txt +++ b/external/zlib/CMakeLists.txt @@ -17,17 +17,11 @@ add_library(external_zlib STATIC IMPORTED GLOBAL) add_library(desktop-app::external_zlib ALIAS external_zlib) if (WIN32) - target_compile_definitions(external_zlib INTERFACE ZLIB_WINAPI) - target_include_directories(external_zlib SYSTEM INTERFACE ${libs_loc}/zlib) - if (build_win64) - set(zlib_config_folder x64) - else() - set(zlib_config_folder x86) - endif() - set(zlib_lib_loc ${libs_loc}/zlib/contrib/vstudio/vc14/${zlib_config_folder}) + set(zlib_lib_loc ${libs_loc}/zlib) + target_include_directories(external_zlib SYSTEM INTERFACE ${zlib_lib_loc}) set_target_properties(external_zlib PROPERTIES - IMPORTED_LOCATION "${zlib_lib_loc}/ZlibStatReleaseWithoutAsm/zlibstat.lib" - IMPORTED_LOCATION_DEBUG "${zlib_lib_loc}/ZlibStatDebug/zlibstat.lib" + IMPORTED_LOCATION "${zlib_lib_loc}/Release/zlibstatic.lib" + IMPORTED_LOCATION_DEBUG "${zlib_lib_loc}/Debug/zlibstaticd.lib" ) elseif (APPLE) set_target_properties(external_zlib PROPERTIES From 64202d7765395f7f09d34d5e68f25cacb52bae77 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 26 Aug 2022 11:09:26 +0300 Subject: [PATCH 048/215] Find nuget in the recommended directroy automatically --- nuget.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuget.cmake b/nuget.cmake index f6df582..36e3d50 100644 --- a/nuget.cmake +++ b/nuget.cmake @@ -8,7 +8,7 @@ function(nuget_add_package package_name package package_version) get_property(nuget_exe_defined GLOBAL PROPERTY nuget_exe_path_property SET) if (NOT nuget_exe_defined) # Thanks https://github.com/clarkezone/flutter_win_webview/blob/master/webview_popupauth/windows/CMakeLists.txt - find_program(NUGET_EXE NAMES nuget) + find_program(NUGET_EXE NAMES nuget PATHS "${CMAKE_SOURCE_DIR}/../ThirdParty/NuGet") if (NOT NUGET_EXE) message("NUGET.EXE not found.") message(FATAL_ERROR "Please install this executable, and run CMake again.") From ed89d824871f937b95173a4de38d1efb71a9f5e2 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 27 Aug 2022 23:24:47 +0300 Subject: [PATCH 049/215] Restore ZLIB_WINAPI define --- external/zlib/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/external/zlib/CMakeLists.txt b/external/zlib/CMakeLists.txt index ccd4285..a248d0b 100644 --- a/external/zlib/CMakeLists.txt +++ b/external/zlib/CMakeLists.txt @@ -18,6 +18,7 @@ add_library(desktop-app::external_zlib ALIAS external_zlib) if (WIN32) set(zlib_lib_loc ${libs_loc}/zlib) + target_compile_definitions(external_zlib INTERFACE ZLIB_WINAPI) target_include_directories(external_zlib SYSTEM INTERFACE ${zlib_lib_loc}) set_target_properties(external_zlib PROPERTIES IMPORTED_LOCATION "${zlib_lib_loc}/Release/zlibstatic.lib" From d5190185f74d8f76e610caeb6e45642fca2c177f Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 29 Aug 2022 09:11:17 +0400 Subject: [PATCH 050/215] Update desired d3dcompiler version. --- validate_d3d_compiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validate_d3d_compiler.py b/validate_d3d_compiler.py index 60747f6..40edce9 100644 --- a/validate_d3d_compiler.py +++ b/validate_d3d_compiler.py @@ -25,7 +25,7 @@ if not os.path.exists(inputPath): info = GetFileVersionInfo(inputPath, '\\') version = [ info['FileVersionMS'] // 65536, info['FileVersionMS'] % 65536, info['FileVersionLS'] // 65536, info['FileVersionLS'] % 65536 ] -if (version != [10, 0, 22000, 194]): +if (version != [10, 0, 22000, 832]): error('Bad "d3dcompiler_47.dll" version: ' + '.'.join(str(x) for x in version)) bufferSize = 1024 * 1024 From 7b43684a1caab158ef0b8884c20fe9d1436872ab Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 29 Aug 2022 14:45:53 +0400 Subject: [PATCH 051/215] Add missing REQUIRED to find_library call --- external/kcoreaddons/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/kcoreaddons/CMakeLists.txt b/external/kcoreaddons/CMakeLists.txt index 7ed3421..528a487 100644 --- a/external/kcoreaddons/CMakeLists.txt +++ b/external/kcoreaddons/CMakeLists.txt @@ -33,7 +33,7 @@ endif() add_library(external_kcoreaddons STATIC IMPORTED GLOBAL) add_library(desktop-app::external_kcoreaddons ALIAS external_kcoreaddons) -find_library(DESKTOP_APP_KCOREADDONS_LIBRARIES libKF5CoreAddons.a) +find_library(DESKTOP_APP_KCOREADDONS_LIBRARIES libKF5CoreAddons.a REQUIRED) set_target_properties(external_kcoreaddons PROPERTIES IMPORTED_LOCATION "${DESKTOP_APP_KCOREADDONS_LIBRARIES}" ) From bc8175101806ff2f7f7decd295f43acbbf2807c8 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 1 Sep 2022 15:51:17 +0400 Subject: [PATCH 052/215] Add RHI shader resources for Qt 6.4 --- external/qt/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 746a960..e91240e 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -215,6 +215,7 @@ endif() if (QT_VERSION_MAJOR GREATER_EQUAL 6) list(APPEND qt_libs_list $ + $<$:$> $ $ $ From 0638ec7b0e35d67e8bf68c5f59eefc2d4b823d60 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 1 Sep 2022 16:56:28 +0400 Subject: [PATCH 053/215] WaylandClientPrivate no more --- external/qt/CMakeLists.txt | 16 ---------------- external/qt/package.cmake | 5 ----- 2 files changed, 21 deletions(-) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index e91240e..16f9087 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -23,11 +23,6 @@ if (DESKTOP_APP_USE_PACKAGED) Qt::Network Qt::Svg $ - $ - $ - $ - $ - $ ) return() @@ -44,18 +39,10 @@ INTERFACE $<$:${qt_loc}/include/QtOpenGLWidgets> ${qt_loc}/include/QtSvg $<$:${qt_loc}/include/QtDBus> - $<$:${qt_loc}/include/QtXkbCommonSupport> - $<$:${qt_loc}/include/QtWaylandClient> ${qt_loc}/include/QtCore/${qt_version} ${qt_loc}/include/QtGui/${qt_version} - $<$:${qt_loc}/include/QtXkbCommonSupport/${qt_version}> - $<$:${qt_loc}/include/QtWaylandClient/${qt_version}> - $<$:${qt_loc}/include/QtWaylandGlobal/${qt_version}> ${qt_loc}/include/QtCore/${qt_version}/QtCore ${qt_loc}/include/QtGui/${qt_version}/QtGui - $<$:${qt_loc}/include/QtXkbCommonSupport/${qt_version}/QtXkbCommonSupport> - $<$:${qt_loc}/include/QtWaylandClient/${qt_version}/QtWaylandClient> - $<$:${qt_loc}/include/QtWaylandGlobal/${qt_version}/QtWaylandGlobal> ) target_compile_definitions(external_qt @@ -72,9 +59,6 @@ INTERFACE QT_NETWORK_LIB QT_SVG_LIB $<$:QT_DBUS_LIB> - $<$:QT_XKBCOMMON_SUPPORT_LIB> - $<$:QT_WAYLANDCLIENT_LIB> - $<$:QT_WAYLANDGLOBAL_LIB> ) if (WIN32) diff --git a/external/qt/package.cmake b/external/qt/package.cmake index 4723562..fde6ead 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -42,11 +42,6 @@ cmake_dependent_option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code if (LINUX) if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS WaylandClient REQUIRED) - if (QT_VERSION_MAJOR GREATER_EQUAL 6) - find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS WaylandGlobalPrivate QUIET) - else() - find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS XkbCommonSupport QUIET) - endif() endif() if ((NOT DESKTOP_APP_USE_PACKAGED From b9f1b6036329e44ec61f51f0b363fe2319158b84 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 1 Sep 2022 16:56:33 +0400 Subject: [PATCH 054/215] Fix various spaces on end of lines --- linux_wayland_helper/linux_wayland_helper.cpp | 2 +- target_link_frameworks.cmake | 2 +- validate_d3d_compiler.cmake | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/linux_wayland_helper/linux_wayland_helper.cpp b/linux_wayland_helper/linux_wayland_helper.cpp index 4b4a60a..3c95a3b 100644 --- a/linux_wayland_helper/linux_wayland_helper.cpp +++ b/linux_wayland_helper/linux_wayland_helper.cpp @@ -647,7 +647,7 @@ struct wl_proxy *wl_proxy_marshal_flags( args, interface, version); - + if (flags & WL_MARSHAL_FLAG_DESTROY) { wl_proxy_destroy(proxy); } diff --git a/target_link_frameworks.cmake b/target_link_frameworks.cmake index f5fe9a6..1c03093 100644 --- a/target_link_frameworks.cmake +++ b/target_link_frameworks.cmake @@ -12,7 +12,7 @@ function(target_link_frameworks target_name) set(private_frameworks "") set(public_frameworks "") set(interface_frameworks "") - foreach (entry ${list}) + foreach (entry ${list}) if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") set(writing_now ${entry}) else() diff --git a/validate_d3d_compiler.cmake b/validate_d3d_compiler.cmake index 5330b52..8ebe770 100644 --- a/validate_d3d_compiler.cmake +++ b/validate_d3d_compiler.cmake @@ -21,7 +21,7 @@ function(validate_d3d_compiler target_name) set(modules_hash_loc ${CMAKE_BINARY_DIR}/modules/${modules_subdir}) set(modules_debug_loc ${CMAKE_BINARY_DIR}/Debug/modules/${modules_subdir}) set(modules_release_loc ${CMAKE_BINARY_DIR}/Release/modules/${modules_subdir}) - + set(key_path ${modules_hash_loc}/d3d/d3dcompiler_47) set(module_debug_path ${modules_debug_loc}/d3d) set(module_release_path ${modules_release_loc}/d3d) @@ -39,7 +39,7 @@ function(validate_d3d_compiler target_name) if (NOT "${key_length}" STREQUAL "32" OR NOT EXISTS ${module_debug_path}/d3dcompiler_47.dll OR NOT EXISTS ${module_release_path}/d3dcompiler_47.dll) - + if ("${windows_sdk_loc}" STREQUAL "") validate_d3d_error("Could not find Windows SDK.") return() @@ -66,7 +66,7 @@ function(validate_d3d_compiler target_name) file(MAKE_DIRECTORY ${modules_release_loc}/d3d) file(COPY ${sdk_compiler} DESTINATION ${module_release_path}) - file(MAKE_DIRECTORY ${modules_hash_loc}/d3d) + file(MAKE_DIRECTORY ${modules_hash_loc}/d3d) file(WRITE ${key_path} ${key}) endif() From c79563ea343075d97d30fe3a6598775538676515 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 17 Sep 2022 14:08:03 +0400 Subject: [PATCH 055/215] Add support for AVIF, HEIF and JPEG XL (only on Linux yet) --- external/CMakeLists.txt | 1 + external/kimageformats/CMakeLists.txt | 69 +++++++++++++++++++ external/qt/qt_static_plugins/CMakeLists.txt | 1 + .../qt_static_plugins/qt_static_plugins.cpp | 8 ++- 4 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 external/kimageformats/CMakeLists.txt diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 75f608a..e769380 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -42,6 +42,7 @@ if (LINUX AND NOT DESKTOP_APP_DISABLE_JEMALLOC) endif() add_checked_subdirectory(jpeg) add_checked_subdirectory(kcoreaddons) +add_checked_subdirectory(kimageformats) add_checked_subdirectory(lz4) add_checked_subdirectory(minizip) if (LINUX) diff --git a/external/kimageformats/CMakeLists.txt b/external/kimageformats/CMakeLists.txt new file mode 100644 index 0000000..1e2f261 --- /dev/null +++ b/external/kimageformats/CMakeLists.txt @@ -0,0 +1,69 @@ +# This file is part of Desktop App Toolkit, +# a set of libraries for developing nice desktop applications. +# +# For license and copyright information please follow this link: +# https://github.com/desktop-app/legal/blob/master/LEGAL + +if ((DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY) OR NOT LINUX) # should work on non-Linux, but cmake rules aren't implemented yet + add_library(external_kimageformats INTERFACE IMPORTED GLOBAL) + add_library(desktop-app::external_kimageformats ALIAS external_kimageformats) + return() +endif() + +add_library(external_kimageformats STATIC) +add_library(desktop-app::external_kimageformats ALIAS external_kimageformats) +init_target(external_kimageformats "(external)") + +set(kimageformats_loc ${third_party_loc}/kimageformats) +set(kimageformats_src ${kimageformats_loc}/src/imageformats) + +set_target_properties(external_kimageformats PROPERTIES AUTOMOC ON) + +nice_target_sources(external_kimageformats ${kimageformats_src} +PRIVATE + avif.cpp + heif.cpp + jxl.cpp +) + +target_compile_definitions(external_kimageformats +PRIVATE + QT_STATICPLUGIN + KIMG_JXL_API_VERSION=70 +) + +target_link_libraries(external_kimageformats +PRIVATE + desktop-app::external_qt +) + +if (DESKTOP_APP_USE_PACKAGED) + find_package(libavif REQUIRED) + find_package(PkgConfig REQUIRED) + pkg_check_modules(LIBHEIF REQUIRED IMPORTED_TARGET libheif) + pkg_check_modules(LIBJXL REQUIRED IMPORTED_TARGET libjxl) + pkg_check_modules(LIBJXL_THREADS REQUIRED IMPORTED_TARGET libjxl_threads) + + target_link_libraries(external_kimageformats + PRIVATE + avif + PkgConfig::LIBHEIF + PkgConfig::LIBJXL + PkgConfig::LIBJXL_THREADS + ) +else() + target_link_static_libraries(external_kimageformats + PRIVATE + avif + heif + jxl + jxl_threads + dav1d + libde265 + brotlicommon-static + brotlidec-static + brotlienc-static + hwy + lcms2 + ) +endif() diff --git a/external/qt/qt_static_plugins/CMakeLists.txt b/external/qt/qt_static_plugins/CMakeLists.txt index 7a8651a..ce2fa82 100644 --- a/external/qt/qt_static_plugins/CMakeLists.txt +++ b/external/qt/qt_static_plugins/CMakeLists.txt @@ -16,6 +16,7 @@ PRIVATE target_link_libraries(external_qt_static_plugins PUBLIC desktop-app::external_qt + desktop-app::external_kimageformats ) if (LINUX) diff --git a/external/qt/qt_static_plugins/qt_static_plugins.cpp b/external/qt/qt_static_plugins/qt_static_plugins.cpp index ae0babe..b06abb0 100644 --- a/external/qt/qt_static_plugins/qt_static_plugins.cpp +++ b/external/qt/qt_static_plugins/qt_static_plugins.cpp @@ -54,8 +54,12 @@ Q_IMPORT_PLUGIN(QGtk3ThemePlugin) #endif // Q_OS_WIN | Q_OS_MAC | Q_OS_UNIX #endif // !DESKTOP_APP_USE_PACKAGED -#if defined Q_OS_UNIX && !defined Q_OS_MAC #if !defined DESKTOP_APP_USE_PACKAGED || defined DESKTOP_APP_USE_PACKAGED_LAZY +#if defined Q_OS_UNIX && !defined Q_OS_MAC +Q_IMPORT_PLUGIN(QAVIFPlugin) +Q_IMPORT_PLUGIN(HEIFPlugin) +Q_IMPORT_PLUGIN(QJpegXLPlugin) + Q_IMPORT_PLUGIN(NimfInputContextPlugin) #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin) @@ -66,5 +70,5 @@ Q_IMPORT_PLUGIN(QFcitx5PlatformInputContextPlugin) #ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin) #endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION -#endif // !DESKTOP_APP_USE_PACKAGED || DESKTOP_APP_USE_PACKAGED_LAZY #endif // Q_OS_UNIX && !Q_OS_MAC +#endif // !DESKTOP_APP_USE_PACKAGED || DESKTOP_APP_USE_PACKAGED_LAZY From 152fc28f343aff610f5f9dbdff243bbdbda85bf0 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 19 Sep 2022 06:16:09 +0400 Subject: [PATCH 056/215] Add a shim for KSandbox --- external/kcoreaddons/KSandbox | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 external/kcoreaddons/KSandbox diff --git a/external/kcoreaddons/KSandbox b/external/kcoreaddons/KSandbox new file mode 100644 index 0000000..83c0674 --- /dev/null +++ b/external/kcoreaddons/KSandbox @@ -0,0 +1,23 @@ +// This file is part of Desktop App Toolkit, +// a set of libraries for developing nice desktop applications. +// +// For license and copyright information please follow this link: +// https://github.com/desktop-app/legal/blob/master/LEGAL +// +#pragma once + +namespace KSandbox { + +inline bool isInside() { + return false; +} + +inline bool isFlatpak() { + return false; +} + +inline bool isSnap() { + return false; +} + +} // namespace KSandbox From d405db0737dba6160c770b2029e20e72e8bd824f Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 19 Sep 2022 15:24:26 +0400 Subject: [PATCH 057/215] Fix order of brotlicommon linking --- external/kimageformats/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/kimageformats/CMakeLists.txt b/external/kimageformats/CMakeLists.txt index 1e2f261..f0e7e92 100644 --- a/external/kimageformats/CMakeLists.txt +++ b/external/kimageformats/CMakeLists.txt @@ -60,9 +60,9 @@ else() jxl_threads dav1d libde265 - brotlicommon-static brotlidec-static brotlienc-static + brotlicommon-static hwy lcms2 ) From 6c7b8d8b4c8bfe261f67d48edb4bfd9dbcf3a0d4 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 19 Sep 2022 16:28:05 +0400 Subject: [PATCH 058/215] Link Qt::WidgetsPrivate for touch support in popup windows. --- external/qt/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 16f9087..5d6b5c0 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -19,6 +19,7 @@ if (DESKTOP_APP_USE_PACKAGED) Qt::GuiPrivate $ Qt::Widgets + Qt::WidgetsPrivate $ Qt::Network Qt::Svg @@ -41,8 +42,10 @@ INTERFACE $<$:${qt_loc}/include/QtDBus> ${qt_loc}/include/QtCore/${qt_version} ${qt_loc}/include/QtGui/${qt_version} + ${qt_loc}/include/QtWidgets/${qt_version} ${qt_loc}/include/QtCore/${qt_version}/QtCore ${qt_loc}/include/QtGui/${qt_version}/QtGui + ${qt_loc}/include/QtWidgets/${qt_version}/QtWidgets ) target_compile_definitions(external_qt From 19aa4dd1752bfcda2c80408e78e0811f023a26f7 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 20 Sep 2022 23:31:35 +0400 Subject: [PATCH 059/215] Replace FindThreads with custom logic It doesn't seem to do what we want, unfortunately... --- options_linux.cmake | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/options_linux.cmake b/options_linux.cmake index c915501..7d9f166 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -4,6 +4,8 @@ # For license and copyright information please follow this link: # https://github.com/desktop-app/legal/blob/master/LEGAL +include(CheckCXXCompilerFlag) + target_compile_options(common_options INTERFACE -fstack-protector-all @@ -91,14 +93,15 @@ if (DESKTOP_APP_USE_ALLOCATION_TRACER) ) endif() -if (DESKTOP_APP_USE_PACKAGED) - set(THREADS_PREFER_PTHREAD_FLAG ON) - find_package(Threads REQUIRED) - target_link_libraries(common_options +check_cxx_compiler_flag(-pthread DESKTOP_APP_HAVE_PTHREAD_ARG) +if (DESKTOP_APP_HAVE_PTHREAD_ARG) + target_link_options(common_options INTERFACE - Threads::Threads + -pthread ) -else() +endif() + +if (NOT DESKTOP_APP_USE_PACKAGED) if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") target_link_options(common_options INTERFACE @@ -118,7 +121,6 @@ else() endif() target_link_options(common_options INTERFACE - -pthread -rdynamic -fwhole-program -Wl,-z,relro From 848c16578ed8721d07a28c58fc084f9349f88043 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 21 Sep 2022 08:13:29 +0400 Subject: [PATCH 060/215] Implement target_compile_options_if_exists, target_link_options_if_exists --- options_linux.cmake | 95 +++++++++++--------------- target_compile_options_if_exists.cmake | 45 ++++++++++++ target_link_options_if_exists.cmake | 45 ++++++++++++ 3 files changed, 130 insertions(+), 55 deletions(-) create mode 100644 target_compile_options_if_exists.cmake create mode 100644 target_link_options_if_exists.cmake diff --git a/options_linux.cmake b/options_linux.cmake index 7d9f166..df0bb94 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -4,11 +4,10 @@ # For license and copyright information please follow this link: # https://github.com/desktop-app/legal/blob/master/LEGAL -include(CheckCXXCompilerFlag) - -target_compile_options(common_options +target_compile_options_if_exists(common_options INTERFACE -fstack-protector-all + -fstack-clash-protection -fPIC $,,-fno-strict-aliasing> -pipe @@ -16,6 +15,7 @@ INTERFACE -Wextra -Wno-unused-parameter -Wno-switch + -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-sign-compare -Wno-deprecated # implicit capture of 'this' via '[=]' is deprecated in C++20 @@ -28,18 +28,16 @@ INTERFACE _GLIBCXX_ASSERTIONS ) -target_link_options(common_options +target_link_options_if_exists(common_options INTERFACE + -pthread -Wl,--as-needed ) -if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - target_compile_options(common_options - INTERFACE - -fstack-clash-protection - -Wno-maybe-uninitialized - ) -endif() +target_link_libraries(common_options +INTERFACE + ${CMAKE_DL_LIBS} +) if (DESKTOP_APP_SPECIAL_TARGET) target_compile_options(common_options @@ -57,50 +55,6 @@ if (DESKTOP_APP_SPECIAL_TARGET) target_link_options(common_options INTERFACE $,,-g -flto -fuse-linker-plugin>) endif() -if (NOT DESKTOP_APP_DISABLE_JEMALLOC) - target_link_libraries(common_options - INTERFACE - $ - $ - ) -endif() - -target_link_libraries(common_options -INTERFACE - ${CMAKE_DL_LIBS} -) - -if (DESKTOP_APP_USE_ALLOCATION_TRACER) - target_link_options(common_options - INTERFACE - # -Wl,-wrap,__malloc - -Wl,-wrap,__libc_malloc - -Wl,-wrap,malloc - -Wl,-wrap,valloc - -Wl,-wrap,pvalloc - -Wl,-wrap,calloc - -Wl,-wrap,realloc - -Wl,-wrap,memalign - -Wl,-wrap,aligned_alloc - -Wl,-wrap,posix_memalign - -Wl,-wrap,free - -Wl,--push-state,--no-as-needed,-lrt,--pop-state - ) - target_link_libraries(common_options - INTERFACE - desktop-app::linux_allocation_tracer - $ - ) -endif() - -check_cxx_compiler_flag(-pthread DESKTOP_APP_HAVE_PTHREAD_ARG) -if (DESKTOP_APP_HAVE_PTHREAD_ARG) - target_link_options(common_options - INTERFACE - -pthread - ) -endif() - if (NOT DESKTOP_APP_USE_PACKAGED) if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") target_link_options(common_options @@ -128,3 +82,34 @@ if (NOT DESKTOP_APP_USE_PACKAGED) # -pie # https://gitlab.gnome.org/GNOME/nautilus/-/issues/1601 ) endif() + +if (NOT DESKTOP_APP_DISABLE_JEMALLOC) + target_link_libraries(common_options + INTERFACE + $ + $ + ) +endif() + +if (DESKTOP_APP_USE_ALLOCATION_TRACER) + target_link_options(common_options + INTERFACE + # -Wl,-wrap,__malloc + -Wl,-wrap,__libc_malloc + -Wl,-wrap,malloc + -Wl,-wrap,valloc + -Wl,-wrap,pvalloc + -Wl,-wrap,calloc + -Wl,-wrap,realloc + -Wl,-wrap,memalign + -Wl,-wrap,aligned_alloc + -Wl,-wrap,posix_memalign + -Wl,-wrap,free + -Wl,--push-state,--no-as-needed,-lrt,--pop-state + ) + target_link_libraries(common_options + INTERFACE + desktop-app::linux_allocation_tracer + $ + ) +endif() diff --git a/target_compile_options_if_exists.cmake b/target_compile_options_if_exists.cmake new file mode 100644 index 0000000..9535705 --- /dev/null +++ b/target_compile_options_if_exists.cmake @@ -0,0 +1,45 @@ +# This file is part of Desktop App Toolkit, +# a set of libraries for developing nice desktop applications. +# +# For license and copyright information please follow this link: +# https://github.com/desktop-app/legal/blob/master/LEGAL + +include(CheckCXXCompilerFlag) + +function(target_compile_options_if_exists target_name) + set(list ${ARGV}) + list(REMOVE_AT list 0) + + set(writing_now "") + set(private_options "") + set(public_options "") + set(interface_options "") + foreach (entry ${list}) + if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") + set(writing_now ${entry}) + else() + check_cxx_compiler_flag(${entry} flag_exists) + if (flag_exists) + if ("${writing_now}" STREQUAL "PRIVATE") + list(APPEND private_options ${entry}) + elseif ("${writing_now}" STREQUAL "PUBLIC") + list(APPEND public_options ${entry}) + elseif ("${writing_now}" STREQUAL "INTERFACE") + list(APPEND interface_options ${entry}) + else() + message(FATAL_ERROR "Unknown frameworks scope for target ${target_name}") + endif() + endif() + endif() + endforeach() + + if (NOT "${public_options}" STREQUAL "") + target_compile_options(${target_name} PUBLIC ${public_options}) + endif() + if (NOT "${private_options}" STREQUAL "") + target_compile_options(${target_name} PRIVATE ${private_options}) + endif() + if (NOT "${interface_options}" STREQUAL "") + target_compile_options(${target_name} INTERFACE ${interface_options}) + endif() +endfunction() diff --git a/target_link_options_if_exists.cmake b/target_link_options_if_exists.cmake new file mode 100644 index 0000000..5124b4b --- /dev/null +++ b/target_link_options_if_exists.cmake @@ -0,0 +1,45 @@ +# This file is part of Desktop App Toolkit, +# a set of libraries for developing nice desktop applications. +# +# For license and copyright information please follow this link: +# https://github.com/desktop-app/legal/blob/master/LEGAL + +include(CheckCXXCompilerFlag) + +function(target_link_options_if_exists target_name) + set(list ${ARGV}) + list(REMOVE_AT list 0) + + set(writing_now "") + set(private_options "") + set(public_options "") + set(interface_options "") + foreach (entry ${list}) + if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") + set(writing_now ${entry}) + else() + check_cxx_compiler_flag(${entry} flag_exists) + if (flag_exists) + if ("${writing_now}" STREQUAL "PRIVATE") + list(APPEND private_options ${entry}) + elseif ("${writing_now}" STREQUAL "PUBLIC") + list(APPEND public_options ${entry}) + elseif ("${writing_now}" STREQUAL "INTERFACE") + list(APPEND interface_options ${entry}) + else() + message(FATAL_ERROR "Unknown frameworks scope for target ${target_name}") + endif() + endif() + endif() + endforeach() + + if (NOT "${public_options}" STREQUAL "") + target_link_options(${target_name} PUBLIC ${public_options}) + endif() + if (NOT "${private_options}" STREQUAL "") + target_link_options(${target_name} PRIVATE ${private_options}) + endif() + if (NOT "${interface_options}" STREQUAL "") + target_link_options(${target_name} INTERFACE ${interface_options}) + endif() +endfunction() From f49e254d8c5287752b5ed7b86bd84073f584768e Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 23 Sep 2022 23:24:58 +0400 Subject: [PATCH 061/215] Fix order of libdl linking --- options_linux.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/options_linux.cmake b/options_linux.cmake index df0bb94..a9de719 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -34,11 +34,6 @@ INTERFACE -Wl,--as-needed ) -target_link_libraries(common_options -INTERFACE - ${CMAKE_DL_LIBS} -) - if (DESKTOP_APP_SPECIAL_TARGET) target_compile_options(common_options INTERFACE @@ -113,3 +108,8 @@ if (DESKTOP_APP_USE_ALLOCATION_TRACER) $ ) endif() + +target_link_libraries(common_options +INTERFACE + ${CMAKE_DL_LIBS} +) From 84f43a82524b0fa6ad13f3310f7a38a32f6746f1 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 21 Sep 2022 10:27:14 +0400 Subject: [PATCH 062/215] Build bundled kcoreaddons --- external/kcoreaddons/CMakeLists.txt | 104 ++++++++++++++++++++-------- external/kcoreaddons/KSandbox | 23 ------ external/kcoreaddons/KUrlMimeData | 26 ------- external/qt/package.cmake | 4 +- 4 files changed, 77 insertions(+), 80 deletions(-) delete mode 100644 external/kcoreaddons/KSandbox delete mode 100644 external/kcoreaddons/KUrlMimeData diff --git a/external/kcoreaddons/CMakeLists.txt b/external/kcoreaddons/CMakeLists.txt index 528a487..d693e4d 100644 --- a/external/kcoreaddons/CMakeLists.txt +++ b/external/kcoreaddons/CMakeLists.txt @@ -4,46 +4,94 @@ # For license and copyright information please follow this link: # https://github.com/desktop-app/legal/blob/master/LEGAL -if (NOT LINUX) +if (DESKTOP_APP_USE_PACKAGED AND QT_VERSION_MAJOR EQUAL 5) add_library(external_kcoreaddons INTERFACE IMPORTED GLOBAL) add_library(desktop-app::external_kcoreaddons ALIAS external_kcoreaddons) - target_include_directories(external_kcoreaddons SYSTEM - INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR} - ) - - target_link_libraries(external_kcoreaddons - INTERFACE - desktop-app::external_qt - ) - - return() + find_package(KF5CoreAddons) + if (KF5CoreAddons_FOUND) + target_link_libraries(external_kcoreaddons INTERFACE KF5::CoreAddons) + return() + endif() endif() -if (DESKTOP_APP_USE_PACKAGED) - add_library(external_kcoreaddons INTERFACE IMPORTED GLOBAL) - add_library(desktop-app::external_kcoreaddons ALIAS external_kcoreaddons) - - find_package(KF5CoreAddons REQUIRED) - target_link_libraries(external_kcoreaddons INTERFACE KF5::CoreAddons) - return() -endif() - -add_library(external_kcoreaddons STATIC IMPORTED GLOBAL) +add_library(external_kcoreaddons STATIC) add_library(desktop-app::external_kcoreaddons ALIAS external_kcoreaddons) +init_target(external_kcoreaddons "(external)") -find_library(DESKTOP_APP_KCOREADDONS_LIBRARIES libKF5CoreAddons.a REQUIRED) -set_target_properties(external_kcoreaddons PROPERTIES - IMPORTED_LOCATION "${DESKTOP_APP_KCOREADDONS_LIBRARIES}" +set(kcoreaddons_loc ${third_party_loc}/kcoreaddons) +set(kcoreaddons_src ${kcoreaddons_loc}/src/lib) + +nice_target_sources(external_kcoreaddons ${kcoreaddons_src} +PRIVATE + io/kurlmimedata.cpp + io/kurlmimedata.h + util/ksandbox.cpp + util/ksandbox.h + util/kshell.cpp + util/kshell.h + util/kshell_p.h + util/kshell_unix.cpp + util/kuser.h + util/kuser_unix.cpp +) + +if (NOT LINUX) + remove_target_sources(external_kcoreaddons ${kcoreaddons_src} + util/kshell.cpp + util/kshell.h + util/kshell_p.h + util/kshell_unix.cpp + util/kuser.h + util/kuser_unix.cpp + ) +endif() + +if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) + set_source_files_properties(${kcoreaddons_src}/io/org.freedesktop.portal.FileTransfer.xml PROPERTIES INCLUDE ${kcoreaddons_src}/io/dbustypes_p.h) + qt_add_dbus_interface(_dbus_SRCS ${kcoreaddons_src}/io/org.freedesktop.portal.FileTransfer.xml org.freedesktop.portal.FileTransfer) + + set_source_files_properties(${kcoreaddons_src}/io/org.kde.KIOFuse.VFS.xml PROPERTIES NO_NAMESPACE TRUE) + qt_add_dbus_interface(_dbus_SRCS ${kcoreaddons_src}/io/org.kde.KIOFuse.VFS.xml org.kde.KIOFuse.VFS) + + target_sources(external_kcoreaddons PRIVATE ${_dbus_SRCS}) + + target_compile_definitions(external_kcoreaddons + PRIVATE + HAVE_QTDBUS + ) +endif() + +file(TOUCH + ${CMAKE_CURRENT_BINARY_DIR}/config-util.h + ${CMAKE_CURRENT_BINARY_DIR}/config-kdirwatch.h +) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/include/kcoreaddons_export.h + "#define KCOREADDONS_ENABLE_DEPRECATED_SINCE(major, minor) 0" +) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/kcoreaddons_debug.h + "#pragma once\n#include \nstatic const QLoggingCategory KCOREADDONS_DEBUG(\"kf.coreaddons\");" +) + +target_compile_definitions(external_kcoreaddons +PUBLIC + KCOREADDONS_EXPORT= +PRIVATE + ACCOUNTS_SERVICE_ICON_DIR="/var/lib/AccountsService/icons" ) target_include_directories(external_kcoreaddons SYSTEM -INTERFACE - /usr/local/include/KF${QT_VERSION_MAJOR}/KCoreAddons +PUBLIC + ${kcoreaddons_src}/io + ${kcoreaddons_src}/util + ${CMAKE_CURRENT_BINARY_DIR}/include +PRIVATE + ${CMAKE_CURRENT_BINARY_DIR} ) target_link_libraries(external_kcoreaddons -INTERFACE +PRIVATE desktop-app::external_qt ) diff --git a/external/kcoreaddons/KSandbox b/external/kcoreaddons/KSandbox deleted file mode 100644 index 83c0674..0000000 --- a/external/kcoreaddons/KSandbox +++ /dev/null @@ -1,23 +0,0 @@ -// This file is part of Desktop App Toolkit, -// a set of libraries for developing nice desktop applications. -// -// For license and copyright information please follow this link: -// https://github.com/desktop-app/legal/blob/master/LEGAL -// -#pragma once - -namespace KSandbox { - -inline bool isInside() { - return false; -} - -inline bool isFlatpak() { - return false; -} - -inline bool isSnap() { - return false; -} - -} // namespace KSandbox diff --git a/external/kcoreaddons/KUrlMimeData b/external/kcoreaddons/KUrlMimeData deleted file mode 100644 index 23e0485..0000000 --- a/external/kcoreaddons/KUrlMimeData +++ /dev/null @@ -1,26 +0,0 @@ -// This file is part of Desktop App Toolkit, -// a set of libraries for developing nice desktop applications. -// -// For license and copyright information please follow this link: -// https://github.com/desktop-app/legal/blob/master/LEGAL -// -#pragma once - -#include - -namespace KUrlMimeData { - -enum DecodeOptions { - PreferLocalUrls, - PreferKdeUrls, -}; - -inline bool exportUrlsToPortal(QMimeData *mimeData) { - return false; -} - -inline auto urlsFromMimeData(const QMimeData *mimeData, ...) { - return mimeData->urls(); -} - -} // namespace KUrlMimeData diff --git a/external/qt/package.cmake b/external/qt/package.cmake index fde6ead..2691a34 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -44,9 +44,7 @@ if (LINUX) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS WaylandClient REQUIRED) endif() - if ((NOT DESKTOP_APP_USE_PACKAGED - OR (DESKTOP_APP_USE_PACKAGED AND DESKTOP_APP_USE_PACKAGED_LAZY)) - AND NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) + if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS DBus REQUIRED) elseif (NOT DESKTOP_APP_USE_PACKAGED) find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS DBus QUIET) From 32257877e0a6ce4561896f5ba009b08de4d93ad8 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 30 Sep 2022 03:27:54 +0400 Subject: [PATCH 063/215] Move more compiler options to DESKTOP_APP_SPECIAL_TARGET condition --- options_linux.cmake | 57 ++++++++++++++++++++++----------------------- options_mac.cmake | 25 ++++++++++---------- variables.cmake | 4 ++++ 3 files changed, 44 insertions(+), 42 deletions(-) diff --git a/options_linux.cmake b/options_linux.cmake index a9de719..c266a5a 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -6,28 +6,11 @@ target_compile_options_if_exists(common_options INTERFACE - -fstack-protector-all - -fstack-clash-protection - -fPIC - $,,-fno-strict-aliasing> - -pipe - -Wall - -Wextra - -Wno-unused-parameter - -Wno-switch - -Wno-maybe-uninitialized - -Wno-missing-field-initializers - -Wno-sign-compare + $<$>:-fno-strict-aliasing> -Wno-deprecated # implicit capture of 'this' via '[=]' is deprecated in C++20 -Wno-deprecated-declarations # TODO: Remove when there will be no Qt 5 support ) -target_compile_definitions(common_options -INTERFACE - $,,_FORTIFY_SOURCE=2> - _GLIBCXX_ASSERTIONS -) - target_link_options_if_exists(common_options INTERFACE -pthread @@ -35,19 +18,39 @@ INTERFACE ) if (DESKTOP_APP_SPECIAL_TARGET) - target_compile_options(common_options + target_compile_options_if_exists(common_options INTERFACE - $,,-Ofast> + $<$>:-Ofast> + $<$>:-g> + $<$>:-flto> + -fstack-protector-all + -fstack-clash-protection + -pipe + -Wall -Werror + -Wextra + -Wno-unused-parameter + -Wno-switch + -Wno-maybe-uninitialized + -Wno-missing-field-initializers + -Wno-sign-compare + ) + target_compile_definitions(common_options + INTERFACE + $<$>:_FORTIFY_SOURCE=2> + _GLIBCXX_ASSERTIONS ) - target_link_options(common_options INTERFACE - $,,-Ofast> + $<$>:-Ofast> + $<$>:-g> + $<$>:-flto> + $<$>:-fuse-linker-plugin> + $<$>:-fwhole-program> + -Wl,-z,relro + -Wl,-z,now + # -pie # https://gitlab.gnome.org/GNOME/nautilus/-/issues/1601 ) - - target_compile_options(common_options INTERFACE $,,-g -flto>) - target_link_options(common_options INTERFACE $,,-g -flto -fuse-linker-plugin>) endif() if (NOT DESKTOP_APP_USE_PACKAGED) @@ -71,10 +74,6 @@ if (NOT DESKTOP_APP_USE_PACKAGED) target_link_options(common_options INTERFACE -rdynamic - -fwhole-program - -Wl,-z,relro - -Wl,-z,now - # -pie # https://gitlab.gnome.org/GNOME/nautilus/-/issues/1601 ) endif() diff --git a/options_mac.cmake b/options_mac.cmake index 8da4ab4..3235878 100644 --- a/options_mac.cmake +++ b/options_mac.cmake @@ -20,30 +20,29 @@ endif() target_compile_options(common_options INTERFACE - -pipe - -Wall - -Wextra - -fPIE $<$:-fobjc-weak> -fvisibility-inlines-hidden -fvisibility=hidden -Wno-deprecated-declarations # temp for range-v3 - -Wno-unused-variable - -Wno-unused-parameter - -Wno-unused-function - -Wno-switch - -Wno-comment - -Wno-missing-field-initializers - -Wno-sign-compare - -Wno-unknown-attributes - -Wno-pragma-system-header-outside-header ) if (DESKTOP_APP_SPECIAL_TARGET) target_compile_options(common_options INTERFACE + -pipe -g + -Wall -Werror + -Wextra + -Wno-unused-variable + -Wno-unused-parameter + -Wno-unused-function + -Wno-switch + -Wno-comment + -Wno-missing-field-initializers + -Wno-sign-compare + -Wno-unknown-attributes + -Wno-pragma-system-header-outside-header ) endif() diff --git a/variables.cmake b/variables.cmake index 2740fec..3d317f4 100644 --- a/variables.cmake +++ b/variables.cmake @@ -34,6 +34,10 @@ cmake_dependent_option(DESKTOP_APP_USE_ENCHANT "Use Enchant instead of bundled H cmake_dependent_option(DESKTOP_APP_NO_PDB "Disable PDB file generation." OFF WIN32 OFF) cmake_dependent_option(DESKTOP_APP_DISABLE_JEMALLOC "Disable jemalloc, use system malloc." OFF LINUX OFF) +if (NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) +endif() + if (APPLE) if (DESKTOP_APP_USE_PACKAGED AND DEFINED CMAKE_OSX_ARCHITECTURES) set(DESKTOP_APP_MAC_ARCH "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING "Target macOS arch.") From cd12cb93ead84bd9ada8bdb399964aa3200e91e7 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 30 Sep 2022 11:03:52 +0400 Subject: [PATCH 064/215] Make target_*_options_if_exists actually work --- options_linux.cmake | 7 +++++-- target_compile_options_if_exists.cmake | 5 +++-- target_link_options_if_exists.cmake | 5 +++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/options_linux.cmake b/options_linux.cmake index c266a5a..2fdaafe 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -4,7 +4,7 @@ # For license and copyright information please follow this link: # https://github.com/desktop-app/legal/blob/master/LEGAL -target_compile_options_if_exists(common_options +target_compile_options(common_options INTERFACE $<$>:-fno-strict-aliasing> -Wno-deprecated # implicit capture of 'this' via '[=]' is deprecated in C++20 @@ -18,11 +18,14 @@ INTERFACE ) if (DESKTOP_APP_SPECIAL_TARGET) - target_compile_options_if_exists(common_options + target_compile_options(common_options INTERFACE $<$>:-Ofast> $<$>:-g> $<$>:-flto> + ) + target_compile_options_if_exists(common_options + INTERFACE -fstack-protector-all -fstack-clash-protection -pipe diff --git a/target_compile_options_if_exists.cmake b/target_compile_options_if_exists.cmake index 9535705..4b24ed0 100644 --- a/target_compile_options_if_exists.cmake +++ b/target_compile_options_if_exists.cmake @@ -18,8 +18,9 @@ function(target_compile_options_if_exists target_name) if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") set(writing_now ${entry}) else() - check_cxx_compiler_flag(${entry} flag_exists) - if (flag_exists) + string(MAKE_C_IDENTIFIER ${entry} entry_identifier) + check_cxx_compiler_flag(${entry} DESKTOP_APP_${entry_identifier}_EXISTS) + if (DESKTOP_APP_${entry_identifier}_EXISTS) if ("${writing_now}" STREQUAL "PRIVATE") list(APPEND private_options ${entry}) elseif ("${writing_now}" STREQUAL "PUBLIC") diff --git a/target_link_options_if_exists.cmake b/target_link_options_if_exists.cmake index 5124b4b..ebfad30 100644 --- a/target_link_options_if_exists.cmake +++ b/target_link_options_if_exists.cmake @@ -18,8 +18,9 @@ function(target_link_options_if_exists target_name) if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") set(writing_now ${entry}) else() - check_cxx_compiler_flag(${entry} flag_exists) - if (flag_exists) + string(MAKE_C_IDENTIFIER ${entry} entry_identifier) + check_cxx_compiler_flag(${entry} DESKTOP_APP_${entry_identifier}_EXISTS) + if (DESKTOP_APP_${entry_identifier}_EXISTS) if ("${writing_now}" STREQUAL "PRIVATE") list(APPEND private_options ${entry}) elseif ("${writing_now}" STREQUAL "PUBLIC") From 0d27a76e76142bb25e348a4a38f879385b3235c5 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Fri, 30 Sep 2022 13:56:53 +0300 Subject: [PATCH 065/215] Added ability to set target architecture in non-packaged mode for macOS. --- validate_special_target.cmake | 4 +++- variables.cmake | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/validate_special_target.cmake b/validate_special_target.cmake index 37a5e87..50d2bf5 100644 --- a/validate_special_target.cmake +++ b/validate_special_target.cmake @@ -23,7 +23,9 @@ endfunction() if (NOT DESKTOP_APP_USE_PACKAGED) set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Minimum macOS deployment version" FORCE) - set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Target macOS architectures" FORCE) + if (NOT DEFINED CMAKE_OSX_ARCHITECTURES) + set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Target macOS architectures" FORCE) + endif() endif() if (WIN32) diff --git a/variables.cmake b/variables.cmake index 3d317f4..43cf8fc 100644 --- a/variables.cmake +++ b/variables.cmake @@ -38,8 +38,8 @@ if (NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE) set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() -if (APPLE) - if (DESKTOP_APP_USE_PACKAGED AND DEFINED CMAKE_OSX_ARCHITECTURES) +if (APPLE AND NOT DEFINED DESKTOP_APP_MAC_ARCH) + if (DEFINED CMAKE_OSX_ARCHITECTURES) set(DESKTOP_APP_MAC_ARCH "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING "Target macOS arch.") else() set(DESKTOP_APP_MAC_ARCH "x86_64;arm64" CACHE STRING "Target macOS arch.") From 6f96a685080c4809e23c25525d78dd8f6d2a713b Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 30 Sep 2022 14:25:32 +0400 Subject: [PATCH 066/215] Revert "Move more compiler options to DESKTOP_APP_SPECIAL_TARGET condition" This reverts commit 32257877e0a6ce4561896f5ba009b08de4d93ad8. --- options_linux.cmake | 62 +++++++++++++++++++++++---------------------- options_mac.cmake | 25 +++++++++--------- variables.cmake | 4 --- 3 files changed, 45 insertions(+), 46 deletions(-) diff --git a/options_linux.cmake b/options_linux.cmake index 2fdaafe..0065750 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -6,11 +6,32 @@ target_compile_options(common_options INTERFACE - $<$>:-fno-strict-aliasing> + $,,-fno-strict-aliasing> +) + +target_compile_options_if_exists(common_options +INTERFACE + -fstack-protector-all + -fstack-clash-protection + -fPIC + -pipe + -Wall + -Wextra + -Wno-unused-parameter + -Wno-switch + -Wno-maybe-uninitialized + -Wno-missing-field-initializers + -Wno-sign-compare -Wno-deprecated # implicit capture of 'this' via '[=]' is deprecated in C++20 -Wno-deprecated-declarations # TODO: Remove when there will be no Qt 5 support ) +target_compile_definitions(common_options +INTERFACE + $,,_FORTIFY_SOURCE=2> + _GLIBCXX_ASSERTIONS +) + target_link_options_if_exists(common_options INTERFACE -pthread @@ -20,40 +41,17 @@ INTERFACE if (DESKTOP_APP_SPECIAL_TARGET) target_compile_options(common_options INTERFACE - $<$>:-Ofast> - $<$>:-g> - $<$>:-flto> - ) - target_compile_options_if_exists(common_options - INTERFACE - -fstack-protector-all - -fstack-clash-protection - -pipe - -Wall + $,,-Ofast> -Werror - -Wextra - -Wno-unused-parameter - -Wno-switch - -Wno-maybe-uninitialized - -Wno-missing-field-initializers - -Wno-sign-compare - ) - target_compile_definitions(common_options - INTERFACE - $<$>:_FORTIFY_SOURCE=2> - _GLIBCXX_ASSERTIONS ) + target_link_options(common_options INTERFACE - $<$>:-Ofast> - $<$>:-g> - $<$>:-flto> - $<$>:-fuse-linker-plugin> - $<$>:-fwhole-program> - -Wl,-z,relro - -Wl,-z,now - # -pie # https://gitlab.gnome.org/GNOME/nautilus/-/issues/1601 + $,,-Ofast> ) + + target_compile_options(common_options INTERFACE $,,-g -flto>) + target_link_options(common_options INTERFACE $,,-g -flto -fuse-linker-plugin>) endif() if (NOT DESKTOP_APP_USE_PACKAGED) @@ -77,6 +75,10 @@ if (NOT DESKTOP_APP_USE_PACKAGED) target_link_options(common_options INTERFACE -rdynamic + -fwhole-program + -Wl,-z,relro + -Wl,-z,now + # -pie # https://gitlab.gnome.org/GNOME/nautilus/-/issues/1601 ) endif() diff --git a/options_mac.cmake b/options_mac.cmake index 3235878..8da4ab4 100644 --- a/options_mac.cmake +++ b/options_mac.cmake @@ -20,29 +20,30 @@ endif() target_compile_options(common_options INTERFACE + -pipe + -Wall + -Wextra + -fPIE $<$:-fobjc-weak> -fvisibility-inlines-hidden -fvisibility=hidden -Wno-deprecated-declarations # temp for range-v3 + -Wno-unused-variable + -Wno-unused-parameter + -Wno-unused-function + -Wno-switch + -Wno-comment + -Wno-missing-field-initializers + -Wno-sign-compare + -Wno-unknown-attributes + -Wno-pragma-system-header-outside-header ) if (DESKTOP_APP_SPECIAL_TARGET) target_compile_options(common_options INTERFACE - -pipe -g - -Wall -Werror - -Wextra - -Wno-unused-variable - -Wno-unused-parameter - -Wno-unused-function - -Wno-switch - -Wno-comment - -Wno-missing-field-initializers - -Wno-sign-compare - -Wno-unknown-attributes - -Wno-pragma-system-header-outside-header ) endif() diff --git a/variables.cmake b/variables.cmake index 43cf8fc..dfd652f 100644 --- a/variables.cmake +++ b/variables.cmake @@ -34,10 +34,6 @@ cmake_dependent_option(DESKTOP_APP_USE_ENCHANT "Use Enchant instead of bundled H cmake_dependent_option(DESKTOP_APP_NO_PDB "Disable PDB file generation." OFF WIN32 OFF) cmake_dependent_option(DESKTOP_APP_DISABLE_JEMALLOC "Disable jemalloc, use system malloc." OFF LINUX OFF) -if (NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE) - set(CMAKE_POSITION_INDEPENDENT_CODE ON) -endif() - if (APPLE AND NOT DEFINED DESKTOP_APP_MAC_ARCH) if (DEFINED CMAKE_OSX_ARCHITECTURES) set(DESKTOP_APP_MAC_ARCH "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING "Target macOS arch.") From e8bc7cfd1d8f284ac5bc3addc5dcc7fdd6a93524 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 2 Oct 2022 13:43:38 +0400 Subject: [PATCH 067/215] Don't update kcoreaddons helper headers on every reconfigure --- external/kcoreaddons/CMakeLists.txt | 16 ++-------------- .../headers/private/config-kdirwatch.h | 0 .../kcoreaddons/headers/private/config-util.h | 0 .../headers/private/kcoreaddons_debug.h | 3 +++ .../headers/public/kcoreaddons_export.h | 1 + 5 files changed, 6 insertions(+), 14 deletions(-) create mode 100644 external/kcoreaddons/headers/private/config-kdirwatch.h create mode 100644 external/kcoreaddons/headers/private/config-util.h create mode 100644 external/kcoreaddons/headers/private/kcoreaddons_debug.h create mode 100644 external/kcoreaddons/headers/public/kcoreaddons_export.h diff --git a/external/kcoreaddons/CMakeLists.txt b/external/kcoreaddons/CMakeLists.txt index d693e4d..07514e9 100644 --- a/external/kcoreaddons/CMakeLists.txt +++ b/external/kcoreaddons/CMakeLists.txt @@ -62,19 +62,6 @@ if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) ) endif() -file(TOUCH - ${CMAKE_CURRENT_BINARY_DIR}/config-util.h - ${CMAKE_CURRENT_BINARY_DIR}/config-kdirwatch.h -) - -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/include/kcoreaddons_export.h - "#define KCOREADDONS_ENABLE_DEPRECATED_SINCE(major, minor) 0" -) - -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/kcoreaddons_debug.h - "#pragma once\n#include \nstatic const QLoggingCategory KCOREADDONS_DEBUG(\"kf.coreaddons\");" -) - target_compile_definitions(external_kcoreaddons PUBLIC KCOREADDONS_EXPORT= @@ -86,8 +73,9 @@ target_include_directories(external_kcoreaddons SYSTEM PUBLIC ${kcoreaddons_src}/io ${kcoreaddons_src}/util - ${CMAKE_CURRENT_BINARY_DIR}/include + ${CMAKE_CURRENT_SOURCE_DIR}/headers/public PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/headers/private ${CMAKE_CURRENT_BINARY_DIR} ) diff --git a/external/kcoreaddons/headers/private/config-kdirwatch.h b/external/kcoreaddons/headers/private/config-kdirwatch.h new file mode 100644 index 0000000..e69de29 diff --git a/external/kcoreaddons/headers/private/config-util.h b/external/kcoreaddons/headers/private/config-util.h new file mode 100644 index 0000000..e69de29 diff --git a/external/kcoreaddons/headers/private/kcoreaddons_debug.h b/external/kcoreaddons/headers/private/kcoreaddons_debug.h new file mode 100644 index 0000000..6ffd280 --- /dev/null +++ b/external/kcoreaddons/headers/private/kcoreaddons_debug.h @@ -0,0 +1,3 @@ +#pragma once +#include +static const QLoggingCategory KCOREADDONS_DEBUG("kf.coreaddons"); diff --git a/external/kcoreaddons/headers/public/kcoreaddons_export.h b/external/kcoreaddons/headers/public/kcoreaddons_export.h new file mode 100644 index 0000000..4342bb0 --- /dev/null +++ b/external/kcoreaddons/headers/public/kcoreaddons_export.h @@ -0,0 +1 @@ +#define KCOREADDONS_ENABLE_DEPRECATED_SINCE(major, minor) 0 From 2ba61d5977407eceb8c9ff98b6a5de909a2c97ec Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 22 Oct 2022 01:50:18 +0400 Subject: [PATCH 068/215] Fix default kcoreaddons logging level --- external/kcoreaddons/headers/private/kcoreaddons_debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/kcoreaddons/headers/private/kcoreaddons_debug.h b/external/kcoreaddons/headers/private/kcoreaddons_debug.h index 6ffd280..07f2692 100644 --- a/external/kcoreaddons/headers/private/kcoreaddons_debug.h +++ b/external/kcoreaddons/headers/private/kcoreaddons_debug.h @@ -1,3 +1,3 @@ #pragma once #include -static const QLoggingCategory KCOREADDONS_DEBUG("kf.coreaddons"); +static const QLoggingCategory KCOREADDONS_DEBUG("kf.coreaddons", QtInfoMsg); From bcd5e3a640ff49d4a0add8ce5270e7d5321af8e7 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 7 Aug 2022 04:09:12 +0400 Subject: [PATCH 069/215] Use QtWaylandCompositor for webview embedding on Linux --- external/qt/CMakeLists.txt | 80 ++++++++++++++++++++++++++++++++++++++ external/qt/package.cmake | 2 + 2 files changed, 82 insertions(+) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 5d6b5c0..4a24c49 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -24,6 +24,10 @@ if (DESKTOP_APP_USE_PACKAGED) Qt::Network Qt::Svg $ + $ + $ + $ + $ ) return() @@ -40,6 +44,10 @@ INTERFACE $<$:${qt_loc}/include/QtOpenGLWidgets> ${qt_loc}/include/QtSvg $<$:${qt_loc}/include/QtDBus> + $<$:${qt_loc}/include/QtQml> + $<$:${qt_loc}/include/QtQuick> + $<$:${qt_loc}/include/QtQuickWidgets> + $<$:${qt_loc}/include/QtWaylandCompositor> ${qt_loc}/include/QtCore/${qt_version} ${qt_loc}/include/QtGui/${qt_version} ${qt_loc}/include/QtWidgets/${qt_version} @@ -62,6 +70,10 @@ INTERFACE QT_NETWORK_LIB QT_SVG_LIB $<$:QT_DBUS_LIB> + $<$:QT_QML_LIB> + $<$:QT_QUICK_LIB> + $<$:QT_QUICKWIDGETS_LIB> + $<$:QT_WAYLANDCOMPOSITOR_LIB> ) if (WIN32) @@ -105,6 +117,31 @@ if (TARGET Qt::OpenGLWidgets) ) endif() +if (TARGET Qt::Qml) + list(PREPEND common_qt_libs + qml/QtQml/WorkerScript/${qt_lib_prefix}workerscriptplugin + qml/QtQml/Models/${qt_lib_prefix}modelsplugin + qml/QtQml/${qt_lib_prefix}qmlplugin + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}QmlWorkerScript + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}QmlModels + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Qml + ) +endif() + +if (TARGET Qt::Quick) + list(PREPEND common_qt_libs + qml/QtQuick/Window/${qt_lib_prefix}quickwindowplugin + qml/QtQuick/${qt_lib_prefix}qtquick2plugin + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Quick + ) +endif() + +if (TARGET Qt::QuickWidgets) + list(PREPEND common_qt_libs + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}QuickWidgets + ) +endif() + if (QT_VERSION_MAJOR GREATER_EQUAL 6) list(APPEND common_qt_libs lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}BundledHarfbuzz @@ -194,6 +231,26 @@ else() lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}WaylandClient ) endif() + if (TARGET Qt::WaylandCompositor) + list(PREPEND qt_libs + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}WaylandCompositor + ) + list(APPEND qt_libs_list + $ + ) + if (TARGET Qt::Quick) + list(PREPEND qt_libs + qml/QtWayland/Compositor/${qt_lib_prefix}qwaylandcompositorplugin + qml/QtWayland/Compositor/XdgShell/${qt_lib_prefix}waylandcompositorxdgshellplugin + ) + list(APPEND qt_libs_list + $ + $ + $ + $ + ) + endif() + endif() foreach (lib ${qt_libs}) list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}") endforeach() @@ -207,6 +264,22 @@ if (QT_VERSION_MAJOR GREATER_EQUAL 6) $ $ ) + + if (TARGET Qt::Qml) + list(APPEND qt_libs_list + $ + $ + $ + ) + endif() + + if (TARGET Qt::Quick) + list(APPEND qt_libs_list + $ + $ + $ + ) + endif() endif() target_link_libraries(external_qt @@ -251,6 +324,13 @@ if (LINUX) desktop-app::linux_wayland_helper ) endif() + if (TARGET Qt::WaylandCompositor) + target_link_static_libraries(external_qt + INTERFACE + wayland-server + ffi + ) + endif() target_link_libraries(external_qt INTERFACE desktop-app::linux_xcb_helper diff --git a/external/qt/package.cmake b/external/qt/package.cmake index 2691a34..2faa580 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -29,6 +29,7 @@ if (NOT DEFINED QT_VERSION_MAJOR) endif() find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets Network Svg REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS Qml Quick QuickWidgets QUIET) set(qt_version_6_or_greater 0) if (QT_VERSION_MAJOR GREATER_EQUAL 6) @@ -42,6 +43,7 @@ cmake_dependent_option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code if (LINUX) if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS WaylandClient REQUIRED) + find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS WaylandCompositor QUIET) endif() if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) From 74fbd92f9f4224375050dd18affc33506044ff0c Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 3 Oct 2022 09:00:11 +0400 Subject: [PATCH 070/215] Fix target_prepare_qrc when generator expression evaluates into nothing --- target_prepare_qrc.cmake | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/target_prepare_qrc.cmake b/target_prepare_qrc.cmake index 99ebcd9..2d29c4e 100644 --- a/target_prepare_qrc.cmake +++ b/target_prepare_qrc.cmake @@ -23,13 +23,17 @@ function(target_prepare_qrc target_name) else() set(rcc_flags --binary "$") - set(qrc_files_all "$,INCLUDE,\\.qrc$>") - if (WIN32) - set(qrc_files "$") - elseif (APPLE) - set(qrc_files "$") - elseif (LINUX) - set(qrc_files "$") + set(qrc_files) + get_target_property(list ${target_name} SOURCES) + foreach (entry ${list}) + get_source_file_property(skip_autogen ${entry} SKIP_AUTOGEN) + if (NOT ${entry} MATCHES "\\.qrc$" OR skip_autogen) + continue() + endif() + list(APPEND qrc_files ${entry}) + endforeach() + if (NOT qrc_files) + return() endif() set(rcc_file ${target_name}.rcc) set(rcc_path "${CMAKE_BINARY_DIR}/${rcc_file}") From 3c9814742710b313feea04b0b0cfcd038056a292 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 5 Oct 2022 14:24:09 +0400 Subject: [PATCH 071/215] Set hardening flags only for non-packaged/special target builds --- options_linux.cmake | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/options_linux.cmake b/options_linux.cmake index 0065750..457a79e 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -6,14 +6,8 @@ target_compile_options(common_options INTERFACE - $,,-fno-strict-aliasing> -) - -target_compile_options_if_exists(common_options -INTERFACE - -fstack-protector-all - -fstack-clash-protection -fPIC + $<$>:-fno-strict-aliasing> -pipe -Wall -Wextra @@ -26,12 +20,6 @@ INTERFACE -Wno-deprecated-declarations # TODO: Remove when there will be no Qt 5 support ) -target_compile_definitions(common_options -INTERFACE - $,,_FORTIFY_SOURCE=2> - _GLIBCXX_ASSERTIONS -) - target_link_options_if_exists(common_options INTERFACE -pthread @@ -41,17 +29,16 @@ INTERFACE if (DESKTOP_APP_SPECIAL_TARGET) target_compile_options(common_options INTERFACE - $,,-Ofast> + $<$>:-Ofast> -Werror + $<$>:-g> + $<$>:-flto> ) - target_link_options(common_options INTERFACE - $,,-Ofast> + $<$>:-flto> + $<$>:-fuse-linker-plugin> ) - - target_compile_options(common_options INTERFACE $,,-g -flto>) - target_link_options(common_options INTERFACE $,,-g -flto -fuse-linker-plugin>) endif() if (NOT DESKTOP_APP_USE_PACKAGED) @@ -76,10 +63,26 @@ if (NOT DESKTOP_APP_USE_PACKAGED) INTERFACE -rdynamic -fwhole-program + ) +endif() + +if (NOT DESKTOP_APP_USE_PACKAGED OR DESKTOP_APP_SPECIAL_TARGET) + target_compile_options_if_exists(common_options + INTERFACE + -fstack-protector-all + -fstack-clash-protection + ) + target_link_options(common_options + INTERFACE -Wl,-z,relro -Wl,-z,now # -pie # https://gitlab.gnome.org/GNOME/nautilus/-/issues/1601 ) + target_compile_definitions(common_options + INTERFACE + $<$>:_FORTIFY_SOURCE=2> + _GLIBCXX_ASSERTIONS + ) endif() if (NOT DESKTOP_APP_DISABLE_JEMALLOC) From 700a46e5db552ab1ee61ad52ba45171410b6ec56 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 14 Oct 2022 09:43:02 +0400 Subject: [PATCH 072/215] Fix LTO in debug build --- options_linux.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/options_linux.cmake b/options_linux.cmake index 457a79e..4dd62f0 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -62,7 +62,6 @@ if (NOT DESKTOP_APP_USE_PACKAGED) target_link_options(common_options INTERFACE -rdynamic - -fwhole-program ) endif() @@ -74,6 +73,8 @@ if (NOT DESKTOP_APP_USE_PACKAGED OR DESKTOP_APP_SPECIAL_TARGET) ) target_link_options(common_options INTERFACE + $<$:-fno-use-linker-plugin> + $<$>:-fwhole-program> -Wl,-z,relro -Wl,-z,now # -pie # https://gitlab.gnome.org/GNOME/nautilus/-/issues/1601 From 4294a1872f7193fa4acb39a168812d7a8d1bf96b Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 14 Oct 2022 10:09:33 +0400 Subject: [PATCH 073/215] Silence LTO warnings --- options_linux.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/options_linux.cmake b/options_linux.cmake index 4dd62f0..5a3c7eb 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -22,6 +22,10 @@ INTERFACE target_link_options_if_exists(common_options INTERFACE + -Wno-alloc-size-larger-than # Qt + LTO + -Wno-stringop-overflow # Qt + LTO + -Wno-odr # Qt + LTO + -Wno-inline # OpenAL + LTO -pthread -Wl,--as-needed ) From 36ee4977bbac6d5de4f3c463777a4e0588c661f9 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 5 Oct 2022 14:24:45 +0400 Subject: [PATCH 074/215] Synchronize dispatch and jemalloc build flags with common_options --- external/dispatch/CMakeLists.txt | 21 ++++++++++++++++++++- external/jemalloc/CMakeLists.txt | 4 ++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/external/dispatch/CMakeLists.txt b/external/dispatch/CMakeLists.txt index 316daa9..ccc5782 100644 --- a/external/dispatch/CMakeLists.txt +++ b/external/dispatch/CMakeLists.txt @@ -14,15 +14,34 @@ if (DESKTOP_APP_USE_PACKAGED) endif() if (NOT DESKTOP_APP_DISPATCH_LIBRARIES OR NOT DESKTOP_APP_DISPATCH_INCLUDE_DIRS) + if (DESKTOP_APP_SPECIAL_TARGET) + set(dispatch_extra_args + -DCMAKE_BUILD_TYPE=None + "-DCMAKE_C_FLAGS=-g -Ofast -pipe -fPIC -fstack-protector-all -DNDEBUG -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS" + "-DCMAKE_CXX_FLAGS=-g -Ofast -pipe -fPIC -fstack-protector-all -DNDEBUG -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS" + ) + elseif (NOT DESKTOP_APP_USE_PACKAGED) + set(dispatch_extra_args + -DCMAKE_BUILD_TYPE=Release + "-DCMAKE_C_FLAGS=-pipe -fPIC -fstack-protector-all -D_GLIBCXX_ASSERTIONS" + "-DCMAKE_CXX_FLAGS=-pipe -fPIC -fstack-protector-all -D_GLIBCXX_ASSERTIONS" + ) + elseif (DEFINED CMAKE_BUILD_TYPE) + set(dispatch_extra_args + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + ) + else() + set(dispatch_extra_args) + endif() execute_process( COMMAND ${CMAKE_COMMAND} ${dispatch_loc} -B ${dispatch_binary_dir} -GNinja - -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF + ${dispatch_extra_args} ) execute_process( diff --git a/external/jemalloc/CMakeLists.txt b/external/jemalloc/CMakeLists.txt index f9d2775..a7470a7 100644 --- a/external/jemalloc/CMakeLists.txt +++ b/external/jemalloc/CMakeLists.txt @@ -36,8 +36,8 @@ ExternalProject_Add(jemalloc CONFIGURE_COMMAND env CC=clang CXX=clang++ - "EXTRA_CFLAGS=-fstack-protector-all -D_FORTIFY_SOURCE=2" - "EXTRA_CXXFLAGS=-fstack-protector-all -D_FORTIFY_SOURCE=2" + "$>,$>,EXTRA_CFLAGS=$<$:-Ofast> -fstack-protector-all -DNDEBUG -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS,=>" + "$>,$>,EXTRA_CXXFLAGS=$<$:-Ofast> -fstack-protector-all -DNDEBUG -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS,=>" ./autogen.sh --disable-shared BUILD_IN_SOURCE 1 STEP_TARGETS build From a3afeeac0ef0d239d2748df985e94b6f270252a8 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 3 Nov 2022 13:34:50 +0400 Subject: [PATCH 075/215] Parallelize LTO on Linux --- options_linux.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/options_linux.cmake b/options_linux.cmake index 5a3c7eb..f0d9a52 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -36,11 +36,11 @@ if (DESKTOP_APP_SPECIAL_TARGET) $<$>:-Ofast> -Werror $<$>:-g> - $<$>:-flto> + $<$>:-flto=auto> ) target_link_options(common_options INTERFACE - $<$>:-flto> + $<$>:-flto=auto> $<$>:-fuse-linker-plugin> ) endif() From cc8fc487d7d6fbe0704753d35b7043bf0bed4549 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 3 Nov 2022 13:36:16 +0400 Subject: [PATCH 076/215] Switch to the new glibmm ABI --- external/glibmm/CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/external/glibmm/CMakeLists.txt b/external/glibmm/CMakeLists.txt index d9d2ce7..72dba09 100644 --- a/external/glibmm/CMakeLists.txt +++ b/external/glibmm/CMakeLists.txt @@ -8,8 +8,8 @@ add_library(external_glibmm INTERFACE IMPORTED GLOBAL) add_library(desktop-app::external_glibmm ALIAS external_glibmm) find_package(PkgConfig REQUIRED) -pkg_check_modules(GLIBMM REQUIRED IMPORTED_TARGET glibmm-2.4) -pkg_check_modules(GIOMM REQUIRED IMPORTED_TARGET giomm-2.4) +pkg_check_modules(GLIBMM REQUIRED IMPORTED_TARGET glibmm-2.68) +pkg_check_modules(GIOMM REQUIRED IMPORTED_TARGET giomm-2.68) if (DESKTOP_APP_USE_PACKAGED) target_link_libraries(external_glibmm @@ -26,9 +26,9 @@ else() target_link_static_libraries(external_glibmm INTERFACE - giomm-2.4 - glibmm-2.4 - sigc-2.0 + giomm-2.68 + glibmm-2.68 + sigc-3.0 ) target_link_libraries(external_glibmm From 5723b4f274ace2b4660b4155e06ceda7e85bff3e Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 8 Nov 2022 21:45:59 +0400 Subject: [PATCH 077/215] Fix conditions for LTO-related options on Linux Currently LTO seem to be always active even when it's not meant to and LTO seem to be broken in debug build. --- options_linux.cmake | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/options_linux.cmake b/options_linux.cmake index f0d9a52..a65e803 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -41,7 +41,7 @@ if (DESKTOP_APP_SPECIAL_TARGET) target_link_options(common_options INTERFACE $<$>:-flto=auto> - $<$>:-fuse-linker-plugin> + $<$>:-fwhole-program> ) endif() @@ -63,6 +63,17 @@ if (NOT DESKTOP_APP_USE_PACKAGED) -nostdlib++ ) endif() + if (CMAKE_INTERPROCEDURAL_OPTIMIZATION) + target_link_options(common_options + INTERFACE + -fwhole-program + ) + elseif (NOT DESKTOP_APP_SPECIAL_TARGET) + target_link_options(common_options + INTERFACE + -fno-use-linker-plugin + ) + endif() target_link_options(common_options INTERFACE -rdynamic @@ -77,8 +88,6 @@ if (NOT DESKTOP_APP_USE_PACKAGED OR DESKTOP_APP_SPECIAL_TARGET) ) target_link_options(common_options INTERFACE - $<$:-fno-use-linker-plugin> - $<$>:-fwhole-program> -Wl,-z,relro -Wl,-z,now # -pie # https://gitlab.gnome.org/GNOME/nautilus/-/issues/1601 From d41ce7f553f034f54d0e87643ddfee6d585b6b63 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 15 Nov 2022 00:25:02 +0400 Subject: [PATCH 078/215] Inherit per-config INTERPROCEDURAL_OPTIMIZATION options This also fixes the missing -fno-use-linker-plugin in Debug configuration with DESKTOP_APP_SPECIAL_TARGET since the last change --- options_linux.cmake | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/options_linux.cmake b/options_linux.cmake index a65e803..33817d2 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -63,19 +63,11 @@ if (NOT DESKTOP_APP_USE_PACKAGED) -nostdlib++ ) endif() - if (CMAKE_INTERPROCEDURAL_OPTIMIZATION) - target_link_options(common_options - INTERFACE - -fwhole-program - ) - elseif (NOT DESKTOP_APP_SPECIAL_TARGET) - target_link_options(common_options - INTERFACE - -fno-use-linker-plugin - ) - endif() + set(interprocedural_optimization_config $>>) + set(interprocedural_optimization_values -fwhole-program,$,$<$:-fno-use-linker-plugin>,-fno-use-linker-plugin>) target_link_options(common_options INTERFACE + $>,$,${interprocedural_optimization_values}>,$>,${interprocedural_optimization_values}>> -rdynamic ) endif() From 07ed08bf940fe4293132cbd47d4267aba9df11bf Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 17 Nov 2022 20:16:44 +0300 Subject: [PATCH 079/215] Added NaturalLanguage framework on macOS. --- options_mac.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/options_mac.cmake b/options_mac.cmake index 8da4ab4..afab1c7 100644 --- a/options_mac.cmake +++ b/options_mac.cmake @@ -84,4 +84,5 @@ INTERFACE MediaPlayer IOSurface Metal + NaturalLanguage ) From 5727743f9a3d3f01b275eb77f39e7a24b9671c4d Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 17 Nov 2022 20:18:43 +0300 Subject: [PATCH 080/215] Added external cld3 module. --- external/CMakeLists.txt | 3 + external/cld3/CMakeLists.txt | 100 ++++++++++++++++++++++++++ external/cld3/generate_protobuf.cmake | 59 +++++++++++++++ variables.cmake | 6 ++ 4 files changed, 168 insertions(+) create mode 100644 external/cld3/CMakeLists.txt create mode 100644 external/cld3/generate_protobuf.cmake diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index e769380..30282f0 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -36,6 +36,9 @@ endif() if (add_hunspell_library) add_checked_subdirectory(hunspell) endif() +if (add_cld3_library) + add_checked_subdirectory(cld3) +endif() add_checked_subdirectory(iconv) if (LINUX AND NOT DESKTOP_APP_DISABLE_JEMALLOC) add_checked_subdirectory(jemalloc) diff --git a/external/cld3/CMakeLists.txt b/external/cld3/CMakeLists.txt new file mode 100644 index 0000000..91d50ab --- /dev/null +++ b/external/cld3/CMakeLists.txt @@ -0,0 +1,100 @@ +# This file is part of Desktop App Toolkit, +# a set of libraries for developing nice desktop applications. +# +# For license and copyright information please follow this link: +# https://github.com/desktop-app/legal/blob/master/LEGAL + +add_library(external_cld3 INTERFACE IMPORTED GLOBAL) +add_library(desktop-app::external_cld3 ALIAS external_cld3) + +if (DESKTOP_APP_USE_PACKAGED) + # find_package(Protobuf REQUIRED) +endif() + +add_library(external_cld3_bundled STATIC) +init_target(external_cld3_bundled "(external)") + +set(cld3_loc ${third_party_loc}/cld3) +set(cld3_src ${cld3_loc}/src) + +set(gen_loc ${cld3_loc}/build/gen) +set(gen_dst ${gen_loc}/cld_3/protos) + +if (WIN32) + set(build_loc ${libs_loc}/protobuf/build/$,Debug,Release>) + set(protoc_executable ${build_loc}/protoc.exe) + set(protobuf_lib ${build_loc}/libprotobuf-lite.lib) +else() + set(protoc_executable ${libs_loc}/protobuf/build/protoc) + set(protobuf_lib ${libs_loc}/protobuf/build/libprotobuf-lite.a) + if (LINUX) + target_compile_options(external_cld3_bundled PRIVATE -Wno-implicit-fallthrough) + endif() +endif() +if (PROTOBUF_PROTOC_EXECUTABLE) + set(protoc_executable ${PROTOBUF_PROTOC_EXECUTABLE}) +endif() + +include(generate_protobuf.cmake) + +function(generate protobuf_name) + generate_single_protobuf( + external_cld3_bundled + ${gen_dst} + ${protobuf_name} + ${protoc_executable}) +endfunction() + +generate(feature_extractor.proto) +generate(sentence.proto) +generate(task_spec.proto) + +nice_target_sources(external_cld3_bundled ${cld3_src} +PRIVATE + feature_extractor.proto + sentence.proto + task_spec.proto + + base.cc + embedding_feature_extractor.cc + embedding_network.cc + feature_extractor.cc + feature_extractor.h + feature_types.cc + fml_parser.cc + language_identifier_features.cc + lang_id_nn_params.cc + nnet_language_identifier.cc + registry.cc + relevant_script_feature.cc + sentence_features.cc + task_context.cc + task_context_params.cc + unicodetext.cc + utils.cc + workspace.cc + + script_span/generated_entities.cc + script_span/getonescriptspan.cc + script_span/getonescriptspan.h + script_span/getonescriptspan_test.cc + script_span/utf8statetable.cc + script_span/offsetmap.cc + script_span/text_processing.cc + script_span/text_processing.h + script_span/fixunicodevalue.cc +) + +target_include_directories(external_cld3_bundled +PUBLIC + ${cld3_src} + ${gen_loc} + ${libs_loc}/protobuf/src + ${libs_loc}/protobuf/third_party/abseil-cpp +) + +target_link_libraries(external_cld3 +INTERFACE + external_cld3_bundled + ${protobuf_lib} +) diff --git a/external/cld3/generate_protobuf.cmake b/external/cld3/generate_protobuf.cmake new file mode 100644 index 0000000..4a8ae1e --- /dev/null +++ b/external/cld3/generate_protobuf.cmake @@ -0,0 +1,59 @@ +function(generate_single_protobuf target_name gen_dst protobuf_name executable) + file(MAKE_DIRECTORY ${gen_dst}) + + # Copied from myprotobuf.cmake. + if (PROTOBUF_GENERATE_CPP_APPEND_PATH) + # Create an include path for each file specified + set(FIL ${cld3_src}/${protobuf_name}) + get_filename_component(ABS_FIL ${FIL} ABSOLUTE) + get_filename_component(ABS_PATH ${ABS_FIL} PATH) + list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) + if (${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${ABS_PATH}) + endif() + else() + set(_protobuf_include_path -I ${cld3_src}) + endif() + + if (DEFINED PROTOBUF_IMPORT_DIRS) + foreach (DIR ${PROTOBUF_IMPORT_DIRS}) + get_filename_component(ABS_PATH ${DIR} ABSOLUTE) + list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) + if (${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${ABS_PATH}) + endif() + endforeach() + endif() + # + + get_filename_component(protobuf_name_we ${protobuf_name} NAME_WE) + + set(gen_timestamp ${gen_dst}/${protobuf_name}.timestamp) + set(gen_files + ${gen_dst}/${protobuf_name_we}.pb.cc + ${gen_dst}/${protobuf_name_we}.pb.h + ) + + # Fix warning MSB8065. + set_source_files_properties(${gen_timestamp} PROPERTIES SYMBOLIC 1) + + set(gen_src ${cld3_src}/${protobuf_name}) + add_custom_command( + OUTPUT + ${gen_timestamp} + BYPRODUCTS + ${gen_files} + COMMAND + ${executable} + --cpp_out + ${gen_dst} + ${_protobuf_include_path} + ${gen_src} + COMMENT "Generating protobuf ${protobuf_name} (${target_name})" + DEPENDS + ${executable} + ${gen_src} + VERBATIM + ) + generate_target(${target_name} ${protobuf_name} ${gen_timestamp} "${gen_files}" ${gen_dst}) +endfunction() diff --git a/variables.cmake b/variables.cmake index dfd652f..91b7027 100644 --- a/variables.cmake +++ b/variables.cmake @@ -31,6 +31,7 @@ option(DESKTOP_APP_DISABLE_CRASH_REPORTS "Disable crash report generation." ${no option(DESKTOP_APP_DISABLE_AUTOUPDATE "Disable autoupdate." ${disable_autoupdate}) option(DESKTOP_APP_USE_HUNSPELL_ONLY "Disable system spellchecker and use bundled Hunspell only. (For debugging purposes)" OFF) cmake_dependent_option(DESKTOP_APP_USE_ENCHANT "Use Enchant instead of bundled Hunspell." OFF LINUX OFF) +cmake_dependent_option(DESKTOP_APP_USE_CLD3 "Disable system text language recognition and use bundled cld3 only." OFF APPLE ON) cmake_dependent_option(DESKTOP_APP_NO_PDB "Disable PDB file generation." OFF WIN32 OFF) cmake_dependent_option(DESKTOP_APP_DISABLE_JEMALLOC "Disable jemalloc, use system malloc." OFF LINUX OFF) @@ -50,6 +51,11 @@ if ((WIN32 set(add_hunspell_library 1) endif() +set(add_cld3_library 0) +if (LINUX OR DESKTOP_APP_USE_CLD3) + set(add_cld3_library 1) +endif() + set(build_macstore 0) set(build_winstore 0) # 32 or 64 bit set(build_win64 0) # normal or uwp From 2c341a0d3e27f7b322301104573945abd0019f27 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 23 Nov 2022 10:06:52 +0100 Subject: [PATCH 081/215] Return LTCG for Windows 32 bit build. --- init_target.cmake | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/init_target.cmake b/init_target.cmake index d9c0fc5..8b97a2e 100644 --- a/init_target.cmake +++ b/init_target.cmake @@ -40,11 +40,9 @@ function(init_target target_name) # init_target(my_target folder_name) ) endif() if (DESKTOP_APP_SPECIAL_TARGET AND WIN32 AND NOT build_win64) - set_target_properties(${target_name} PROPERTIES - INTERPROCEDURAL_OPTIMIZATION_RELEASE True - INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO True - INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL True - ) + target_compile_options(${target_name} PRIVATE /GL) + target_link_options(${target_name} PRIVATE /LTCG) + set_property(TARGET ${target_name} APPEND_STRING PROPERTY STATIC_LIBRARY_OPTIONS "/LTCG") endif() endfunction() From 81705fb6095ec3aa74ef900a1a181c0d586447d8 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 23 Nov 2022 07:16:00 +0400 Subject: [PATCH 082/215] Add external_sonnet library --- external/CMakeLists.txt | 9 +- external/hunspell/CMakeLists.txt | 1 + external/sonnet/CMakeLists.txt | 110 ++++++++++++++++++ external/sonnet/generate_trigrams.cmake | 23 ++++ .../sonnet/headers/private/config-hunspell.h | 0 external/sonnet/headers/private/core_debug.h | 3 + .../sonnet/headers/private/hunspelldebug.h | 3 + .../headers/private/nsspellcheckerdebug.h | 3 + .../sonnet/headers/public/sonnetcore_export.h | 0 variables.cmake | 22 +++- 10 files changed, 169 insertions(+), 5 deletions(-) create mode 100644 external/sonnet/CMakeLists.txt create mode 100644 external/sonnet/generate_trigrams.cmake create mode 100644 external/sonnet/headers/private/config-hunspell.h create mode 100644 external/sonnet/headers/private/core_debug.h create mode 100644 external/sonnet/headers/private/hunspelldebug.h create mode 100644 external/sonnet/headers/private/nsspellcheckerdebug.h create mode 100644 external/sonnet/headers/public/sonnetcore_export.h diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 30282f0..3e680ad 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -13,6 +13,9 @@ endmacro() add_checked_subdirectory(angle) add_checked_subdirectory(auto_updates) +if (add_cld3_library) + add_checked_subdirectory(cld3) +endif() add_checked_subdirectory(crash_reports) if (LINUX) add_checked_subdirectory(dispatch) @@ -36,9 +39,6 @@ endif() if (add_hunspell_library) add_checked_subdirectory(hunspell) endif() -if (add_cld3_library) - add_checked_subdirectory(cld3) -endif() add_checked_subdirectory(iconv) if (LINUX AND NOT DESKTOP_APP_DISABLE_JEMALLOC) add_checked_subdirectory(jemalloc) @@ -59,6 +59,9 @@ add_checked_subdirectory(qr_code_generator) add_checked_subdirectory(ranges) add_checked_subdirectory(rlottie) add_checked_subdirectory(rnnoise) +if (add_sonnet_library) + add_checked_subdirectory(sonnet) +endif() add_checked_subdirectory(ton) add_checked_subdirectory(variant) add_checked_subdirectory(vpx) diff --git a/external/hunspell/CMakeLists.txt b/external/hunspell/CMakeLists.txt index eac7373..aad7dbc 100644 --- a/external/hunspell/CMakeLists.txt +++ b/external/hunspell/CMakeLists.txt @@ -56,6 +56,7 @@ PRIVATE target_include_directories(external_hunspell_bundled PUBLIC ${hunspell_src} + ${hunspell_src}/hunspell ) target_compile_definitions(external_hunspell_bundled diff --git a/external/sonnet/CMakeLists.txt b/external/sonnet/CMakeLists.txt new file mode 100644 index 0000000..e9dfbc5 --- /dev/null +++ b/external/sonnet/CMakeLists.txt @@ -0,0 +1,110 @@ +# This file is part of Desktop App Toolkit, +# a set of libraries for developing nice desktop applications. +# +# For license and copyright information please follow this link: +# https://github.com/desktop-app/legal/blob/master/LEGAL + +if (DESKTOP_APP_USE_PACKAGED AND QT_VERSION_MAJOR EQUAL 5) + add_library(external_sonnet INTERFACE IMPORTED GLOBAL) + add_library(desktop-app::external_sonnet ALIAS external_sonnet) + + find_package(KF5Sonnet) + if (KF5Sonnet_FOUND) + target_link_libraries(external_sonnet INTERFACE KF5::SonnetCore) + return() + endif() +endif() + +add_library(external_sonnet STATIC) +add_library(desktop-app::external_sonnet ALIAS external_sonnet) +init_target(external_sonnet "(external)") + +set(sonnet_loc ${third_party_loc}/sonnet) +set(sonnet_data_loc ${sonnet_loc}/data) +set(sonnet_core_src ${sonnet_loc}/src/core) +set(sonnet_plugins_src ${sonnet_loc}/src/plugins) + +set_target_properties(external_sonnet PROPERTIES AUTOMOC ON) + +configure_file(${sonnet_data_loc}/trigrams.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/trigrams.qrc @ONLY) +target_sources(external_sonnet PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/trigrams.qrc) + +nice_target_sources(external_sonnet ${sonnet_core_src} +PRIVATE + client.cpp + client_p.h + guesslanguage.cpp + guesslanguage.h + loader.cpp + loader_p.h + settings.cpp + settings.h + settingsimpl.cpp + settingsimpl_p.h + speller.cpp + speller.h + spellerplugin.cpp + spellerplugin_p.h + textbreaks.cpp + textbreaks_p.h + tokenizer.cpp + tokenizer_p.h +) + +nice_target_sources(external_sonnet ${sonnet_plugins_src}/hunspell +PRIVATE + hunspellclient.cpp + hunspellclient.h + hunspelldict.cpp + hunspelldict.h +) + +if (APPLE) + nice_target_sources(external_sonnet ${sonnet_plugins_src}/nsspellchecker + PRIVATE + nsspellcheckerclient.cpp + nsspellcheckerclient.h + nsspellcheckerdict.cpp + nsspellcheckerdict.h + ) +endif() + +target_compile_definitions(external_sonnet +PUBLIC + SONNETCORE_EXPORT= + SONNET_STATIC +PRIVATE + QT_USE_QSTRINGBUILDER +) + +target_include_directories(external_sonnet SYSTEM +PUBLIC + ${sonnet_core_src} + ${CMAKE_CURRENT_SOURCE_DIR}/headers/public +PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/headers/private +) + +target_link_libraries(external_sonnet +PRIVATE + desktop-app::external_qt + desktop-app::external_hunspell +) + +target_prepare_qrc(external_sonnet) + +add_executable(external_sonnet_parsetrigrams) +init_target(external_sonnet_parsetrigrams "(external)") + +nice_target_sources(external_sonnet_parsetrigrams ${sonnet_data_loc} +PRIVATE + parsetrigrams.cpp +) + +target_link_libraries(external_sonnet_parsetrigrams +PRIVATE + desktop-app::external_qt +) + +include(generate_trigrams.cmake) +generate_trigrams(external_sonnet ${sonnet_data_loc}/trigrams) diff --git a/external/sonnet/generate_trigrams.cmake b/external/sonnet/generate_trigrams.cmake new file mode 100644 index 0000000..f6fe28d --- /dev/null +++ b/external/sonnet/generate_trigrams.cmake @@ -0,0 +1,23 @@ +function(generate_trigrams target_name trigrams_file) + set(gen_dst ${CMAKE_BINARY_DIR}/data) + file(MAKE_DIRECTORY ${gen_dst}) + + set(gen_timestamp ${gen_dst}/${target_name}_trigrams.timestamp) + set(gen_files ${gen_dst}/trigrams.map) + + add_custom_command( + OUTPUT + ${gen_timestamp} + BYPRODUCTS + ${gen_files} + COMMAND + external_sonnet_parsetrigrams "${trigrams_file}" > "${gen_files}" + COMMAND + echo 1> ${gen_timestamp} + COMMENT "Generating trigrams (${target_name})" + DEPENDS + external_sonnet_parsetrigrams + ${trigrams_file} + ) + generate_target(${target_name} trigrams ${gen_timestamp} "${gen_files}" ${gen_dst}) +endfunction() diff --git a/external/sonnet/headers/private/config-hunspell.h b/external/sonnet/headers/private/config-hunspell.h new file mode 100644 index 0000000..e69de29 diff --git a/external/sonnet/headers/private/core_debug.h b/external/sonnet/headers/private/core_debug.h new file mode 100644 index 0000000..74005ee --- /dev/null +++ b/external/sonnet/headers/private/core_debug.h @@ -0,0 +1,3 @@ +#pragma once +#include +static const QLoggingCategory SONNET_LOG_CORE("kf.sonnet.core", QtInfoMsg); diff --git a/external/sonnet/headers/private/hunspelldebug.h b/external/sonnet/headers/private/hunspelldebug.h new file mode 100644 index 0000000..a28d1c5 --- /dev/null +++ b/external/sonnet/headers/private/hunspelldebug.h @@ -0,0 +1,3 @@ +#pragma once +#include +static const QLoggingCategory SONNET_HUNSPELL("kf.sonnet.clients.hunspell", QtInfoMsg); diff --git a/external/sonnet/headers/private/nsspellcheckerdebug.h b/external/sonnet/headers/private/nsspellcheckerdebug.h new file mode 100644 index 0000000..0d0ad12 --- /dev/null +++ b/external/sonnet/headers/private/nsspellcheckerdebug.h @@ -0,0 +1,3 @@ +#pragma once +#include +static const QLoggingCategory SONNET_NSSPELLCHECKER("kf.sonnet.clients.nsspellchecker", QtInfoMsg); diff --git a/external/sonnet/headers/public/sonnetcore_export.h b/external/sonnet/headers/public/sonnetcore_export.h new file mode 100644 index 0000000..e69de29 diff --git a/variables.cmake b/variables.cmake index 91b7027..ce8e310 100644 --- a/variables.cmake +++ b/variables.cmake @@ -31,10 +31,22 @@ option(DESKTOP_APP_DISABLE_CRASH_REPORTS "Disable crash report generation." ${no option(DESKTOP_APP_DISABLE_AUTOUPDATE "Disable autoupdate." ${disable_autoupdate}) option(DESKTOP_APP_USE_HUNSPELL_ONLY "Disable system spellchecker and use bundled Hunspell only. (For debugging purposes)" OFF) cmake_dependent_option(DESKTOP_APP_USE_ENCHANT "Use Enchant instead of bundled Hunspell." OFF LINUX OFF) -cmake_dependent_option(DESKTOP_APP_USE_CLD3 "Disable system text language recognition and use bundled cld3 only." OFF APPLE ON) cmake_dependent_option(DESKTOP_APP_NO_PDB "Disable PDB file generation." OFF WIN32 OFF) cmake_dependent_option(DESKTOP_APP_DISABLE_JEMALLOC "Disable jemalloc, use system malloc." OFF LINUX OFF) +if (APPLE) + set(language_recognition_default SYSTEM) +elseif (WIN32) + set(language_recognition_default CLD3) +else() + set(language_recognition_default SONNET) +endif() +set(DESKTOP_APP_LANGUAGE_RECOGNITION_BACKEND "${language_recognition_default}" CACHE STRING "Text language recognition backend.") +set_property(CACHE DESKTOP_APP_LANGUAGE_RECOGNITION_BACKEND PROPERTY STRINGS SYSTEM CLD3 SONNET) +if (LINUX AND DESKTOP_APP_LANGUAGE_RECOGNITION_BACKEND STREQUAL SYSTEM) + set(DESKTOP_APP_LANGUAGE_RECOGNITION_BACKEND "${language_recognition_default}") +endif() + if (APPLE AND NOT DEFINED DESKTOP_APP_MAC_ARCH) if (DEFINED CMAKE_OSX_ARCHITECTURES) set(DESKTOP_APP_MAC_ARCH "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING "Target macOS arch.") @@ -52,10 +64,16 @@ if ((WIN32 endif() set(add_cld3_library 0) -if (LINUX OR DESKTOP_APP_USE_CLD3) +if (DESKTOP_APP_LANGUAGE_RECOGNITION_BACKEND STREQUAL CLD3) set(add_cld3_library 1) endif() +set(add_sonnet_library 0) +if (DESKTOP_APP_LANGUAGE_RECOGNITION_BACKEND STREQUAL SONNET) + set(add_sonnet_library 1) + set(add_hunspell_library 1) +endif() + set(build_macstore 0) set(build_winstore 0) # 32 or 64 bit set(build_win64 0) # normal or uwp From 7267c030542b1033854fda228eb45b765db78e59 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 22 Nov 2022 11:49:19 +0300 Subject: [PATCH 083/215] Fixed generating of timestamp file for protobuf dependencies. --- external/cld3/generate_protobuf.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/external/cld3/generate_protobuf.cmake b/external/cld3/generate_protobuf.cmake index 4a8ae1e..6fdb76d 100644 --- a/external/cld3/generate_protobuf.cmake +++ b/external/cld3/generate_protobuf.cmake @@ -34,6 +34,9 @@ function(generate_single_protobuf target_name gen_dst protobuf_name executable) ${gen_dst}/${protobuf_name_we}.pb.h ) + string(TIMESTAMP gen_timestamp_var "%s") + file(WRITE ${gen_timestamp} ${gen_timestamp_var}) + # Fix warning MSB8065. set_source_files_properties(${gen_timestamp} PROPERTIES SYMBOLIC 1) From 25088a573bb57c4a1d208a38cfc994e7206fb35b Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 24 Nov 2022 08:31:52 +0400 Subject: [PATCH 084/215] Revert "Add external_sonnet library" This reverts commit 81705fb6095ec3aa74ef900a1a181c0d586447d8. --- external/CMakeLists.txt | 3 - external/sonnet/CMakeLists.txt | 110 ------------------ external/sonnet/generate_trigrams.cmake | 23 ---- .../sonnet/headers/private/config-hunspell.h | 0 external/sonnet/headers/private/core_debug.h | 3 - .../sonnet/headers/private/hunspelldebug.h | 3 - .../headers/private/nsspellcheckerdebug.h | 3 - .../sonnet/headers/public/sonnetcore_export.h | 0 variables.cmake | 22 +--- 9 files changed, 2 insertions(+), 165 deletions(-) delete mode 100644 external/sonnet/CMakeLists.txt delete mode 100644 external/sonnet/generate_trigrams.cmake delete mode 100644 external/sonnet/headers/private/config-hunspell.h delete mode 100644 external/sonnet/headers/private/core_debug.h delete mode 100644 external/sonnet/headers/private/hunspelldebug.h delete mode 100644 external/sonnet/headers/private/nsspellcheckerdebug.h delete mode 100644 external/sonnet/headers/public/sonnetcore_export.h diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 3e680ad..9be0e5a 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -59,9 +59,6 @@ add_checked_subdirectory(qr_code_generator) add_checked_subdirectory(ranges) add_checked_subdirectory(rlottie) add_checked_subdirectory(rnnoise) -if (add_sonnet_library) - add_checked_subdirectory(sonnet) -endif() add_checked_subdirectory(ton) add_checked_subdirectory(variant) add_checked_subdirectory(vpx) diff --git a/external/sonnet/CMakeLists.txt b/external/sonnet/CMakeLists.txt deleted file mode 100644 index e9dfbc5..0000000 --- a/external/sonnet/CMakeLists.txt +++ /dev/null @@ -1,110 +0,0 @@ -# This file is part of Desktop App Toolkit, -# a set of libraries for developing nice desktop applications. -# -# For license and copyright information please follow this link: -# https://github.com/desktop-app/legal/blob/master/LEGAL - -if (DESKTOP_APP_USE_PACKAGED AND QT_VERSION_MAJOR EQUAL 5) - add_library(external_sonnet INTERFACE IMPORTED GLOBAL) - add_library(desktop-app::external_sonnet ALIAS external_sonnet) - - find_package(KF5Sonnet) - if (KF5Sonnet_FOUND) - target_link_libraries(external_sonnet INTERFACE KF5::SonnetCore) - return() - endif() -endif() - -add_library(external_sonnet STATIC) -add_library(desktop-app::external_sonnet ALIAS external_sonnet) -init_target(external_sonnet "(external)") - -set(sonnet_loc ${third_party_loc}/sonnet) -set(sonnet_data_loc ${sonnet_loc}/data) -set(sonnet_core_src ${sonnet_loc}/src/core) -set(sonnet_plugins_src ${sonnet_loc}/src/plugins) - -set_target_properties(external_sonnet PROPERTIES AUTOMOC ON) - -configure_file(${sonnet_data_loc}/trigrams.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/trigrams.qrc @ONLY) -target_sources(external_sonnet PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/trigrams.qrc) - -nice_target_sources(external_sonnet ${sonnet_core_src} -PRIVATE - client.cpp - client_p.h - guesslanguage.cpp - guesslanguage.h - loader.cpp - loader_p.h - settings.cpp - settings.h - settingsimpl.cpp - settingsimpl_p.h - speller.cpp - speller.h - spellerplugin.cpp - spellerplugin_p.h - textbreaks.cpp - textbreaks_p.h - tokenizer.cpp - tokenizer_p.h -) - -nice_target_sources(external_sonnet ${sonnet_plugins_src}/hunspell -PRIVATE - hunspellclient.cpp - hunspellclient.h - hunspelldict.cpp - hunspelldict.h -) - -if (APPLE) - nice_target_sources(external_sonnet ${sonnet_plugins_src}/nsspellchecker - PRIVATE - nsspellcheckerclient.cpp - nsspellcheckerclient.h - nsspellcheckerdict.cpp - nsspellcheckerdict.h - ) -endif() - -target_compile_definitions(external_sonnet -PUBLIC - SONNETCORE_EXPORT= - SONNET_STATIC -PRIVATE - QT_USE_QSTRINGBUILDER -) - -target_include_directories(external_sonnet SYSTEM -PUBLIC - ${sonnet_core_src} - ${CMAKE_CURRENT_SOURCE_DIR}/headers/public -PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/headers/private -) - -target_link_libraries(external_sonnet -PRIVATE - desktop-app::external_qt - desktop-app::external_hunspell -) - -target_prepare_qrc(external_sonnet) - -add_executable(external_sonnet_parsetrigrams) -init_target(external_sonnet_parsetrigrams "(external)") - -nice_target_sources(external_sonnet_parsetrigrams ${sonnet_data_loc} -PRIVATE - parsetrigrams.cpp -) - -target_link_libraries(external_sonnet_parsetrigrams -PRIVATE - desktop-app::external_qt -) - -include(generate_trigrams.cmake) -generate_trigrams(external_sonnet ${sonnet_data_loc}/trigrams) diff --git a/external/sonnet/generate_trigrams.cmake b/external/sonnet/generate_trigrams.cmake deleted file mode 100644 index f6fe28d..0000000 --- a/external/sonnet/generate_trigrams.cmake +++ /dev/null @@ -1,23 +0,0 @@ -function(generate_trigrams target_name trigrams_file) - set(gen_dst ${CMAKE_BINARY_DIR}/data) - file(MAKE_DIRECTORY ${gen_dst}) - - set(gen_timestamp ${gen_dst}/${target_name}_trigrams.timestamp) - set(gen_files ${gen_dst}/trigrams.map) - - add_custom_command( - OUTPUT - ${gen_timestamp} - BYPRODUCTS - ${gen_files} - COMMAND - external_sonnet_parsetrigrams "${trigrams_file}" > "${gen_files}" - COMMAND - echo 1> ${gen_timestamp} - COMMENT "Generating trigrams (${target_name})" - DEPENDS - external_sonnet_parsetrigrams - ${trigrams_file} - ) - generate_target(${target_name} trigrams ${gen_timestamp} "${gen_files}" ${gen_dst}) -endfunction() diff --git a/external/sonnet/headers/private/config-hunspell.h b/external/sonnet/headers/private/config-hunspell.h deleted file mode 100644 index e69de29..0000000 diff --git a/external/sonnet/headers/private/core_debug.h b/external/sonnet/headers/private/core_debug.h deleted file mode 100644 index 74005ee..0000000 --- a/external/sonnet/headers/private/core_debug.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once -#include -static const QLoggingCategory SONNET_LOG_CORE("kf.sonnet.core", QtInfoMsg); diff --git a/external/sonnet/headers/private/hunspelldebug.h b/external/sonnet/headers/private/hunspelldebug.h deleted file mode 100644 index a28d1c5..0000000 --- a/external/sonnet/headers/private/hunspelldebug.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once -#include -static const QLoggingCategory SONNET_HUNSPELL("kf.sonnet.clients.hunspell", QtInfoMsg); diff --git a/external/sonnet/headers/private/nsspellcheckerdebug.h b/external/sonnet/headers/private/nsspellcheckerdebug.h deleted file mode 100644 index 0d0ad12..0000000 --- a/external/sonnet/headers/private/nsspellcheckerdebug.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once -#include -static const QLoggingCategory SONNET_NSSPELLCHECKER("kf.sonnet.clients.nsspellchecker", QtInfoMsg); diff --git a/external/sonnet/headers/public/sonnetcore_export.h b/external/sonnet/headers/public/sonnetcore_export.h deleted file mode 100644 index e69de29..0000000 diff --git a/variables.cmake b/variables.cmake index ce8e310..91b7027 100644 --- a/variables.cmake +++ b/variables.cmake @@ -31,22 +31,10 @@ option(DESKTOP_APP_DISABLE_CRASH_REPORTS "Disable crash report generation." ${no option(DESKTOP_APP_DISABLE_AUTOUPDATE "Disable autoupdate." ${disable_autoupdate}) option(DESKTOP_APP_USE_HUNSPELL_ONLY "Disable system spellchecker and use bundled Hunspell only. (For debugging purposes)" OFF) cmake_dependent_option(DESKTOP_APP_USE_ENCHANT "Use Enchant instead of bundled Hunspell." OFF LINUX OFF) +cmake_dependent_option(DESKTOP_APP_USE_CLD3 "Disable system text language recognition and use bundled cld3 only." OFF APPLE ON) cmake_dependent_option(DESKTOP_APP_NO_PDB "Disable PDB file generation." OFF WIN32 OFF) cmake_dependent_option(DESKTOP_APP_DISABLE_JEMALLOC "Disable jemalloc, use system malloc." OFF LINUX OFF) -if (APPLE) - set(language_recognition_default SYSTEM) -elseif (WIN32) - set(language_recognition_default CLD3) -else() - set(language_recognition_default SONNET) -endif() -set(DESKTOP_APP_LANGUAGE_RECOGNITION_BACKEND "${language_recognition_default}" CACHE STRING "Text language recognition backend.") -set_property(CACHE DESKTOP_APP_LANGUAGE_RECOGNITION_BACKEND PROPERTY STRINGS SYSTEM CLD3 SONNET) -if (LINUX AND DESKTOP_APP_LANGUAGE_RECOGNITION_BACKEND STREQUAL SYSTEM) - set(DESKTOP_APP_LANGUAGE_RECOGNITION_BACKEND "${language_recognition_default}") -endif() - if (APPLE AND NOT DEFINED DESKTOP_APP_MAC_ARCH) if (DEFINED CMAKE_OSX_ARCHITECTURES) set(DESKTOP_APP_MAC_ARCH "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING "Target macOS arch.") @@ -64,16 +52,10 @@ if ((WIN32 endif() set(add_cld3_library 0) -if (DESKTOP_APP_LANGUAGE_RECOGNITION_BACKEND STREQUAL CLD3) +if (LINUX OR DESKTOP_APP_USE_CLD3) set(add_cld3_library 1) endif() -set(add_sonnet_library 0) -if (DESKTOP_APP_LANGUAGE_RECOGNITION_BACKEND STREQUAL SONNET) - set(add_sonnet_library 1) - set(add_hunspell_library 1) -endif() - set(build_macstore 0) set(build_winstore 0) # 32 or 64 bit set(build_win64 0) # normal or uwp From 2c86aa9a3dd44c9cf46e4ad1185c561189b449c5 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 24 Nov 2022 09:44:31 +0400 Subject: [PATCH 085/215] Fix packaged build with cld3 --- external/cld3/CMakeLists.txt | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/external/cld3/CMakeLists.txt b/external/cld3/CMakeLists.txt index 91d50ab..a94dc1d 100644 --- a/external/cld3/CMakeLists.txt +++ b/external/cld3/CMakeLists.txt @@ -7,10 +7,6 @@ add_library(external_cld3 INTERFACE IMPORTED GLOBAL) add_library(desktop-app::external_cld3 ALIAS external_cld3) -if (DESKTOP_APP_USE_PACKAGED) - # find_package(Protobuf REQUIRED) -endif() - add_library(external_cld3_bundled STATIC) init_target(external_cld3_bundled "(external)") @@ -20,7 +16,11 @@ set(cld3_src ${cld3_loc}/src) set(gen_loc ${cld3_loc}/build/gen) set(gen_dst ${gen_loc}/cld_3/protos) -if (WIN32) +if (DESKTOP_APP_USE_PACKAGED) + find_package(Protobuf REQUIRED) + set(protoc_executable protobuf::protoc) + set(protobuf_lib protobuf::libprotobuf-lite) +elseif (WIN32) set(build_loc ${libs_loc}/protobuf/build/$,Debug,Release>) set(protoc_executable ${build_loc}/protoc.exe) set(protobuf_lib ${build_loc}/libprotobuf-lite.lib) @@ -89,10 +89,16 @@ target_include_directories(external_cld3_bundled PUBLIC ${cld3_src} ${gen_loc} - ${libs_loc}/protobuf/src - ${libs_loc}/protobuf/third_party/abseil-cpp ) +if (NOT DESKTOP_APP_USE_PACKAGED) + target_include_directories(external_cld3_bundled + PUBLIC + ${libs_loc}/protobuf/src + ${libs_loc}/protobuf/third_party/abseil-cpp + ) +endif() + target_link_libraries(external_cld3 INTERFACE external_cld3_bundled From 0ff8f97600548ab3652a17444de207ca2cc000cb Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 24 Nov 2022 09:44:42 +0400 Subject: [PATCH 086/215] Fix noisy warnings with clang --- options_linux.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/options_linux.cmake b/options_linux.cmake index 33817d2..fd08c2b 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -9,6 +9,10 @@ INTERFACE -fPIC $<$>:-fno-strict-aliasing> -pipe +) + +target_compile_options_if_exists(common_options +INTERFACE -Wall -Wextra -Wno-unused-parameter From 4a261d8c524a218c43c49dc424b7919c7d0d0285 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 25 Nov 2022 14:52:49 +0400 Subject: [PATCH 087/215] Fallback to protobuf cmake config --- external/cld3/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/external/cld3/CMakeLists.txt b/external/cld3/CMakeLists.txt index a94dc1d..f351ca1 100644 --- a/external/cld3/CMakeLists.txt +++ b/external/cld3/CMakeLists.txt @@ -17,7 +17,10 @@ set(gen_loc ${cld3_loc}/build/gen) set(gen_dst ${gen_loc}/cld_3/protos) if (DESKTOP_APP_USE_PACKAGED) - find_package(Protobuf REQUIRED) + find_package(Protobuf) + if (NOT Protobuf_FOUND) + find_package(protobuf REQUIRED CONFIG) + endif() set(protoc_executable protobuf::protoc) set(protobuf_lib protobuf::libprotobuf-lite) elseif (WIN32) From f5dab7d4b77ac1049cba9ae723c79ae6c391566f Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 25 Nov 2022 16:33:41 +0100 Subject: [PATCH 088/215] Don't enable LTCG in Debug on Windows. --- init_target.cmake | 4 +--- options_win.cmake | 10 ++++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/init_target.cmake b/init_target.cmake index 8b97a2e..47e127b 100644 --- a/init_target.cmake +++ b/init_target.cmake @@ -40,9 +40,7 @@ function(init_target target_name) # init_target(my_target folder_name) ) endif() if (DESKTOP_APP_SPECIAL_TARGET AND WIN32 AND NOT build_win64) - target_compile_options(${target_name} PRIVATE /GL) - target_link_options(${target_name} PRIVATE /LTCG) - set_property(TARGET ${target_name} APPEND_STRING PROPERTY STATIC_LIBRARY_OPTIONS "/LTCG") + set_property(TARGET ${target_name} APPEND_STRING PROPERTY STATIC_LIBRARY_OPTIONS "$,,/LTCG>") endif() endfunction() diff --git a/options_win.cmake b/options_win.cmake index b2eeefa..136afa3 100644 --- a/options_win.cmake +++ b/options_win.cmake @@ -53,6 +53,16 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") INTERFACE /LARGEADDRESSAWARE # Allow more than 2 GB in 32 bit application. ) + if (DESKTOP_APP_SPECIAL_TARGET) + target_compile_options(common_options + INTERFACE + $,,/GL> + ) + target_link_options(common_options + INTERFACE + $,,/LTCG> + ) + endif() endif() elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_compile_definitions(common_options From 125b9571c58186d7190fb12a54a70493d4722627 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 6 Dec 2022 18:11:17 +0400 Subject: [PATCH 089/215] Remove global LTCG on Windows build (object too large). --- init_target.cmake | 3 --- options_win.cmake | 10 ---------- 2 files changed, 13 deletions(-) diff --git a/init_target.cmake b/init_target.cmake index 47e127b..4af214c 100644 --- a/init_target.cmake +++ b/init_target.cmake @@ -39,9 +39,6 @@ function(init_target target_name) # init_target(my_target folder_name) XCODE_ATTRIBUTE_LLVM_LTO $,NO,YES> ) endif() - if (DESKTOP_APP_SPECIAL_TARGET AND WIN32 AND NOT build_win64) - set_property(TARGET ${target_name} APPEND_STRING PROPERTY STATIC_LIBRARY_OPTIONS "$,,/LTCG>") - endif() endfunction() # This code is not supposed to run on build machine, only on target machine. diff --git a/options_win.cmake b/options_win.cmake index 136afa3..b2eeefa 100644 --- a/options_win.cmake +++ b/options_win.cmake @@ -53,16 +53,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") INTERFACE /LARGEADDRESSAWARE # Allow more than 2 GB in 32 bit application. ) - if (DESKTOP_APP_SPECIAL_TARGET) - target_compile_options(common_options - INTERFACE - $,,/GL> - ) - target_link_options(common_options - INTERFACE - $,,/LTCG> - ) - endif() endif() elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_compile_definitions(common_options From 609e21643b837580a2fedb258dde413fad1e199e Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 7 Dec 2022 02:43:41 +0400 Subject: [PATCH 090/215] Fix the order of default Qt version It seems both Qt and cmake documentations are incorrect about the order used in NAMES keyword --- external/qt/package.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/external/qt/package.cmake b/external/qt/package.cmake index 2faa580..939475a 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -25,7 +25,10 @@ if (NOT DESKTOP_APP_USE_PACKAGED) endif() if (NOT DEFINED QT_VERSION_MAJOR) - find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) + find_package(QT NAMES Qt6 COMPONENTS Core) + if (NOT QT_FOUND) + find_package(QT NAMES Qt5 COMPONENTS Core REQUIRED) + endif() endif() find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets Network Svg REQUIRED) From f4c7f67d6007cdf7bf525ad9c79c2ef565c770ab Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 7 Dec 2022 10:55:53 +0400 Subject: [PATCH 091/215] Allow passing LTCG as an init_target argument. --- init_target.cmake | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/init_target.cmake b/init_target.cmake index 4af214c..a71ed59 100644 --- a/init_target.cmake +++ b/init_target.cmake @@ -12,17 +12,31 @@ function(init_target_folder target_name folder_name) endif() endfunction() -function(init_target target_name) # init_target(my_target folder_name) - if (ARGC GREATER 1) - if (${ARGV1} STREQUAL cxx_std_14 OR ${ARGV1} STREQUAL cxx_std_11 OR ${ARGV1} STREQUAL cxx_std_17) - target_compile_features(${target_name} PRIVATE ${ARGV1}) +function(init_target target_name) # init_target(my_target [cxx_std_..] [ltcg] folder_name) + set(argslist ${ARGV}) + list(REMOVE_AT argslist 0) + set(standard ${MAXIMUM_CXX_STANDARD}) + foreach (entry ${argslist}) + if (${entry} STREQUAL cxx_std_14 OR ${entry} STREQUAL cxx_std_11 OR ${entry} STREQUAL cxx_std_17) + set(standard ${entry}) + elseif (${entry} STREQUAL ltcg) + if (WIN32 AND NOT build_win64 AND DESKTOP_APP_SPECIAL_TARGET) + target_compile_options(${target_name} + PRIVATE + $,,/GL> + ) + target_link_options(${target_name} + PRIVATE + $,,/LTCG> + ) + set_property(TARGET ${target_name} APPEND_STRING PROPERTY STATIC_LIBRARY_OPTIONS "$,,/LTCG>") + endif() else() - target_compile_features(${target_name} PRIVATE ${MAXIMUM_CXX_STANDARD}) - init_target_folder(${target_name} ${ARGV1}) + init_target_folder(${target_name} ${entry}) endif() - else() - target_compile_features(${target_name} PRIVATE ${MAXIMUM_CXX_STANDARD}) - endif() + endforeach() + target_compile_features(${target_name} PRIVATE ${standard}) + if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set_target_properties(${target_name} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") @@ -43,7 +57,7 @@ endfunction() # This code is not supposed to run on build machine, only on target machine. function(init_non_host_target target_name) - init_target(${target_name}) + init_target(${ARGV}) if (APPLE) set_target_properties(${target_name} PROPERTIES OSX_ARCHITECTURES "${DESKTOP_APP_MAC_ARCH}" From 085086856c6494b012fbc604a723ffee0e585b48 Mon Sep 17 00:00:00 2001 From: Klemens Nanni Date: Wed, 7 Dec 2022 21:39:50 +0400 Subject: [PATCH 092/215] Fix tdesktop 4.3.4 cld3 bundle build with system protobuf ``` .../Telegram/ThirdParty/cld3/build/gen/cld_3/protos/sentence.pb.h:10:10: fatal error: 'google/protobuf/port_def.inc' file not found ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. ``` --- external/cld3/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/external/cld3/CMakeLists.txt b/external/cld3/CMakeLists.txt index f351ca1..4686689 100644 --- a/external/cld3/CMakeLists.txt +++ b/external/cld3/CMakeLists.txt @@ -102,8 +102,12 @@ if (NOT DESKTOP_APP_USE_PACKAGED) ) endif() +target_link_libraries(external_cld3_bundled +PRIVATE + ${protobuf_lib} +) + target_link_libraries(external_cld3 INTERFACE external_cld3_bundled - ${protobuf_lib} ) From c84790f978a90483ea4d112eb497252c4e2954be Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 16 Dec 2022 10:23:28 +0400 Subject: [PATCH 093/215] Set NDEBUG when debug webrtc build is not found --- external/webrtc/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/external/webrtc/CMakeLists.txt b/external/webrtc/CMakeLists.txt index 26d1103..0cafdbc 100644 --- a/external/webrtc/CMakeLists.txt +++ b/external/webrtc/CMakeLists.txt @@ -65,6 +65,7 @@ endif() if (NOT EXISTS ${libs_loc}/tg_owt/out/Debug/${webrtc_lib_prefix}tg_owt${webrtc_lib_suffix}) set(webrtc_build_loc ${libs_loc}/tg_owt/out/Release) + target_compile_definitions(external_webrtc INTERFACE $<$:NDEBUG>) endif() target_include_directories(external_webrtc SYSTEM From af37d955bb97e03a1dbfbc408defee98081afbd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Novomesk=C3=BD?= Date: Sun, 18 Dec 2022 08:26:45 +0100 Subject: [PATCH 094/215] Enable support for AVIF, HEIF and JPEG XL on Windows --- external/kimageformats/CMakeLists.txt | 42 ++++++++++++++++++- .../qt_static_plugins/qt_static_plugins.cpp | 4 +- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/external/kimageformats/CMakeLists.txt b/external/kimageformats/CMakeLists.txt index f0e7e92..60dfd2e 100644 --- a/external/kimageformats/CMakeLists.txt +++ b/external/kimageformats/CMakeLists.txt @@ -4,7 +4,7 @@ # For license and copyright information please follow this link: # https://github.com/desktop-app/legal/blob/master/LEGAL -if ((DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY) OR NOT LINUX) # should work on non-Linux, but cmake rules aren't implemented yet +if ((DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY) OR APPLE) # should work on macOS, but cmake rules aren't implemented yet add_library(external_kimageformats INTERFACE IMPORTED GLOBAL) add_library(desktop-app::external_kimageformats ALIAS external_kimageformats) return() @@ -17,7 +17,18 @@ init_target(external_kimageformats "(external)") set(kimageformats_loc ${third_party_loc}/kimageformats) set(kimageformats_src ${kimageformats_loc}/src/imageformats) -set_target_properties(external_kimageformats PROPERTIES AUTOMOC ON) +set(kimageformats_srcs) +qt_wrap_cpp(kimageformats_srcs + ${kimageformats_src}/avif_p.h + ${kimageformats_src}/heif_p.h + ${kimageformats_src}/jxl_p.h +TARGET + external_kimageformats +DEPENDS + ${kimageformats_src}/avif.json + ${kimageformats_src}/heif.json + ${kimageformats_src}/jxl.json +) nice_target_sources(external_kimageformats ${kimageformats_src} PRIVATE @@ -25,6 +36,7 @@ PRIVATE heif.cpp jxl.cpp ) +target_sources(external_kimageformats PRIVATE ${kimageformats_srcs}) target_compile_definitions(external_kimageformats PRIVATE @@ -51,6 +63,32 @@ if (DESKTOP_APP_USE_PACKAGED) PkgConfig::LIBJXL PkgConfig::LIBJXL_THREADS ) +elseif (WIN32) + target_compile_definitions(external_kimageformats + PRIVATE + JXL_STATIC_DEFINE + JXL_THREADS_STATIC_DEFINE + LIBHEIF_STATIC_BUILD + ) + + target_include_directories(external_kimageformats SYSTEM + PRIVATE + ${libs_loc}/local/include + ) + + target_link_libraries(external_kimageformats + PRIVATE + ${libs_loc}/libavif/$,Debug,Release>/avif.lib + ${libs_loc}/libheif/libheif/$,Debug,Release>/heif.lib + ${libs_loc}/libde265/libde265/$,Debug,Release>/de265.lib + ${libs_loc}/dav1d/builddir-$,debug,release>/src/libdav1d.a + ${libs_loc}/libjxl/lib/$,Debug,Release>/jxl-static.lib + ${libs_loc}/libjxl/lib/$,Debug,Release>/jxl_threads-static.lib + ${libs_loc}/libjxl/third_party/highway/$,Debug,Release>/hwy.lib + ${libs_loc}/libjxl/third_party/brotli/$,Debug,Release>/brotlidec-static.lib + ${libs_loc}/libjxl/third_party/brotli/$,Debug,Release>/brotlienc-static.lib + ${libs_loc}/libjxl/third_party/brotli/$,Debug,Release>/brotlicommon-static.lib + ) else() target_link_static_libraries(external_kimageformats PRIVATE diff --git a/external/qt/qt_static_plugins/qt_static_plugins.cpp b/external/qt/qt_static_plugins/qt_static_plugins.cpp index b06abb0..985bec5 100644 --- a/external/qt/qt_static_plugins/qt_static_plugins.cpp +++ b/external/qt/qt_static_plugins/qt_static_plugins.cpp @@ -55,11 +55,13 @@ Q_IMPORT_PLUGIN(QGtk3ThemePlugin) #endif // !DESKTOP_APP_USE_PACKAGED #if !defined DESKTOP_APP_USE_PACKAGED || defined DESKTOP_APP_USE_PACKAGED_LAZY -#if defined Q_OS_UNIX && !defined Q_OS_MAC +#if defined Q_OS_WIN || (defined Q_OS_UNIX && !defined Q_OS_MAC) Q_IMPORT_PLUGIN(QAVIFPlugin) Q_IMPORT_PLUGIN(HEIFPlugin) Q_IMPORT_PLUGIN(QJpegXLPlugin) +#endif // Q_OS_WIN || (Q_OS_UNIX && !Q_OS_MAC) +#if defined Q_OS_UNIX && !defined Q_OS_MAC Q_IMPORT_PLUGIN(NimfInputContextPlugin) #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin) From bb07e9d6980498fe7c2add7ab998d8f43afa8cdc Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 25 Dec 2022 02:15:05 +0400 Subject: [PATCH 095/215] Add dav1d dependency to external_ffmpeg --- external/ffmpeg/CMakeLists.txt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/external/ffmpeg/CMakeLists.txt b/external/ffmpeg/CMakeLists.txt index 5b17ff7..2594db6 100644 --- a/external/ffmpeg/CMakeLists.txt +++ b/external/ffmpeg/CMakeLists.txt @@ -60,10 +60,19 @@ list(APPEND ffmpeg_lib_list $ ) -if (APPLE) - list(APPEND ffmpeg_lib_list bz2) +if (WIN32) + list(APPEND ffmpeg_lib_list + ${libs_loc}/dav1d/builddir-$,debug,release>/src/libdav1d.a + ) +elseif (APPLE) + list(APPEND ffmpeg_lib_list + bz2 + ) elseif (LINUX) - list(APPEND ffmpeg_lib_list -llzma) + list(APPEND ffmpeg_lib_list + -ldav1d + -llzma + ) endif() # Workaround cmake's random order on Linux... From 8cbc57f355d37c9236522bc90c8850a8e6fffca8 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 26 Dec 2022 13:42:17 +0400 Subject: [PATCH 096/215] Fix generate_single_protobuf timestamp file generation. --- external/cld3/generate_protobuf.cmake | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/external/cld3/generate_protobuf.cmake b/external/cld3/generate_protobuf.cmake index 6fdb76d..3c8544b 100644 --- a/external/cld3/generate_protobuf.cmake +++ b/external/cld3/generate_protobuf.cmake @@ -34,12 +34,6 @@ function(generate_single_protobuf target_name gen_dst protobuf_name executable) ${gen_dst}/${protobuf_name_we}.pb.h ) - string(TIMESTAMP gen_timestamp_var "%s") - file(WRITE ${gen_timestamp} ${gen_timestamp_var}) - - # Fix warning MSB8065. - set_source_files_properties(${gen_timestamp} PROPERTIES SYMBOLIC 1) - set(gen_src ${cld3_src}/${protobuf_name}) add_custom_command( OUTPUT @@ -52,6 +46,8 @@ function(generate_single_protobuf target_name gen_dst protobuf_name executable) ${gen_dst} ${_protobuf_include_path} ${gen_src} + COMMAND + echo 1> ${gen_timestamp} COMMENT "Generating protobuf ${protobuf_name} (${target_name})" DEPENDS ${executable} From 4d8c8a0f84f271a14666a36674d2781a2fe155a9 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 28 Dec 2022 15:13:55 +0400 Subject: [PATCH 097/215] Link Qt to lcms2 on Linux --- external/qt/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 4a24c49..744f7e5 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -302,6 +302,7 @@ if (LINUX) target_link_static_libraries(external_qt INTERFACE proxy + lcms2 xkbcommon xkbcommon-x11 xcb-glx From de92292f89c48848e4350ae1a6a531309b5aca8c Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 31 Dec 2022 09:29:51 +0400 Subject: [PATCH 098/215] Ensure executables operating in UTF-8 charset on Windows Otherwise Qt assumptions are likely broken --- options_win.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/options_win.cmake b/options_win.cmake index b2eeefa..6db8b4f 100644 --- a/options_win.cmake +++ b/options_win.cmake @@ -18,6 +18,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") INTERFACE /permissive- # /Qspectre + /utf-8 /W1 /WX /MP # Enable multi process build. From aa1e0d84b93e0901bb8db497e67276329ef9cc66 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 9 Jan 2023 10:24:32 +0400 Subject: [PATCH 099/215] Allow weak-linking of macOS frameworks. --- options_mac.cmake | 1 - target_link_frameworks.cmake | 13 +++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/options_mac.cmake b/options_mac.cmake index afab1c7..8da4ab4 100644 --- a/options_mac.cmake +++ b/options_mac.cmake @@ -84,5 +84,4 @@ INTERFACE MediaPlayer IOSurface Metal - NaturalLanguage ) diff --git a/target_link_frameworks.cmake b/target_link_frameworks.cmake index 1c03093..01730d0 100644 --- a/target_link_frameworks.cmake +++ b/target_link_frameworks.cmake @@ -4,8 +4,9 @@ # For license and copyright information please follow this link: # https://github.com/desktop-app/legal/blob/master/LEGAL -function(target_link_frameworks target_name) +function(target_link_frameworks_generic type target_name) set(list ${ARGV}) + list(REMOVE_AT list 1) list(REMOVE_AT list 0) set(writing_now "") @@ -16,7 +17,7 @@ function(target_link_frameworks target_name) if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") set(writing_now ${entry}) else() - set(full_argument "-framework ${entry}") + set(full_argument "${type} ${entry}") if ("${writing_now}" STREQUAL "PRIVATE") list(APPEND private_frameworks ${full_argument}) elseif ("${writing_now}" STREQUAL "PUBLIC") @@ -39,3 +40,11 @@ function(target_link_frameworks target_name) target_link_libraries(${target_name} INTERFACE ${interface_frameworks}) endif() endfunction() + +function(target_link_frameworks target_name) + target_link_frameworks_generic("-framework" ${ARGV}) +endfunction() + +function(target_link_frameworks_weak target_name) + target_link_frameworks_generic("-weak_framework" ${ARGV}) +endfunction() From 17951fb650e380364968ed4f208e589e2812be3d Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 8 Feb 2023 13:19:21 +0400 Subject: [PATCH 100/215] Re-enable global /LTCG on Windows. With /LTCGOUT: empty path it should not try generating .iobj file, and work on both 32 bit and 64 bit build with all static libs. --- init_target.cmake | 21 +++++---------------- options_win.cmake | 12 ++++++++++++ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/init_target.cmake b/init_target.cmake index a71ed59..1d599c5 100644 --- a/init_target.cmake +++ b/init_target.cmake @@ -12,40 +12,29 @@ function(init_target_folder target_name folder_name) endif() endfunction() -function(init_target target_name) # init_target(my_target [cxx_std_..] [ltcg] folder_name) +function(init_target target_name) # init_target(my_target [cxx_std_..] folder_name) set(argslist ${ARGV}) list(REMOVE_AT argslist 0) set(standard ${MAXIMUM_CXX_STANDARD}) foreach (entry ${argslist}) if (${entry} STREQUAL cxx_std_14 OR ${entry} STREQUAL cxx_std_11 OR ${entry} STREQUAL cxx_std_17) set(standard ${entry}) - elseif (${entry} STREQUAL ltcg) - if (WIN32 AND NOT build_win64 AND DESKTOP_APP_SPECIAL_TARGET) - target_compile_options(${target_name} - PRIVATE - $,,/GL> - ) - target_link_options(${target_name} - PRIVATE - $,,/LTCG> - ) - set_property(TARGET ${target_name} APPEND_STRING PROPERTY STATIC_LIBRARY_OPTIONS "$,,/LTCG>") - endif() else() init_target_folder(${target_name} ${entry}) endif() endforeach() target_compile_features(${target_name} PRIVATE ${standard}) - if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - set_target_properties(${target_name} PROPERTIES - MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + if (WIN32 AND DESKTOP_APP_SPECIAL_TARGET) + set_property(TARGET ${target_name} APPEND_STRING PROPERTY STATIC_LIBRARY_OPTIONS "$,,/LTCG>") endif() + target_link_libraries(${target_name} PRIVATE desktop-app::common_options) set_target_properties(${target_name} PROPERTIES XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_WEAK YES XCODE_ATTRIBUTE_GCC_INLINES_ARE_PRIVATE_EXTERN YES XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES + MSVC_RUNTIME_LIBRARY MultiThreaded$<$:Debug> ) if (DESKTOP_APP_SPECIAL_TARGET) set_target_properties(${target_name} PROPERTIES diff --git a/options_win.cmake b/options_win.cmake index 6db8b4f..8037e8c 100644 --- a/options_win.cmake +++ b/options_win.cmake @@ -55,6 +55,18 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") /LARGEADDRESSAWARE # Allow more than 2 GB in 32 bit application. ) endif() + + if (DESKTOP_APP_SPECIAL_TARGET) + target_compile_options(common_options + INTERFACE + $,,/GL> + ) + target_link_options(common_options + INTERFACE + $,,/LTCG> + $,,/LTCGOUT:> + ) + endif() elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_compile_definitions(common_options INTERFACE From 556dcb016670e889697423cdd09b789b5debdfba Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 10 Feb 2023 11:21:48 +0400 Subject: [PATCH 101/215] Use QT_DEPRECATED_WARNINGS_SINCE --- options.cmake | 1 + options_linux.cmake | 1 - options_mac.cmake | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/options.cmake b/options.cmake index 9e9822d..c1dcbea 100644 --- a/options.cmake +++ b/options.cmake @@ -13,6 +13,7 @@ INTERFACE QT_NO_KEYWORDS QT_NO_CAST_FROM_BYTEARRAY QT_IMPLICIT_QCHAR_CONSTRUCTION + QT_DEPRECATED_WARNINGS_SINCE=0x051500 ) if (DESKTOP_APP_DISABLE_CRASH_REPORTS) diff --git a/options_linux.cmake b/options_linux.cmake index fd08c2b..ef93679 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -21,7 +21,6 @@ INTERFACE -Wno-missing-field-initializers -Wno-sign-compare -Wno-deprecated # implicit capture of 'this' via '[=]' is deprecated in C++20 - -Wno-deprecated-declarations # TODO: Remove when there will be no Qt 5 support ) target_link_options_if_exists(common_options diff --git a/options_mac.cmake b/options_mac.cmake index 8da4ab4..d758b6c 100644 --- a/options_mac.cmake +++ b/options_mac.cmake @@ -27,7 +27,6 @@ INTERFACE $<$:-fobjc-weak> -fvisibility-inlines-hidden -fvisibility=hidden - -Wno-deprecated-declarations # temp for range-v3 -Wno-unused-variable -Wno-unused-parameter -Wno-unused-function From 0f86a05ab0b35e4516adca0bdb3e6d3646e4d577 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 10 Feb 2023 20:45:42 +0400 Subject: [PATCH 102/215] Silence new Xcode warnings --- options_mac.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/options_mac.cmake b/options_mac.cmake index d758b6c..48f5e29 100644 --- a/options_mac.cmake +++ b/options_mac.cmake @@ -36,6 +36,7 @@ INTERFACE -Wno-sign-compare -Wno-unknown-attributes -Wno-pragma-system-header-outside-header + -Wno-shorten-64-to-32 ) if (DESKTOP_APP_SPECIAL_TARGET) From 9310263cd6b099ffd676d7d0203715b588d43416 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 11 Feb 2023 11:18:11 +0400 Subject: [PATCH 103/215] Don't try to find Qt 6 on Windows --- external/qt/package.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/external/qt/package.cmake b/external/qt/package.cmake index 939475a..7e56ab3 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -25,7 +25,9 @@ if (NOT DESKTOP_APP_USE_PACKAGED) endif() if (NOT DEFINED QT_VERSION_MAJOR) - find_package(QT NAMES Qt6 COMPONENTS Core) + if (NOT WIN32) + find_package(QT NAMES Qt6 COMPONENTS Core) + endif() if (NOT QT_FOUND) find_package(QT NAMES Qt5 COMPONENTS Core REQUIRED) endif() From 86270a961e0cd63fbff867863fe841d38c11ca36 Mon Sep 17 00:00:00 2001 From: Vitaly Zaitsev Date: Fri, 10 Feb 2023 09:51:52 +0100 Subject: [PATCH 104/215] Set minimal packaged GSL version to 4.0.0 due to modern headers usage. --- external/gsl/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/external/gsl/CMakeLists.txt b/external/gsl/CMakeLists.txt index 1bfab92..adc4353 100644 --- a/external/gsl/CMakeLists.txt +++ b/external/gsl/CMakeLists.txt @@ -9,9 +9,9 @@ add_library(desktop-app::external_gsl ALIAS external_gsl) if (DESKTOP_APP_USE_PACKAGED) if (DESKTOP_APP_USE_PACKAGED_LAZY) - find_package(Microsoft.GSL QUIET) + find_package(Microsoft.GSL 4.0.0 QUIET) else() - find_package(Microsoft.GSL) + find_package(Microsoft.GSL 4.0.0) endif() if (Microsoft.GSL_FOUND) From b5dd1db1298a3e953ddcf6ab07532bf183f5c76f Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 21 Feb 2023 18:46:13 +0400 Subject: [PATCH 105/215] Fix link to new libde265 on Linux --- external/kimageformats/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/kimageformats/CMakeLists.txt b/external/kimageformats/CMakeLists.txt index 60dfd2e..813ce77 100644 --- a/external/kimageformats/CMakeLists.txt +++ b/external/kimageformats/CMakeLists.txt @@ -97,7 +97,7 @@ else() jxl jxl_threads dav1d - libde265 + de265 brotlidec-static brotlienc-static brotlicommon-static From 8a62b6659dce8bb3bdb413f92705caca376e0c0b Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 28 Feb 2023 19:56:58 +0400 Subject: [PATCH 106/215] Use _init targets that provide Q_IMPORT_PLUGIN calls --- external/qt/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 744f7e5..6c66af8 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -244,6 +244,8 @@ else() qml/QtWayland/Compositor/XdgShell/${qt_lib_prefix}waylandcompositorxdgshellplugin ) list(APPEND qt_libs_list + $ + $ $ $ $ @@ -267,6 +269,9 @@ if (QT_VERSION_MAJOR GREATER_EQUAL 6) if (TARGET Qt::Qml) list(APPEND qt_libs_list + $ + $ + $ $ $ $ @@ -275,6 +280,8 @@ if (QT_VERSION_MAJOR GREATER_EQUAL 6) if (TARGET Qt::Quick) list(APPEND qt_libs_list + $ + $ $ $ $ From 31eb395967d5da6f07bd1e3f5f5f9bdaac94cb85 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 28 Feb 2023 20:09:34 +0400 Subject: [PATCH 107/215] Update Qt cmake rules for Qt 6.5 on Linux --- external/qt/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 6c66af8..21e0d3e 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -121,7 +121,8 @@ if (TARGET Qt::Qml) list(PREPEND common_qt_libs qml/QtQml/WorkerScript/${qt_lib_prefix}workerscriptplugin qml/QtQml/Models/${qt_lib_prefix}modelsplugin - qml/QtQml/${qt_lib_prefix}qmlplugin + qml/QtQml/Base/${qt_lib_prefix}qmlplugin + qml/QtQml/${qt_lib_prefix}qmlmetaplugin lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}QmlWorkerScript lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}QmlModels lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Qml @@ -269,9 +270,11 @@ if (QT_VERSION_MAJOR GREATER_EQUAL 6) if (TARGET Qt::Qml) list(APPEND qt_libs_list + $ $ $ $ + $ $ $ $ @@ -312,6 +315,7 @@ if (LINUX) lcms2 xkbcommon xkbcommon-x11 + xcb-cursor xcb-glx xcb-xkb xcb-randr From d3977a83a6c8d7a1551dc457a79e05a3f383aa6f Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 7 Mar 2023 19:48:39 +0400 Subject: [PATCH 108/215] Link avfilter. --- external/ffmpeg/CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/external/ffmpeg/CMakeLists.txt b/external/ffmpeg/CMakeLists.txt index 2594db6..71fcac4 100644 --- a/external/ffmpeg/CMakeLists.txt +++ b/external/ffmpeg/CMakeLists.txt @@ -11,6 +11,7 @@ if (DESKTOP_APP_USE_PACKAGED) find_package(PkgConfig REQUIRED) pkg_check_modules(AVCODEC REQUIRED IMPORTED_TARGET libavcodec) + pkg_check_modules(AVFILTER REQUIRED IMPORTED_TARGET libavfilter) pkg_check_modules(AVFORMAT REQUIRED IMPORTED_TARGET libavformat) pkg_check_modules(AVUTIL REQUIRED IMPORTED_TARGET libavutil) pkg_check_modules(SWSCALE REQUIRED IMPORTED_TARGET libswscale) @@ -19,6 +20,7 @@ if (DESKTOP_APP_USE_PACKAGED) target_link_libraries(external_ffmpeg INTERFACE PkgConfig::AVCODEC + PkgConfig::AVFILTER PkgConfig::AVFORMAT PkgConfig::AVUTIL PkgConfig::SWSCALE @@ -32,8 +34,9 @@ set(ffmpeg_lib_list) if (LINUX) list(APPEND ffmpeg_lib_list - -lavformat -lavcodec + -lavfilter + -lavformat -lswresample -lswscale -lavutil @@ -47,8 +50,9 @@ else() ) list(APPEND ffmpeg_lib_list - ${ffmpeg_lib_loc}/libavformat/libavformat.a ${ffmpeg_lib_loc}/libavcodec/libavcodec.a + ${ffmpeg_lib_loc}/libavfilter/libavfilter.a + ${ffmpeg_lib_loc}/libavformat/libavformat.a ${ffmpeg_lib_loc}/libswresample/libswresample.a ${ffmpeg_lib_loc}/libswscale/libswscale.a ${ffmpeg_lib_loc}/libavutil/libavutil.a From 49272b960648774c68d2adb7637baddb93c89acc Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 9 Mar 2023 23:21:14 +0400 Subject: [PATCH 109/215] Fix linking on GCC. --- external/ffmpeg/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/external/ffmpeg/CMakeLists.txt b/external/ffmpeg/CMakeLists.txt index 71fcac4..48b2fdf 100644 --- a/external/ffmpeg/CMakeLists.txt +++ b/external/ffmpeg/CMakeLists.txt @@ -10,18 +10,18 @@ add_library(desktop-app::external_ffmpeg ALIAS external_ffmpeg) if (DESKTOP_APP_USE_PACKAGED) find_package(PkgConfig REQUIRED) - pkg_check_modules(AVCODEC REQUIRED IMPORTED_TARGET libavcodec) pkg_check_modules(AVFILTER REQUIRED IMPORTED_TARGET libavfilter) pkg_check_modules(AVFORMAT REQUIRED IMPORTED_TARGET libavformat) + pkg_check_modules(AVCODEC REQUIRED IMPORTED_TARGET libavcodec) pkg_check_modules(AVUTIL REQUIRED IMPORTED_TARGET libavutil) pkg_check_modules(SWSCALE REQUIRED IMPORTED_TARGET libswscale) pkg_check_modules(SWRESAMPLE REQUIRED IMPORTED_TARGET libswresample) target_link_libraries(external_ffmpeg INTERFACE - PkgConfig::AVCODEC PkgConfig::AVFILTER PkgConfig::AVFORMAT + PkgConfig::AVCODEC PkgConfig::AVUTIL PkgConfig::SWSCALE PkgConfig::SWRESAMPLE @@ -34,9 +34,9 @@ set(ffmpeg_lib_list) if (LINUX) list(APPEND ffmpeg_lib_list - -lavcodec -lavfilter -lavformat + -lavcodec -lswresample -lswscale -lavutil @@ -50,9 +50,9 @@ else() ) list(APPEND ffmpeg_lib_list - ${ffmpeg_lib_loc}/libavcodec/libavcodec.a ${ffmpeg_lib_loc}/libavfilter/libavfilter.a ${ffmpeg_lib_loc}/libavformat/libavformat.a + ${ffmpeg_lib_loc}/libavcodec/libavcodec.a ${ffmpeg_lib_loc}/libswresample/libswresample.a ${ffmpeg_lib_loc}/libswscale/libswscale.a ${ffmpeg_lib_loc}/libavutil/libavutil.a From c33cf7240f20ae708ab78a5ee14d9d70294d9ca1 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 21 Mar 2023 11:39:41 +0400 Subject: [PATCH 110/215] Add minimum glibmm version --- external/glibmm/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/external/glibmm/CMakeLists.txt b/external/glibmm/CMakeLists.txt index 72dba09..8547890 100644 --- a/external/glibmm/CMakeLists.txt +++ b/external/glibmm/CMakeLists.txt @@ -8,8 +8,8 @@ add_library(external_glibmm INTERFACE IMPORTED GLOBAL) add_library(desktop-app::external_glibmm ALIAS external_glibmm) find_package(PkgConfig REQUIRED) -pkg_check_modules(GLIBMM REQUIRED IMPORTED_TARGET glibmm-2.68) -pkg_check_modules(GIOMM REQUIRED IMPORTED_TARGET giomm-2.68) +pkg_check_modules(GLIBMM REQUIRED IMPORTED_TARGET glibmm-2.68>=2.76) +pkg_check_modules(GIOMM REQUIRED IMPORTED_TARGET giomm-2.68>=2.76) if (DESKTOP_APP_USE_PACKAGED) target_link_libraries(external_glibmm From 6ab5543b3dd1e40979d258e46d03376931b6c37b Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 31 Mar 2023 23:32:07 +0400 Subject: [PATCH 111/215] Get rid of xcb_xlib dependencies We can drop this dependency thanks to Qt 6.5.0's xcursor -> xcb-cursor rewrite --- external/qt/CMakeLists.txt | 4 ---- external/qt/qt_static_plugins/qt_static_plugins.cpp | 1 - 2 files changed, 5 deletions(-) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 21e0d3e..c060c4e 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -208,7 +208,6 @@ else() plugins/platforms/${qt_lib_prefix}qxcb plugins/tls/${qt_lib_prefix}qopensslbackend plugins/xcbglintegrations/${qt_lib_prefix}qxcb-egl-integration - plugins/xcbglintegrations/${qt_lib_prefix}qxcb-glx-integration plugins/iconengines/${qt_lib_prefix}qsvgicon lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}XcbQpa ${common_qt_libs} @@ -316,7 +315,6 @@ if (LINUX) xkbcommon xkbcommon-x11 xcb-cursor - xcb-glx xcb-xkb xcb-randr xcb-icccm @@ -351,8 +349,6 @@ if (LINUX) EGL GL xcb - X11 - X11-xcb glib-2.0 ) endif() diff --git a/external/qt/qt_static_plugins/qt_static_plugins.cpp b/external/qt/qt_static_plugins/qt_static_plugins.cpp index 985bec5..c78d931 100644 --- a/external/qt/qt_static_plugins/qt_static_plugins.cpp +++ b/external/qt/qt_static_plugins/qt_static_plugins.cpp @@ -32,7 +32,6 @@ Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) #elif defined Q_OS_UNIX // Q_OS_WIN | Q_OS_MAC Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) Q_IMPORT_PLUGIN(QXcbEglIntegrationPlugin) -Q_IMPORT_PLUGIN(QXcbGlxIntegrationPlugin) Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin) Q_IMPORT_PLUGIN(QSvgIconPlugin) #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION From c03178c09be027627321704d3a9b81b032159dbd Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 29 Apr 2023 10:18:35 +0400 Subject: [PATCH 112/215] Parallelize dispatch & jemalloc build --- external/dispatch/CMakeLists.txt | 2 +- external/jemalloc/CMakeLists.txt | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/external/dispatch/CMakeLists.txt b/external/dispatch/CMakeLists.txt index ccc5782..3a463cf 100644 --- a/external/dispatch/CMakeLists.txt +++ b/external/dispatch/CMakeLists.txt @@ -45,7 +45,7 @@ if (NOT DESKTOP_APP_DISPATCH_LIBRARIES OR NOT DESKTOP_APP_DISPATCH_INCLUDE_DIRS) ) execute_process( - COMMAND ${CMAKE_COMMAND} --build ${dispatch_binary_dir} + COMMAND ${CMAKE_COMMAND} --build ${dispatch_binary_dir} --parallel ) if (NOT EXISTS ${dispatch_binary_dir}/src/libdispatch.a) diff --git a/external/jemalloc/CMakeLists.txt b/external/jemalloc/CMakeLists.txt index a7470a7..0ce500a 100644 --- a/external/jemalloc/CMakeLists.txt +++ b/external/jemalloc/CMakeLists.txt @@ -30,6 +30,9 @@ if (DESKTOP_APP_USE_PACKAGED) endif() endif() +include(ProcessorCount) +ProcessorCount(N) + include(ExternalProject) ExternalProject_Add(jemalloc URL ${third_party_loc}/jemalloc @@ -39,6 +42,7 @@ ExternalProject_Add(jemalloc "$>,$>,EXTRA_CFLAGS=$<$:-Ofast> -fstack-protector-all -DNDEBUG -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS,=>" "$>,$>,EXTRA_CXXFLAGS=$<$:-Ofast> -fstack-protector-all -DNDEBUG -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS,=>" ./autogen.sh --disable-shared + BUILD_COMMAND make $<$>:-j${N}> BUILD_IN_SOURCE 1 STEP_TARGETS build EXCLUDE_FROM_ALL TRUE From d625b4d1ba9dbcbb2f7a8f6555e1658569aaa093 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 3 May 2023 18:00:09 +0400 Subject: [PATCH 113/215] Get rid of -Ofast on Linux This seem to make some miscompilation that lead to hangs --- external/dispatch/CMakeLists.txt | 12 +++--------- external/jemalloc/CMakeLists.txt | 4 ++-- options_linux.cmake | 1 - 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/external/dispatch/CMakeLists.txt b/external/dispatch/CMakeLists.txt index 3a463cf..0431d88 100644 --- a/external/dispatch/CMakeLists.txt +++ b/external/dispatch/CMakeLists.txt @@ -14,17 +14,11 @@ if (DESKTOP_APP_USE_PACKAGED) endif() if (NOT DESKTOP_APP_DISPATCH_LIBRARIES OR NOT DESKTOP_APP_DISPATCH_INCLUDE_DIRS) - if (DESKTOP_APP_SPECIAL_TARGET) - set(dispatch_extra_args - -DCMAKE_BUILD_TYPE=None - "-DCMAKE_C_FLAGS=-g -Ofast -pipe -fPIC -fstack-protector-all -DNDEBUG -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS" - "-DCMAKE_CXX_FLAGS=-g -Ofast -pipe -fPIC -fstack-protector-all -DNDEBUG -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS" - ) - elseif (NOT DESKTOP_APP_USE_PACKAGED) + if (NOT DESKTOP_APP_USE_PACKAGED OR DESKTOP_APP_SPECIAL_TARGET) set(dispatch_extra_args -DCMAKE_BUILD_TYPE=Release - "-DCMAKE_C_FLAGS=-pipe -fPIC -fstack-protector-all -D_GLIBCXX_ASSERTIONS" - "-DCMAKE_CXX_FLAGS=-pipe -fPIC -fstack-protector-all -D_GLIBCXX_ASSERTIONS" + "-DCMAKE_C_FLAGS=-g -pipe -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS" + "-DCMAKE_CXX_FLAGS=-g -pipe -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS" ) elseif (DEFINED CMAKE_BUILD_TYPE) set(dispatch_extra_args diff --git a/external/jemalloc/CMakeLists.txt b/external/jemalloc/CMakeLists.txt index 0ce500a..c66ea66 100644 --- a/external/jemalloc/CMakeLists.txt +++ b/external/jemalloc/CMakeLists.txt @@ -39,8 +39,8 @@ ExternalProject_Add(jemalloc CONFIGURE_COMMAND env CC=clang CXX=clang++ - "$>,$>,EXTRA_CFLAGS=$<$:-Ofast> -fstack-protector-all -DNDEBUG -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS,=>" - "$>,$>,EXTRA_CXXFLAGS=$<$:-Ofast> -fstack-protector-all -DNDEBUG -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS,=>" + "$>,$>,EXTRA_CFLAGS=-fstack-protector-all -DNDEBUG -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS,=>" + "$>,$>,EXTRA_CXXFLAGS=-fstack-protector-all -DNDEBUG -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS,=>" ./autogen.sh --disable-shared BUILD_COMMAND make $<$>:-j${N}> BUILD_IN_SOURCE 1 diff --git a/options_linux.cmake b/options_linux.cmake index ef93679..7e9aec0 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -36,7 +36,6 @@ INTERFACE if (DESKTOP_APP_SPECIAL_TARGET) target_compile_options(common_options INTERFACE - $<$>:-Ofast> -Werror $<$>:-g> $<$>:-flto=auto> From c09c5b61a8fc8c3210755752fef873a735a197d0 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 6 May 2023 02:23:41 +0400 Subject: [PATCH 114/215] Get rid of DESKTOP_APP_DISABLE_DBUS_INTEGRATION Desktop App Toolkit uses GLib as the D-Bus library for quite long time, but GLib is not only a D-Bus library, it's more a basic library providing native Linux APIs implementing various specs. The situation right now is that DESKTOP_APP_DISABLE_DBUS_INTEGRATION disables not only D-Bus code but all the native API integration such as MIME handling or .desktop file parsing. In other words, the option disables native Linux APIs on Linux what is absurd and doesn't have any sense. --- external/CMakeLists.txt | 4 ++-- external/kcoreaddons/CMakeLists.txt | 2 +- external/qt/package.cmake | 6 +----- external/qt/qt_static_plugins/CMakeLists.txt | 2 +- external/qt/qt_static_plugins/qt_static_plugins.cpp | 8 ++++---- options.cmake | 7 ------- variables.cmake | 1 - 7 files changed, 9 insertions(+), 21 deletions(-) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 9be0e5a..563732f 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -21,14 +21,14 @@ if (LINUX) add_checked_subdirectory(dispatch) endif() add_checked_subdirectory(expected) -if (LINUX AND NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) +if (LINUX AND TARGET Qt::DBus) add_checked_subdirectory(fcitx_qt5) if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION) add_checked_subdirectory(fcitx5_qt) endif() endif() add_checked_subdirectory(ffmpeg) -if (LINUX AND NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) +if (LINUX) add_checked_subdirectory(glib) add_checked_subdirectory(glibmm) endif() diff --git a/external/kcoreaddons/CMakeLists.txt b/external/kcoreaddons/CMakeLists.txt index 07514e9..dcf4da9 100644 --- a/external/kcoreaddons/CMakeLists.txt +++ b/external/kcoreaddons/CMakeLists.txt @@ -47,7 +47,7 @@ if (NOT LINUX) ) endif() -if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) +if (TARGET Qt::DBus) set_source_files_properties(${kcoreaddons_src}/io/org.freedesktop.portal.FileTransfer.xml PROPERTIES INCLUDE ${kcoreaddons_src}/io/dbustypes_p.h) qt_add_dbus_interface(_dbus_SRCS ${kcoreaddons_src}/io/org.freedesktop.portal.FileTransfer.xml org.freedesktop.portal.FileTransfer) diff --git a/external/qt/package.cmake b/external/qt/package.cmake index 7e56ab3..4c30efd 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -51,11 +51,7 @@ if (LINUX) find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS WaylandCompositor QUIET) endif() - if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) - find_package(Qt${QT_VERSION_MAJOR} COMPONENTS DBus REQUIRED) - elseif (NOT DESKTOP_APP_USE_PACKAGED) - find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS DBus QUIET) - endif() + find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS DBus QUIET) endif() set_property(GLOBAL PROPERTY AUTOGEN_SOURCE_GROUP "(gen)") diff --git a/external/qt/qt_static_plugins/CMakeLists.txt b/external/qt/qt_static_plugins/CMakeLists.txt index ce2fa82..a1dd245 100644 --- a/external/qt/qt_static_plugins/CMakeLists.txt +++ b/external/qt/qt_static_plugins/CMakeLists.txt @@ -25,7 +25,7 @@ if (LINUX) desktop-app::external_nimf_qt5 ) - if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) + if (TARGET Qt::DBus) target_link_libraries(external_qt_static_plugins PUBLIC desktop-app::external_fcitx_qt5 diff --git a/external/qt/qt_static_plugins/qt_static_plugins.cpp b/external/qt/qt_static_plugins/qt_static_plugins.cpp index c78d931..4f8abdd 100644 --- a/external/qt/qt_static_plugins/qt_static_plugins.cpp +++ b/external/qt/qt_static_plugins/qt_static_plugins.cpp @@ -34,14 +34,14 @@ Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) Q_IMPORT_PLUGIN(QXcbEglIntegrationPlugin) Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin) Q_IMPORT_PLUGIN(QSvgIconPlugin) -#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION +#ifdef QT_DBUS_LIB #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) Q_IMPORT_PLUGIN(QConnmanEnginePlugin) Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin) #endif // Qt < 6.0.0 Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin) Q_IMPORT_PLUGIN(QXdgDesktopPortalThemePlugin) -#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION +#endif // QT_DBUS_LIB #ifndef DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION Q_IMPORT_PLUGIN(QWaylandIntegrationPlugin) Q_IMPORT_PLUGIN(QWaylandEglPlatformIntegrationPlugin) @@ -62,12 +62,12 @@ Q_IMPORT_PLUGIN(QJpegXLPlugin) #if defined Q_OS_UNIX && !defined Q_OS_MAC Q_IMPORT_PLUGIN(NimfInputContextPlugin) -#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION +#ifdef QT_DBUS_LIB Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin) #ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION Q_IMPORT_PLUGIN(QFcitx5PlatformInputContextPlugin) #endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION -#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION +#endif // QT_DBUS_LIB #ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin) #endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION diff --git a/options.cmake b/options.cmake index c1dcbea..91f5eff 100644 --- a/options.cmake +++ b/options.cmake @@ -23,13 +23,6 @@ if (DESKTOP_APP_DISABLE_CRASH_REPORTS) ) endif() -if (DESKTOP_APP_DISABLE_DBUS_INTEGRATION) - target_compile_definitions(common_options - INTERFACE - DESKTOP_APP_DISABLE_DBUS_INTEGRATION - ) -endif() - if (DESKTOP_APP_DISABLE_X11_INTEGRATION) target_compile_definitions(common_options INTERFACE diff --git a/variables.cmake b/variables.cmake index 91b7027..fd9aabf 100644 --- a/variables.cmake +++ b/variables.cmake @@ -20,7 +20,6 @@ if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "" endif() option(DESKTOP_APP_LOTTIE_USE_CACHE "Use caching in lottie animations." ON) -cmake_dependent_option(DESKTOP_APP_DISABLE_DBUS_INTEGRATION "Disable all code for D-Bus integration." OFF LINUX ON) cmake_dependent_option(DESKTOP_APP_DISABLE_X11_INTEGRATION "Disable all code for X11 integration." OFF LINUX ON) cmake_dependent_option(DESKTOP_APP_USE_ALLOCATION_TRACER "Use simple allocation tracer." OFF LINUX OFF) cmake_dependent_option(DESKTOP_APP_USE_PACKAGED_LAZY "Bundle recommended Qt plugins for self-contained packages." OFF LINUX OFF) From 9abd685bf498f2410dfbc42f77c99e35ddedca94 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 6 May 2023 02:30:39 +0400 Subject: [PATCH 115/215] Get rid of unused DESKTOP_APP_DISABLE_SPELLSHECK --- variables.cmake | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/variables.cmake b/variables.cmake index fd9aabf..67af35b 100644 --- a/variables.cmake +++ b/variables.cmake @@ -25,7 +25,6 @@ cmake_dependent_option(DESKTOP_APP_USE_ALLOCATION_TRACER "Use simple allocation cmake_dependent_option(DESKTOP_APP_USE_PACKAGED_LAZY "Bundle recommended Qt plugins for self-contained packages." OFF LINUX OFF) option(DESKTOP_APP_USE_PACKAGED_FONTS "Use preinstalled fonts instead of bundled patched ones." OFF) option(DESKTOP_APP_USE_PACKAGED_RLOTTIE "Find rlottie using CMake instead of bundled patched one." OFF) -option(DESKTOP_APP_DISABLE_SPELLCHECK "Disable spellcheck library." OFF) option(DESKTOP_APP_DISABLE_CRASH_REPORTS "Disable crash report generation." ${no_special_target}) option(DESKTOP_APP_DISABLE_AUTOUPDATE "Disable autoupdate." ${disable_autoupdate}) option(DESKTOP_APP_USE_HUNSPELL_ONLY "Disable system spellchecker and use bundled Hunspell only. (For debugging purposes)" OFF) @@ -43,10 +42,9 @@ if (APPLE AND NOT DEFINED DESKTOP_APP_MAC_ARCH) endif() set(add_hunspell_library 0) -if ((WIN32 +if (WIN32 OR (LINUX AND NOT DESKTOP_APP_USE_ENCHANT) OR DESKTOP_APP_USE_HUNSPELL_ONLY) - AND NOT DESKTOP_APP_DISABLE_SPELLCHECK) set(add_hunspell_library 1) endif() From fecdffbbf4d0ddb03efce5a66199e071bc3ccfb8 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 14 May 2023 22:14:33 +0400 Subject: [PATCH 116/215] Fix a D-Bus condition in kcoreaddons To fix macOS build --- external/kcoreaddons/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/kcoreaddons/CMakeLists.txt b/external/kcoreaddons/CMakeLists.txt index dcf4da9..dda874f 100644 --- a/external/kcoreaddons/CMakeLists.txt +++ b/external/kcoreaddons/CMakeLists.txt @@ -47,7 +47,7 @@ if (NOT LINUX) ) endif() -if (TARGET Qt::DBus) +if (LINUX AND TARGET Qt::DBus) set_source_files_properties(${kcoreaddons_src}/io/org.freedesktop.portal.FileTransfer.xml PROPERTIES INCLUDE ${kcoreaddons_src}/io/dbustypes_p.h) qt_add_dbus_interface(_dbus_SRCS ${kcoreaddons_src}/io/org.freedesktop.portal.FileTransfer.xml org.freedesktop.portal.FileTransfer) From dee3777ffd54a40e966914a2942f7cdd92b93c86 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 22 Apr 2023 11:54:27 +0400 Subject: [PATCH 117/215] Add cppgir support --- .gitmodules | 3 ++ external/glib/CMakeLists.txt | 44 ++++++++------------- external/glib/cppgir | 1 + external/glib/generate_cppgir.cmake | 43 ++++++++++++++++++++ external/glib/generate_dbus.cmake | 61 +++++++++++++++++++++++++++++ external/glib/generate_gir.cmake | 45 +++++++++++++++++++++ generate_target.cmake | 9 ++++- 7 files changed, 176 insertions(+), 30 deletions(-) create mode 100644 .gitmodules create mode 160000 external/glib/cppgir create mode 100644 external/glib/generate_cppgir.cmake create mode 100644 external/glib/generate_dbus.cmake create mode 100644 external/glib/generate_gir.cmake diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..c92fbea --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "external/glib/cppgir"] + path = external/glib/cppgir + url = https://gitlab.com/mnauw/cppgir.git diff --git a/external/glib/CMakeLists.txt b/external/glib/CMakeLists.txt index def4376..66385e3 100644 --- a/external/glib/CMakeLists.txt +++ b/external/glib/CMakeLists.txt @@ -7,33 +7,21 @@ add_library(external_glib INTERFACE IMPORTED GLOBAL) add_library(desktop-app::external_glib ALIAS external_glib) +function(add_cppgir) # isolate scope + set(BUILD_TESTING OFF) + set(BUILD_DOC OFF) + set(CMAKE_DISABLE_FIND_PACKAGE_Qt5Core ON) + add_subdirectory(cppgir) +endfunction() +add_cppgir() + +include(generate_cppgir.cmake) +generate_cppgir(external_glib Gio-2.0) + find_package(PkgConfig REQUIRED) -pkg_check_modules(GLIB2 REQUIRED IMPORTED_TARGET glib-2.0) -pkg_check_modules(GOBJECT REQUIRED IMPORTED_TARGET gobject-2.0) -pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) -pkg_check_modules(GIO_UNIX REQUIRED IMPORTED_TARGET gio-unix-2.0) +pkg_check_modules(GLIB2 REQUIRED IMPORTED_TARGET glib-2.0 gobject-2.0 gio-2.0 gio-unix-2.0) -if (DESKTOP_APP_USE_PACKAGED) - target_link_libraries(external_glib - INTERFACE - PkgConfig::GIO_UNIX - PkgConfig::GIO - PkgConfig::GOBJECT - PkgConfig::GLIB2 - ) -else() - target_include_directories(external_glib SYSTEM - INTERFACE - ${GIO_UNIX_INCLUDE_DIRS} - ${GIO_INCLUDE_DIRS} - ${GOBJECT_INCLUDE_DIRS} - ${GLIB2_INCLUDE_DIRS} - ) - - target_link_libraries(external_glib - INTERFACE - gio-2.0 - gobject-2.0 - glib-2.0 - ) -endif() +target_link_libraries(external_glib +INTERFACE + PkgConfig::GLIB2 +) diff --git a/external/glib/cppgir b/external/glib/cppgir new file mode 160000 index 0000000..bb2b437 --- /dev/null +++ b/external/glib/cppgir @@ -0,0 +1 @@ +Subproject commit bb2b437760a707fde6d4f51a7679fc4cc6410c3c diff --git a/external/glib/generate_cppgir.cmake b/external/glib/generate_cppgir.cmake new file mode 100644 index 0000000..675d98c --- /dev/null +++ b/external/glib/generate_cppgir.cmake @@ -0,0 +1,43 @@ +# This file is part of Desktop App Toolkit, +# a set of libraries for developing nice desktop applications. +# +# For license and copyright information please follow this link: +# https://github.com/desktop-app/legal/blob/master/LEGAL + +function(generate_cppgir target_name gir) + # cppgir generates all the dependent headers everytime, better to have a global folder + set(gen_dst ${CMAKE_BINARY_DIR}/gen) + file(MAKE_DIRECTORY ${gen_dst}) + + set(gen_timestamp ${gen_dst}/${target_name}_cppgir.timestamp) + + add_custom_command( + OUTPUT + ${gen_timestamp} + COMMAND + cppgir + --class + --expected + --ignore + ${cmake_helpers_loc}/external/glib/cppgir/data/cppgir.ignore:${cmake_helpers_loc}/external/glib/cppgir/data/cppgir_unix.ignore + --output + ${gen_dst} + ${gir} + COMMAND + echo 1> ${gen_timestamp} + COMMENT "Generating C++ wrapper for ${gir} (${target_name})" + DEPENDS + cppgir + $<$:${gir}> + ) + generate_target(${target_name} cppgir ${gen_timestamp} "" ${gen_dst}) + + get_target_property(target_type ${target_name} TYPE) + if (${target_type} STREQUAL "INTERFACE_LIBRARY") + target_link_libraries(${target_name} INTERFACE gi) + target_compile_definitions(${target_name} INTERFACE GI_INLINE GI_OBJECT_NEWV) + else() + target_link_libraries(${target_name} PUBLIC gi) + target_compile_definitions(${target_name} PUBLIC GI_INLINE GI_OBJECT_NEWV) + endif() +endfunction() diff --git a/external/glib/generate_dbus.cmake b/external/glib/generate_dbus.cmake new file mode 100644 index 0000000..663a344 --- /dev/null +++ b/external/glib/generate_dbus.cmake @@ -0,0 +1,61 @@ +# This file is part of Desktop App Toolkit, +# a set of libraries for developing nice desktop applications. +# +# For license and copyright information please follow this link: +# https://github.com/desktop-app/legal/blob/master/LEGAL + +include(${cmake_helpers_loc}/external/glib/generate_gir.cmake) +include(${cmake_helpers_loc}/external/glib/generate_cppgir.cmake) + +function(generate_dbus target_name interface_prefix namespace interface_file) + find_program(DESKTOP_APP_GDBUSCODEGEN gdbus-codegen REQUIRED) + + set(gen_dst ${CMAKE_CURRENT_BINARY_DIR}/gen) + file(MAKE_DIRECTORY ${gen_dst}) + + set(gen_timestamp ${gen_dst}/${target_name}_${namespace}_dbus.timestamp) + set(gen_files + ${gen_dst}/${target_name}_${namespace}_dbus.c + ${gen_dst}/${target_name}_${namespace}_dbus.h + ) + + add_custom_command( + OUTPUT + ${gen_timestamp} + BYPRODUCTS + ${gen_files} + COMMAND + ${DESKTOP_APP_GDBUSCODEGEN} + --interface-prefix + ${interface_prefix} + --generate-c-code + ${gen_dst}/${target_name}_${namespace}_dbus + --c-namespace + ${namespace} + --c-generate-object-manager + ${interface_file} + COMMAND + echo 1> ${gen_timestamp} + COMMENT "Generating D-Bus C code for ${namespace} (${target_name})" + DEPENDS + ${DESKTOP_APP_GDBUSCODEGEN} + ) + + add_library(${target_name}_${namespace}_dbus STATIC) + init_target(${target_name}_${namespace}_dbus "(gen)") + target_link_libraries(${target_name}_${namespace}_dbus PUBLIC desktop-app::external_glib) + generate_target(${target_name}_${namespace}_dbus timestamp ${gen_timestamp} "${gen_files}" ${gen_dst}) + + add_library(${target_name}_${namespace} INTERFACE) + init_target_folder(${target_name}_${namespace} "(gen)") + target_link_libraries(${target_name}_${namespace} INTERFACE ${target_name}_${namespace}_dbus) + generate_gir(${target_name}_${namespace} ${namespace} Gio-2.0 ${target_name}_${namespace}_dbus) + generate_cppgir(${target_name}_${namespace} ${CMAKE_CURRENT_BINARY_DIR}/gen/${target_name}_${namespace}.gir) + + get_target_property(target_type ${target_name} TYPE) + if (${target_type} STREQUAL "INTERFACE_LIBRARY") + target_link_libraries(${target_name} INTERFACE ${target_name}_${namespace}) + else() + target_link_libraries(${target_name} PUBLIC ${target_name}_${namespace}) + endif() +endfunction() diff --git a/external/glib/generate_gir.cmake b/external/glib/generate_gir.cmake new file mode 100644 index 0000000..81fe796 --- /dev/null +++ b/external/glib/generate_gir.cmake @@ -0,0 +1,45 @@ +# This file is part of Desktop App Toolkit, +# a set of libraries for developing nice desktop applications. +# +# For license and copyright information please follow this link: +# https://github.com/desktop-app/legal/blob/master/LEGAL + +function(generate_gir target_name namespace deps src_target_name) + find_program(DESKTOP_APP_GIRSCANNER g-ir-scanner REQUIRED) + + set(gen_dst ${CMAKE_CURRENT_BINARY_DIR}/gen) + file(MAKE_DIRECTORY ${gen_dst}) + + set(gen_timestamp ${gen_dst}/${target_name}_gir.timestamp) + set(gen_file ${gen_dst}/${target_name}.gir) + + add_custom_command( + OUTPUT + ${gen_timestamp} + BYPRODUCTS + ${gen_file} + COMMAND + ${DESKTOP_APP_GIRSCANNER} + -n + ${namespace} + --nsversion + 1.0 + -l + $ + --c-include + "$,INCLUDE,\\.h$>,$--c-include>" + -i + "$-i>" + -o + ${gen_file} + "$" + COMMAND + echo 1> ${gen_timestamp} + COMMAND_EXPAND_LISTS + COMMENT "Generating GIR (${target_name})" + DEPENDS + ${DESKTOP_APP_GIRSCANNER} + ${src_target_name} + ) + generate_target(${target_name} gir ${gen_timestamp} "${gen_file}" ${gen_dst}) +endfunction() diff --git a/generate_target.cmake b/generate_target.cmake index 611067f..9dc6eb8 100644 --- a/generate_target.cmake +++ b/generate_target.cmake @@ -8,7 +8,12 @@ function(generate_target parent_name postfix generated_timestamp generated_files add_custom_target(${parent_name}_${postfix} DEPENDS ${generated_timestamp}) init_target_folder(${parent_name}_${postfix} "(gen)") add_dependencies(${parent_name} ${parent_name}_${postfix}) - target_sources(${parent_name} PRIVATE ${generated_files}) - target_include_directories(${parent_name} PUBLIC ${gen_dst}) + get_target_property(parent_type ${parent_name} TYPE) + if (${parent_type} STREQUAL "INTERFACE_LIBRARY") + target_include_directories(${parent_name} SYSTEM INTERFACE ${gen_dst}) + else() + target_include_directories(${parent_name} SYSTEM PUBLIC ${gen_dst}) + target_sources(${parent_name} PRIVATE ${generated_files}) + endif() source_group("(gen)" FILES ${generated_files}) endfunction() From a7d000be71db475f034c42687e7905fc8116050f Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 11 May 2023 06:10:07 +0400 Subject: [PATCH 118/215] Get rid of qt5compat dependency --- external/qt/CMakeLists.txt | 9 --------- external/qt/package.cmake | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index c060c4e..3d5a48d 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -14,7 +14,6 @@ if (DESKTOP_APP_USE_PACKAGED) INTERFACE Qt::Core Qt::CorePrivate - $ Qt::Gui Qt::GuiPrivate $ @@ -37,7 +36,6 @@ target_include_directories(external_qt SYSTEM INTERFACE ${qt_loc}/include ${qt_loc}/include/QtCore - $<$:${qt_loc}/include/QtCore5Compat> ${qt_loc}/include/QtGui $<$:${qt_loc}/include/QtOpenGL> ${qt_loc}/include/QtWidgets @@ -62,7 +60,6 @@ INTERFACE QT_STATICPLUGIN QT_PLUGIN QT_CORE_LIB - $<$:QT_CORE5COMPAT_LIB> QT_GUI_LIB $<$:QT_OPENGL_LIB> QT_WIDGETS_LIB @@ -99,12 +96,6 @@ set(common_qt_libs lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Core ) -if (TARGET Qt::Core5Compat) - list(PREPEND common_qt_libs - lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Core5Compat - ) -endif() - if (TARGET Qt::OpenGL) list(PREPEND common_qt_libs lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}OpenGL diff --git a/external/qt/package.cmake b/external/qt/package.cmake index 4c30efd..8b0a0d8 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -39,7 +39,7 @@ find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS Qml Quick QuickWidgets QU set(qt_version_6_or_greater 0) if (QT_VERSION_MAJOR GREATER_EQUAL 6) set(qt_version_6_or_greater 1) - find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core5Compat OpenGL OpenGLWidgets REQUIRED) + find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGL OpenGLWidgets REQUIRED) endif() # QtWaylandScanner cmake integration from Qt 6 is used From 42f8428489692f0a4a05bf833478bad7ee8d5989 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 14 May 2023 00:58:26 +0400 Subject: [PATCH 119/215] Wayland integration uses Qt 6.5 APIs now --- external/qt/package.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/external/qt/package.cmake b/external/qt/package.cmake index 8b0a0d8..cc16466 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -36,14 +36,16 @@ endif() find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets Network Svg REQUIRED) find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS Qml Quick QuickWidgets QUIET) -set(qt_version_6_or_greater 0) +set(qt_version_6_5_or_greater 0) if (QT_VERSION_MAJOR GREATER_EQUAL 6) - set(qt_version_6_or_greater 1) + if (QT_VERSION_MINOR GREATER_EQUAL 5) + set(qt_version_6_5_or_greater 1) + endif() find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGL OpenGLWidgets REQUIRED) endif() # QtWaylandScanner cmake integration from Qt 6 is used -cmake_dependent_option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code for Wayland integration." OFF "LINUX; qt_version_6_or_greater" ON) +cmake_dependent_option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code for Wayland integration." OFF "LINUX; qt_version_6_5_or_greater" ON) if (LINUX) if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) From 96d69f646b0024d2619a00db0d18f4acf0bfb08a Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 15 May 2023 13:58:43 +0400 Subject: [PATCH 120/215] Fix build with DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION --- external/glib/generate_dbus.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/external/glib/generate_dbus.cmake b/external/glib/generate_dbus.cmake index 663a344..77ee46e 100644 --- a/external/glib/generate_dbus.cmake +++ b/external/glib/generate_dbus.cmake @@ -10,7 +10,8 @@ include(${cmake_helpers_loc}/external/glib/generate_cppgir.cmake) function(generate_dbus target_name interface_prefix namespace interface_file) find_program(DESKTOP_APP_GDBUSCODEGEN gdbus-codegen REQUIRED) - set(gen_dst ${CMAKE_CURRENT_BINARY_DIR}/gen) + set(gen_loc ${CMAKE_CURRENT_BINARY_DIR}/gen) + set(gen_dst ${gen_loc}/dbus) file(MAKE_DIRECTORY ${gen_dst}) set(gen_timestamp ${gen_dst}/${target_name}_${namespace}_dbus.timestamp) @@ -44,7 +45,7 @@ function(generate_dbus target_name interface_prefix namespace interface_file) add_library(${target_name}_${namespace}_dbus STATIC) init_target(${target_name}_${namespace}_dbus "(gen)") target_link_libraries(${target_name}_${namespace}_dbus PUBLIC desktop-app::external_glib) - generate_target(${target_name}_${namespace}_dbus timestamp ${gen_timestamp} "${gen_files}" ${gen_dst}) + generate_target(${target_name}_${namespace}_dbus timestamp ${gen_timestamp} "${gen_files}" ${gen_loc}) add_library(${target_name}_${namespace} INTERFACE) init_target_folder(${target_name}_${namespace} "(gen)") From 4eec0338895a78f8f24601b4cd8686f45f8bac54 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 15 May 2023 22:25:57 +0400 Subject: [PATCH 121/215] Update cppgir --- external/glib/cppgir | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/glib/cppgir b/external/glib/cppgir index bb2b437..762c7ae 160000 --- a/external/glib/cppgir +++ b/external/glib/cppgir @@ -1 +1 @@ -Subproject commit bb2b437760a707fde6d4f51a7679fc4cc6410c3c +Subproject commit 762c7aed7af7e3bcf0fd504af338b1964dcb2c12 From ff81e9562db1b573036d3e5c9dbd7b6f9d1b8b8f Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 16 May 2023 02:55:07 +0400 Subject: [PATCH 122/215] Fix compatibility with older cmake --- external/glib/generate_cppgir.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/external/glib/generate_cppgir.cmake b/external/glib/generate_cppgir.cmake index 675d98c..743b77f 100644 --- a/external/glib/generate_cppgir.cmake +++ b/external/glib/generate_cppgir.cmake @@ -11,6 +11,11 @@ function(generate_cppgir target_name gir) set(gen_timestamp ${gen_dst}/${target_name}_cppgir.timestamp) + set(gir_path) + if (IS_ABSOLUTE "${gir}") + set(gir_path ${gir}) + endif() + add_custom_command( OUTPUT ${gen_timestamp} @@ -28,7 +33,7 @@ function(generate_cppgir target_name gir) COMMENT "Generating C++ wrapper for ${gir} (${target_name})" DEPENDS cppgir - $<$:${gir}> + ${gir_path} ) generate_target(${target_name} cppgir ${gen_timestamp} "" ${gen_dst}) From cb7a966ad88c7a5eb0bceb4d0c52a2f0872fc4b2 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 19 May 2023 11:15:40 +0400 Subject: [PATCH 123/215] Update cppgir This allows to supply const variables to generated functions arguments --- external/glib/cppgir | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/glib/cppgir b/external/glib/cppgir index 762c7ae..ed2afc9 160000 --- a/external/glib/cppgir +++ b/external/glib/cppgir @@ -1 +1 @@ -Subproject commit 762c7aed7af7e3bcf0fd504af338b1964dcb2c12 +Subproject commit ed2afc920bfdc663bd54239716403500815ac08a From 32e1044c5198819dd470e3262275a9747dfd65de Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 24 May 2023 17:53:23 +0400 Subject: [PATCH 124/215] Revert "Get rid of xcb_xlib dependencies" This reverts commit 6ab5543b3dd1e40979d258e46d03376931b6c37b. Otherwise HIME input is broken: https://github.com/telegramdesktop/tdesktop/issues/26228 --- external/qt/CMakeLists.txt | 4 ++++ external/qt/qt_static_plugins/qt_static_plugins.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 3d5a48d..4b6829f 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -199,6 +199,7 @@ else() plugins/platforms/${qt_lib_prefix}qxcb plugins/tls/${qt_lib_prefix}qopensslbackend plugins/xcbglintegrations/${qt_lib_prefix}qxcb-egl-integration + plugins/xcbglintegrations/${qt_lib_prefix}qxcb-glx-integration plugins/iconengines/${qt_lib_prefix}qsvgicon lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}XcbQpa ${common_qt_libs} @@ -306,6 +307,7 @@ if (LINUX) xkbcommon xkbcommon-x11 xcb-cursor + xcb-glx xcb-xkb xcb-randr xcb-icccm @@ -340,6 +342,8 @@ if (LINUX) EGL GL xcb + X11 + X11-xcb glib-2.0 ) endif() diff --git a/external/qt/qt_static_plugins/qt_static_plugins.cpp b/external/qt/qt_static_plugins/qt_static_plugins.cpp index 4f8abdd..f6580f4 100644 --- a/external/qt/qt_static_plugins/qt_static_plugins.cpp +++ b/external/qt/qt_static_plugins/qt_static_plugins.cpp @@ -32,6 +32,7 @@ Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) #elif defined Q_OS_UNIX // Q_OS_WIN | Q_OS_MAC Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) Q_IMPORT_PLUGIN(QXcbEglIntegrationPlugin) +Q_IMPORT_PLUGIN(QXcbGlxIntegrationPlugin) Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin) Q_IMPORT_PLUGIN(QSvgIconPlugin) #ifdef QT_DBUS_LIB From a20e3a134927db5194564059ebce46a1f733c32a Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 31 May 2023 03:55:18 +0400 Subject: [PATCH 125/215] Fix error messages in various cmake functions --- target_compile_options_if_exists.cmake | 2 +- target_link_options_if_exists.cmake | 2 +- target_link_static_libraries.cmake | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target_compile_options_if_exists.cmake b/target_compile_options_if_exists.cmake index 4b24ed0..f0b2c07 100644 --- a/target_compile_options_if_exists.cmake +++ b/target_compile_options_if_exists.cmake @@ -28,7 +28,7 @@ function(target_compile_options_if_exists target_name) elseif ("${writing_now}" STREQUAL "INTERFACE") list(APPEND interface_options ${entry}) else() - message(FATAL_ERROR "Unknown frameworks scope for target ${target_name}") + message(FATAL_ERROR "Unknown options scope for target ${target_name}") endif() endif() endif() diff --git a/target_link_options_if_exists.cmake b/target_link_options_if_exists.cmake index ebfad30..acf9112 100644 --- a/target_link_options_if_exists.cmake +++ b/target_link_options_if_exists.cmake @@ -28,7 +28,7 @@ function(target_link_options_if_exists target_name) elseif ("${writing_now}" STREQUAL "INTERFACE") list(APPEND interface_options ${entry}) else() - message(FATAL_ERROR "Unknown frameworks scope for target ${target_name}") + message(FATAL_ERROR "Unknown options scope for target ${target_name}") endif() endif() endif() diff --git a/target_link_static_libraries.cmake b/target_link_static_libraries.cmake index d52912b..f011f02 100644 --- a/target_link_static_libraries.cmake +++ b/target_link_static_libraries.cmake @@ -24,7 +24,7 @@ function(target_link_static_libraries target_name) elseif ("${writing_now}" STREQUAL "INTERFACE") list(APPEND interface_libs ${link_option}) else() - message(FATAL_ERROR "Unknown frameworks scope for target ${target_name}") + message(FATAL_ERROR "Unknown libraries scope for target ${target_name}") endif() endif() endforeach() From 1c07a71d6fde4e71ca9f98d343d09d7503ef15d2 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 31 May 2023 08:33:32 +0400 Subject: [PATCH 126/215] Use ARGN where applicable --- init_target.cmake | 4 +--- nice_target_sources.cmake | 10 ++-------- target_compile_options_if_exists.cmake | 5 +---- target_link_frameworks.cmake | 14 +++++--------- target_link_options_if_exists.cmake | 5 +---- target_link_static_libraries.cmake | 5 +---- target_prepare_qrc.cmake | 3 +-- 7 files changed, 12 insertions(+), 34 deletions(-) diff --git a/init_target.cmake b/init_target.cmake index 1d599c5..f022292 100644 --- a/init_target.cmake +++ b/init_target.cmake @@ -13,10 +13,8 @@ function(init_target_folder target_name folder_name) endfunction() function(init_target target_name) # init_target(my_target [cxx_std_..] folder_name) - set(argslist ${ARGV}) - list(REMOVE_AT argslist 0) set(standard ${MAXIMUM_CXX_STANDARD}) - foreach (entry ${argslist}) + foreach (entry ${ARGN}) if (${entry} STREQUAL cxx_std_14 OR ${entry} STREQUAL cxx_std_11 OR ${entry} STREQUAL cxx_std_17) set(standard ${entry}) else() diff --git a/nice_target_sources.cmake b/nice_target_sources.cmake index 81f9a7b..aa24595 100644 --- a/nice_target_sources.cmake +++ b/nice_target_sources.cmake @@ -5,9 +5,6 @@ # https://github.com/desktop-app/legal/blob/master/LEGAL function(nice_target_sources target_name src_loc) - set(list ${ARGV}) - list(REMOVE_AT list 0 1) - set(writing_now "") set(private_sources "") set(public_sources "") @@ -15,7 +12,7 @@ function(nice_target_sources target_name src_loc) set(not_win_sources "") set(not_mac_sources "") set(not_linux_sources "") - foreach (entry ${list}) + foreach (entry ${ARGN}) if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") set(writing_now ${entry}) else() @@ -71,11 +68,8 @@ function(nice_target_sources target_name src_loc) endfunction() function(remove_target_sources target_name src_loc) - set(list ${ARGV}) - list(REMOVE_AT list 0 1) - set(sources "") - foreach (entry ${list}) + foreach (entry ${ARGN}) set(full_name ${src_loc}/${entry}) list(APPEND sources ${full_name}) endforeach() diff --git a/target_compile_options_if_exists.cmake b/target_compile_options_if_exists.cmake index f0b2c07..76282c6 100644 --- a/target_compile_options_if_exists.cmake +++ b/target_compile_options_if_exists.cmake @@ -7,14 +7,11 @@ include(CheckCXXCompilerFlag) function(target_compile_options_if_exists target_name) - set(list ${ARGV}) - list(REMOVE_AT list 0) - set(writing_now "") set(private_options "") set(public_options "") set(interface_options "") - foreach (entry ${list}) + foreach (entry ${ARGN}) if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") set(writing_now ${entry}) else() diff --git a/target_link_frameworks.cmake b/target_link_frameworks.cmake index 01730d0..cec0a95 100644 --- a/target_link_frameworks.cmake +++ b/target_link_frameworks.cmake @@ -5,15 +5,11 @@ # https://github.com/desktop-app/legal/blob/master/LEGAL function(target_link_frameworks_generic type target_name) - set(list ${ARGV}) - list(REMOVE_AT list 1) - list(REMOVE_AT list 0) - set(writing_now "") set(private_frameworks "") set(public_frameworks "") set(interface_frameworks "") - foreach (entry ${list}) + foreach (entry ${ARGN}) if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") set(writing_now ${entry}) else() @@ -41,10 +37,10 @@ function(target_link_frameworks_generic type target_name) endif() endfunction() -function(target_link_frameworks target_name) - target_link_frameworks_generic("-framework" ${ARGV}) +function(target_link_frameworks) + target_link_frameworks_generic("-framework" ${ARGN}) endfunction() -function(target_link_frameworks_weak target_name) - target_link_frameworks_generic("-weak_framework" ${ARGV}) +function(target_link_frameworks_weak) + target_link_frameworks_generic("-weak_framework" ${ARGN}) endfunction() diff --git a/target_link_options_if_exists.cmake b/target_link_options_if_exists.cmake index acf9112..24a717d 100644 --- a/target_link_options_if_exists.cmake +++ b/target_link_options_if_exists.cmake @@ -7,14 +7,11 @@ include(CheckCXXCompilerFlag) function(target_link_options_if_exists target_name) - set(list ${ARGV}) - list(REMOVE_AT list 0) - set(writing_now "") set(private_options "") set(public_options "") set(interface_options "") - foreach (entry ${list}) + foreach (entry ${ARGN}) if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") set(writing_now ${entry}) else() diff --git a/target_link_static_libraries.cmake b/target_link_static_libraries.cmake index f011f02..41a747f 100644 --- a/target_link_static_libraries.cmake +++ b/target_link_static_libraries.cmake @@ -5,14 +5,11 @@ # https://github.com/desktop-app/legal/blob/master/LEGAL function(target_link_static_libraries target_name) - set(list ${ARGV}) - list(REMOVE_AT list 0) - set(writing_now "") set(private_libs "") set(public_libs "") set(interface_libs "") - foreach (entry ${list}) + foreach (entry ${ARGN}) if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") set(writing_now ${entry}) else() diff --git a/target_prepare_qrc.cmake b/target_prepare_qrc.cmake index 2d29c4e..342f41e 100644 --- a/target_prepare_qrc.cmake +++ b/target_prepare_qrc.cmake @@ -5,8 +5,7 @@ # https://github.com/desktop-app/legal/blob/master/LEGAL function(target_add_resource target_name) - set(list ${ARGV}) - list(REMOVE_AT list 0) + set(list ${ARGN}) target_sources(${target_name} PRIVATE ${list}) get_target_property(existing_resources ${target_name} RESOURCE) if (NOT "${existing_resources}" STREQUAL "existing_resources-NOTFOUND") From 6b0eeb2c15aa278ffa577bcefebcff8f2c98aca9 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 1 Jun 2023 23:18:26 +0400 Subject: [PATCH 127/215] Ensure cppgir is not getting installed --- external/glib/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/glib/CMakeLists.txt b/external/glib/CMakeLists.txt index 66385e3..20b62a7 100644 --- a/external/glib/CMakeLists.txt +++ b/external/glib/CMakeLists.txt @@ -11,7 +11,7 @@ function(add_cppgir) # isolate scope set(BUILD_TESTING OFF) set(BUILD_DOC OFF) set(CMAKE_DISABLE_FIND_PACKAGE_Qt5Core ON) - add_subdirectory(cppgir) + add_subdirectory(cppgir EXCLUDE_FROM_ALL) endfunction() add_cppgir() From 02e600c6f3af297c2e18af0ea5ee8320e5725554 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 5 Jun 2023 11:13:57 +0400 Subject: [PATCH 128/215] Fix non-special target LTO condition There was a missing $ sign resulting in the condition always being true While there, deduplicate the false value --- options_linux.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/options_linux.cmake b/options_linux.cmake index 7e9aec0..105a3b7 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -66,7 +66,9 @@ if (NOT DESKTOP_APP_USE_PACKAGED) ) endif() set(interprocedural_optimization_config $>>) - set(interprocedural_optimization_values -fwhole-program,$,$<$:-fno-use-linker-plugin>,-fno-use-linker-plugin>) + set(interprocedural_optimization_value_on -fwhole-program) + set(interprocedural_optimization_value_off -fno-use-linker-plugin) + set(interprocedural_optimization_values ${interprocedural_optimization_value_on},$<$>,$>:${interprocedural_optimization_value_off}>) target_link_options(common_options INTERFACE $>,$,${interprocedural_optimization_values}>,$>,${interprocedural_optimization_values}>> From a41fa6e14006204f3fea7993a775e14f8fdde9fc Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 5 Jun 2023 08:44:48 +0400 Subject: [PATCH 129/215] Always use Python3 cmake package instead of the Python one --- validate_d3d_compiler.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/validate_d3d_compiler.cmake b/validate_d3d_compiler.cmake index 8ebe770..a3d6919 100644 --- a/validate_d3d_compiler.cmake +++ b/validate_d3d_compiler.cmake @@ -46,10 +46,10 @@ function(validate_d3d_compiler target_name) endif() set(sdk_compiler ${windows_sdk_loc}/Redist/D3D/${modules_subdir}/d3dcompiler_47.dll) - find_package(Python REQUIRED) + find_package(Python3 REQUIRED) execute_process( COMMAND - ${Python_EXECUTABLE} + ${Python3_EXECUTABLE} ${cmake_helpers_loc}/validate_d3d_compiler.py ${sdk_compiler} OUTPUT_VARIABLE key From a1ec454cbcc1a6ce9970968e3413c9a4341968d0 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 6 Jun 2023 05:01:23 +0400 Subject: [PATCH 130/215] Enable control flow protection --- options_linux.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/options_linux.cmake b/options_linux.cmake index 105a3b7..eca8149 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -81,6 +81,7 @@ if (NOT DESKTOP_APP_USE_PACKAGED OR DESKTOP_APP_SPECIAL_TARGET) INTERFACE -fstack-protector-all -fstack-clash-protection + -fcf-protection ) target_link_options(common_options INTERFACE From 92ec041c38a432a4a282987d54f77457e71a2d4e Mon Sep 17 00:00:00 2001 From: mid-kid Date: Sat, 10 Jun 2023 16:01:28 +0200 Subject: [PATCH 131/215] Fix duplicate main declaration when linking with LLD https://github.com/gentoo/gentoo/blob/master/net-im/telegram-desktop/files/tdesktop-4.4.1-fix-dupe-main-decl.patch --- external/cld3/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/external/cld3/CMakeLists.txt b/external/cld3/CMakeLists.txt index 4686689..1da1aef 100644 --- a/external/cld3/CMakeLists.txt +++ b/external/cld3/CMakeLists.txt @@ -80,7 +80,6 @@ PRIVATE script_span/generated_entities.cc script_span/getonescriptspan.cc script_span/getonescriptspan.h - script_span/getonescriptspan_test.cc script_span/utf8statetable.cc script_span/offsetmap.cc script_span/text_processing.cc From 926c3119df0b9873537a19209277252004ef1af3 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 17 Jun 2023 02:50:51 +0400 Subject: [PATCH 132/215] Migrate from qt_static_plugins.cpp to the Qt6-pregenerated initializators --- external/fcitx5_qt/CMakeLists.txt | 5 ++ external/fcitx5_qt/init.cpp | 10 +++ external/fcitx_qt5/CMakeLists.txt | 5 ++ external/fcitx_qt5/init.cpp | 10 +++ external/hime_qt/CMakeLists.txt | 5 ++ external/hime_qt/init.cpp | 10 +++ external/kimageformats/CMakeLists.txt | 4 ++ external/kimageformats/init.cpp | 12 ++++ external/nimf_qt5/CMakeLists.txt | 5 ++ external/nimf_qt5/init.cpp | 10 +++ external/qt/CMakeLists.txt | 37 ++++++++++- .../qt_static_plugins/qt_static_plugins.cpp | 64 +------------------ 12 files changed, 112 insertions(+), 65 deletions(-) create mode 100644 external/fcitx5_qt/init.cpp create mode 100644 external/fcitx_qt5/init.cpp create mode 100644 external/hime_qt/init.cpp create mode 100644 external/kimageformats/init.cpp create mode 100644 external/nimf_qt5/init.cpp diff --git a/external/fcitx5_qt/CMakeLists.txt b/external/fcitx5_qt/CMakeLists.txt index b002d59..0d76b46 100644 --- a/external/fcitx5_qt/CMakeLists.txt +++ b/external/fcitx5_qt/CMakeLists.txt @@ -22,6 +22,11 @@ set(FCITX5_QT_EXTRA_PLUGIN_NAME "") configure_file("${fcitx5_qt_src}/fcitx5.json.in" "${CMAKE_CURRENT_BINARY_DIR}/fcitx5.json") +nice_target_sources(external_fcitx5_qt ${CMAKE_CURRENT_SOURCE_DIR} +PRIVATE + init.cpp +) + nice_target_sources(external_fcitx5_qt ${fcitx5_qt_src} PRIVATE qfcitxplatforminputcontext.cpp diff --git a/external/fcitx5_qt/init.cpp b/external/fcitx5_qt/init.cpp new file mode 100644 index 0000000..d8adcf1 --- /dev/null +++ b/external/fcitx5_qt/init.cpp @@ -0,0 +1,10 @@ +/* +This file is part of Desktop App Toolkit, +a set of libraries for developing nice desktop applications. + +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL +*/ +#include + +Q_IMPORT_PLUGIN(QFcitx5PlatformInputContextPlugin) diff --git a/external/fcitx_qt5/CMakeLists.txt b/external/fcitx_qt5/CMakeLists.txt index 7f4a8b5..76337c8 100644 --- a/external/fcitx_qt5/CMakeLists.txt +++ b/external/fcitx_qt5/CMakeLists.txt @@ -19,6 +19,11 @@ set(fcitx_qt5_src ${fcitx_qt5_loc}/qt${QT_VERSION_MAJOR}/platforminputcontext) set_target_properties(external_fcitx_qt5 PROPERTIES AUTOMOC ON) +nice_target_sources(external_fcitx_qt5 ${CMAKE_CURRENT_SOURCE_DIR} +PRIVATE + init.cpp +) + nice_target_sources(external_fcitx_qt5 ${fcitx_qt5_src} PRIVATE fcitxinputcontextproxy.cpp diff --git a/external/fcitx_qt5/init.cpp b/external/fcitx_qt5/init.cpp new file mode 100644 index 0000000..86d9dd1 --- /dev/null +++ b/external/fcitx_qt5/init.cpp @@ -0,0 +1,10 @@ +/* +This file is part of Desktop App Toolkit, +a set of libraries for developing nice desktop applications. + +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL +*/ +#include + +Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin) diff --git a/external/hime_qt/CMakeLists.txt b/external/hime_qt/CMakeLists.txt index 869b10f..562f0d7 100644 --- a/external/hime_qt/CMakeLists.txt +++ b/external/hime_qt/CMakeLists.txt @@ -19,6 +19,11 @@ set(hime_qt_src ${hime_loc}/src/qt5-im) set_target_properties(external_hime_qt PROPERTIES AUTOMOC ON) +nice_target_sources(external_hime_qt ${CMAKE_CURRENT_SOURCE_DIR} +PRIVATE + init.cpp +) + nice_target_sources(external_hime_qt ${hime_qt_src} PRIVATE hime-imcontext-qt.cpp diff --git a/external/hime_qt/init.cpp b/external/hime_qt/init.cpp new file mode 100644 index 0000000..d7b9784 --- /dev/null +++ b/external/hime_qt/init.cpp @@ -0,0 +1,10 @@ +/* +This file is part of Desktop App Toolkit, +a set of libraries for developing nice desktop applications. + +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL +*/ +#include + +Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin) diff --git a/external/kimageformats/CMakeLists.txt b/external/kimageformats/CMakeLists.txt index 813ce77..121eed5 100644 --- a/external/kimageformats/CMakeLists.txt +++ b/external/kimageformats/CMakeLists.txt @@ -30,6 +30,10 @@ DEPENDS ${kimageformats_src}/jxl.json ) +nice_target_sources(external_kimageformats ${CMAKE_CURRENT_SOURCE_DIR} +PRIVATE + init.cpp +) nice_target_sources(external_kimageformats ${kimageformats_src} PRIVATE avif.cpp diff --git a/external/kimageformats/init.cpp b/external/kimageformats/init.cpp new file mode 100644 index 0000000..9713d57 --- /dev/null +++ b/external/kimageformats/init.cpp @@ -0,0 +1,12 @@ +/* +This file is part of Desktop App Toolkit, +a set of libraries for developing nice desktop applications. + +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL +*/ +#include + +Q_IMPORT_PLUGIN(QAVIFPlugin) +Q_IMPORT_PLUGIN(HEIFPlugin) +Q_IMPORT_PLUGIN(QJpegXLPlugin) diff --git a/external/nimf_qt5/CMakeLists.txt b/external/nimf_qt5/CMakeLists.txt index c409663..53b0803 100644 --- a/external/nimf_qt5/CMakeLists.txt +++ b/external/nimf_qt5/CMakeLists.txt @@ -20,6 +20,11 @@ set(nimf_qt5_src ${nimf_loc}/modules/clients/qt5) set_target_properties(external_nimf_qt5 PROPERTIES AUTOMOC ON) +nice_target_sources(external_nimf_qt5 ${CMAKE_CURRENT_SOURCE_DIR} +PRIVATE + init.cpp +) + nice_target_sources(external_nimf_qt5 ${nimf_qt5_src} PRIVATE im-nimf-qt5.cpp diff --git a/external/nimf_qt5/init.cpp b/external/nimf_qt5/init.cpp new file mode 100644 index 0000000..491fc1f --- /dev/null +++ b/external/nimf_qt5/init.cpp @@ -0,0 +1,10 @@ +/* +This file is part of Desktop App Toolkit, +a set of libraries for developing nice desktop applications. + +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL +*/ +#include + +Q_IMPORT_PLUGIN(NimfInputContextPlugin) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 4b6829f..1223c6a 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -149,6 +149,14 @@ else() endif() set(qt_libs_list "") +if (QT_VERSION_MAJOR GREATER_EQUAL 6) + list(APPEND qt_libs_list + $ + $ + $ + ) +endif() + if (WIN32) target_include_directories(external_qt SYSTEM INTERFACE @@ -186,12 +194,15 @@ elseif (APPLE) plugins/tls/${qt_lib_prefix}qsecuretransportbackend plugins/networkinformation/${qt_lib_prefix}qscnetworkreachability ) + list(APPEND qt_libs_list + $ + $ + $ + $ + ) foreach (lib ${qt_libs}) list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}") endforeach() - list(APPEND qt_libs_list - $ - ) else() set(qt_libs plugins/platforminputcontexts/${qt_lib_prefix}composeplatforminputcontextplugin @@ -204,6 +215,15 @@ else() lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}XcbQpa ${common_qt_libs} ) + list(APPEND qt_libs_list + $ + $ + $ + $ + $ + $ + $ + ) if (TARGET Qt::DBus) list(APPEND qt_libs plugins/platforminputcontexts/${qt_lib_prefix}ibusplatforminputcontextplugin @@ -211,6 +231,10 @@ else() lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}DBus lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Core ) + list(APPEND qt_libs_list + $ + $ + ) endif() if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) list(PREPEND qt_libs @@ -222,6 +246,13 @@ else() lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}WaylandEglClientHwIntegration lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}WaylandClient ) + list(APPEND qt_libs_list + $ + $ + $ + $ + $ + ) endif() if (TARGET Qt::WaylandCompositor) list(PREPEND qt_libs diff --git a/external/qt/qt_static_plugins/qt_static_plugins.cpp b/external/qt/qt_static_plugins/qt_static_plugins.cpp index f6580f4..af68849 100644 --- a/external/qt/qt_static_plugins/qt_static_plugins.cpp +++ b/external/qt/qt_static_plugins/qt_static_plugins.cpp @@ -7,70 +7,10 @@ https://github.com/desktop-app/legal/blob/master/LEGAL */ #include -#ifndef DESKTOP_APP_USE_PACKAGED -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - -#ifdef Q_OS_MAC -Q_IMPORT_PLUGIN(QSecureTransportBackend) -Q_IMPORT_PLUGIN(QSCNetworkReachabilityNetworkInformationBackendFactory) -#else // Q_OS_MAC -Q_IMPORT_PLUGIN(QTlsBackendOpenSSL) -#endif // Q_OS_MAC - -#else // Qt >= 6.0.0 +#if !defined DESKTOP_APP_USE_PACKAGED && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && defined Q_OS_WIN Q_IMPORT_PLUGIN(QGenericEnginePlugin) -#endif // Qt < 6.0.0 - Q_IMPORT_PLUGIN(QWebpPlugin) Q_IMPORT_PLUGIN(QJpegPlugin) Q_IMPORT_PLUGIN(QGifPlugin) - -#ifdef Q_OS_WIN Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) -#elif defined Q_OS_MAC // Q_OS_WIN -Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) -#elif defined Q_OS_UNIX // Q_OS_WIN | Q_OS_MAC -Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) -Q_IMPORT_PLUGIN(QXcbEglIntegrationPlugin) -Q_IMPORT_PLUGIN(QXcbGlxIntegrationPlugin) -Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin) -Q_IMPORT_PLUGIN(QSvgIconPlugin) -#ifdef QT_DBUS_LIB -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) -Q_IMPORT_PLUGIN(QConnmanEnginePlugin) -Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin) -#endif // Qt < 6.0.0 -Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin) -Q_IMPORT_PLUGIN(QXdgDesktopPortalThemePlugin) -#endif // QT_DBUS_LIB -#ifndef DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION -Q_IMPORT_PLUGIN(QWaylandIntegrationPlugin) -Q_IMPORT_PLUGIN(QWaylandEglPlatformIntegrationPlugin) -Q_IMPORT_PLUGIN(QWaylandEglClientBufferPlugin) -Q_IMPORT_PLUGIN(QWaylandXdgShellIntegrationPlugin) -Q_IMPORT_PLUGIN(QWaylandBradientDecorationPlugin) -#endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION -Q_IMPORT_PLUGIN(QGtk3ThemePlugin) -#endif // Q_OS_WIN | Q_OS_MAC | Q_OS_UNIX -#endif // !DESKTOP_APP_USE_PACKAGED - -#if !defined DESKTOP_APP_USE_PACKAGED || defined DESKTOP_APP_USE_PACKAGED_LAZY -#if defined Q_OS_WIN || (defined Q_OS_UNIX && !defined Q_OS_MAC) -Q_IMPORT_PLUGIN(QAVIFPlugin) -Q_IMPORT_PLUGIN(HEIFPlugin) -Q_IMPORT_PLUGIN(QJpegXLPlugin) -#endif // Q_OS_WIN || (Q_OS_UNIX && !Q_OS_MAC) - -#if defined Q_OS_UNIX && !defined Q_OS_MAC -Q_IMPORT_PLUGIN(NimfInputContextPlugin) -#ifdef QT_DBUS_LIB -Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin) -#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION -Q_IMPORT_PLUGIN(QFcitx5PlatformInputContextPlugin) -#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION -#endif // QT_DBUS_LIB -#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION -Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin) -#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION -#endif // Q_OS_UNIX && !Q_OS_MAC -#endif // !DESKTOP_APP_USE_PACKAGED || DESKTOP_APP_USE_PACKAGED_LAZY +#endif // !DESKTOP_APP_USE_PACKAGED && Qt < 6.0.0 && Q_OS_WIN From 9e47fc7e2042fc723785b99753a67eb298e296ca Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 18 Jun 2023 20:17:06 +0400 Subject: [PATCH 133/215] Get rid of QML --- external/qt/CMakeLists.txt | 49 +------------------------------------- external/qt/package.cmake | 2 +- 2 files changed, 2 insertions(+), 49 deletions(-) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 1223c6a..c95399a 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -23,7 +23,6 @@ if (DESKTOP_APP_USE_PACKAGED) Qt::Network Qt::Svg $ - $ $ $ $ @@ -42,7 +41,6 @@ INTERFACE $<$:${qt_loc}/include/QtOpenGLWidgets> ${qt_loc}/include/QtSvg $<$:${qt_loc}/include/QtDBus> - $<$:${qt_loc}/include/QtQml> $<$:${qt_loc}/include/QtQuick> $<$:${qt_loc}/include/QtQuickWidgets> $<$:${qt_loc}/include/QtWaylandCompositor> @@ -67,7 +65,6 @@ INTERFACE QT_NETWORK_LIB QT_SVG_LIB $<$:QT_DBUS_LIB> - $<$:QT_QML_LIB> $<$:QT_QUICK_LIB> $<$:QT_QUICKWIDGETS_LIB> $<$:QT_WAYLANDCOMPOSITOR_LIB> @@ -108,23 +105,10 @@ if (TARGET Qt::OpenGLWidgets) ) endif() -if (TARGET Qt::Qml) - list(PREPEND common_qt_libs - qml/QtQml/WorkerScript/${qt_lib_prefix}workerscriptplugin - qml/QtQml/Models/${qt_lib_prefix}modelsplugin - qml/QtQml/Base/${qt_lib_prefix}qmlplugin - qml/QtQml/${qt_lib_prefix}qmlmetaplugin - lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}QmlWorkerScript - lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}QmlModels - lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Qml - ) -endif() - if (TARGET Qt::Quick) list(PREPEND common_qt_libs - qml/QtQuick/Window/${qt_lib_prefix}quickwindowplugin - qml/QtQuick/${qt_lib_prefix}qtquick2plugin lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Quick + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Qml ) endif() @@ -261,20 +245,6 @@ else() list(APPEND qt_libs_list $ ) - if (TARGET Qt::Quick) - list(PREPEND qt_libs - qml/QtWayland/Compositor/${qt_lib_prefix}qwaylandcompositorplugin - qml/QtWayland/Compositor/XdgShell/${qt_lib_prefix}waylandcompositorxdgshellplugin - ) - list(APPEND qt_libs_list - $ - $ - $ - $ - $ - $ - ) - endif() endif() foreach (lib ${qt_libs}) list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}") @@ -290,26 +260,9 @@ if (QT_VERSION_MAJOR GREATER_EQUAL 6) $ ) - if (TARGET Qt::Qml) - list(APPEND qt_libs_list - $ - $ - $ - $ - $ - $ - $ - $ - ) - endif() - if (TARGET Qt::Quick) list(APPEND qt_libs_list - $ - $ - $ $ - $ ) endif() endif() diff --git a/external/qt/package.cmake b/external/qt/package.cmake index cc16466..b54c346 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -34,7 +34,7 @@ if (NOT DEFINED QT_VERSION_MAJOR) endif() find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets Network Svg REQUIRED) -find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS Qml Quick QuickWidgets QUIET) +find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS Quick QuickWidgets QUIET) set(qt_version_6_5_or_greater 0) if (QT_VERSION_MAJOR GREATER_EQUAL 6) From 0811c5f4469e4da50e9ca0034913569e05913cc5 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 20 Jun 2023 21:59:32 +0400 Subject: [PATCH 134/215] Add interface file as dependency to generate_dbus This ensures the code gets updated as the file changes --- external/glib/generate_dbus.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/external/glib/generate_dbus.cmake b/external/glib/generate_dbus.cmake index 77ee46e..98a4c9e 100644 --- a/external/glib/generate_dbus.cmake +++ b/external/glib/generate_dbus.cmake @@ -40,6 +40,7 @@ function(generate_dbus target_name interface_prefix namespace interface_file) COMMENT "Generating D-Bus C code for ${namespace} (${target_name})" DEPENDS ${DESKTOP_APP_GDBUSCODEGEN} + ${interface_file} ) add_library(${target_name}_${namespace}_dbus STATIC) From 179fe08842d328e5a9fd9302192624f2dd37f714 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 25 Jun 2023 11:07:45 +0400 Subject: [PATCH 135/215] Switch WaylandClient platform plugins to target check Just like DBus and WaylandCompositor do --- CMakeLists.txt | 4 +--- external/qt/CMakeLists.txt | 4 ++-- external/qt/package.cmake | 7 +------ 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 45db2f2..1a896fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,9 +11,7 @@ endif() if (LINUX AND NOT DESKTOP_APP_USE_PACKAGED) add_subdirectory(linux_xcb_helper) endif() -if (LINUX - AND NOT DESKTOP_APP_USE_PACKAGED - AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) +if (LINUX AND NOT DESKTOP_APP_USE_PACKAGED) add_subdirectory(linux_wayland_helper) endif() if (DESKTOP_APP_USE_ALLOCATION_TRACER) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index c95399a..78e9d51 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -220,7 +220,7 @@ else() $ ) endif() - if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) + if (TARGET Qt::WaylandClient) list(PREPEND qt_libs plugins/platforms/${qt_lib_prefix}qwayland-generic plugins/platforms/${qt_lib_prefix}qwayland-egl @@ -305,7 +305,7 @@ if (LINUX) xcb-render-util xcb-keysyms ) - if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) + if (TARGET Qt::WaylandClient) target_link_libraries(external_qt INTERFACE desktop-app::linux_wayland_helper diff --git a/external/qt/package.cmake b/external/qt/package.cmake index b54c346..b306ba7 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -48,12 +48,7 @@ endif() cmake_dependent_option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code for Wayland integration." OFF "LINUX; qt_version_6_5_or_greater" ON) if (LINUX) - if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) - find_package(Qt${QT_VERSION_MAJOR} COMPONENTS WaylandClient REQUIRED) - find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS WaylandCompositor QUIET) - endif() - - find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS DBus QUIET) + find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS DBus WaylandClient WaylandCompositor QUIET) endif() set_property(GLOBAL PROPERTY AUTOGEN_SOURCE_GROUP "(gen)") From 5b4917c75a00bd8db49057cbb3f33e4de23e4937 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 25 Jun 2023 14:39:04 +0400 Subject: [PATCH 136/215] Revert 179fe08842d328e5a9fd9302192624f2dd37f714 partially The WaylandClient package is required for cmake functions --- external/qt/package.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/external/qt/package.cmake b/external/qt/package.cmake index b306ba7..2925ac0 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -49,6 +49,10 @@ cmake_dependent_option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code if (LINUX) find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS DBus WaylandClient WaylandCompositor QUIET) + + if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) + find_package(Qt${QT_VERSION_MAJOR} COMPONENTS WaylandClient REQUIRED) + endif() endif() set_property(GLOBAL PROPERTY AUTOGEN_SOURCE_GROUP "(gen)") From ee430ed96af129fa837d19c1cb755851150e7426 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 25 Jun 2023 14:43:44 +0400 Subject: [PATCH 137/215] Custom message when Qt is not found Thus both Qt6 and Qt5 are mentioned --- external/qt/package.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/external/qt/package.cmake b/external/qt/package.cmake index 2925ac0..2fcdf98 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -29,7 +29,10 @@ if (NOT DEFINED QT_VERSION_MAJOR) find_package(QT NAMES Qt6 COMPONENTS Core) endif() if (NOT QT_FOUND) - find_package(QT NAMES Qt5 COMPONENTS Core REQUIRED) + find_package(QT NAMES Qt5 COMPONENTS Core) + endif() + if (NOT QT_FOUND) + message(FATAL_ERROR "Neither Qt6 nor Qt5 is found") endif() endif() From 9d7428a03ac17afecf60b4c6a5c093e648d516b5 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 25 Jun 2023 15:17:05 +0400 Subject: [PATCH 138/215] Update cppgir --- external/glib/cppgir | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/glib/cppgir b/external/glib/cppgir index ed2afc9..70b0e3d 160000 --- a/external/glib/cppgir +++ b/external/glib/cppgir @@ -1 +1 @@ -Subproject commit ed2afc920bfdc663bd54239716403500815ac08a +Subproject commit 70b0e3d522cec60316d116dcbd919b797e85685a From ca2719ff3f8c97a1aa19ccde7a15f2f2e3740abe Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 25 Jun 2023 20:17:23 +0400 Subject: [PATCH 139/215] Create separate targets for plugin initializers --- external/fcitx5_qt/CMakeLists.txt | 25 ++++++++++++++++++++----- external/fcitx_qt5/CMakeLists.txt | 25 ++++++++++++++++++++----- external/hime_qt/CMakeLists.txt | 25 ++++++++++++++++++++----- external/kimageformats/CMakeLists.txt | 24 ++++++++++++++++++++---- external/nimf_qt5/CMakeLists.txt | 25 ++++++++++++++++++++----- 5 files changed, 100 insertions(+), 24 deletions(-) diff --git a/external/fcitx5_qt/CMakeLists.txt b/external/fcitx5_qt/CMakeLists.txt index 0d76b46..bfca166 100644 --- a/external/fcitx5_qt/CMakeLists.txt +++ b/external/fcitx5_qt/CMakeLists.txt @@ -22,11 +22,6 @@ set(FCITX5_QT_EXTRA_PLUGIN_NAME "") configure_file("${fcitx5_qt_src}/fcitx5.json.in" "${CMAKE_CURRENT_BINARY_DIR}/fcitx5.json") -nice_target_sources(external_fcitx5_qt ${CMAKE_CURRENT_SOURCE_DIR} -PRIVATE - init.cpp -) - nice_target_sources(external_fcitx5_qt ${fcitx5_qt_src} PRIVATE qfcitxplatforminputcontext.cpp @@ -84,3 +79,23 @@ else() xkbcommon ) endif() + +add_library(external_fcitx5_qt_init OBJECT) +add_library(desktop-app::external_fcitx5_qt_init ALIAS external_fcitx5_qt_init) +init_target(external_fcitx5_qt_init "(external)") + +nice_target_sources(external_fcitx5_qt_init ${CMAKE_CURRENT_SOURCE_DIR} +PRIVATE + init.cpp +) + +target_link_libraries(external_fcitx5_qt_init +PRIVATE + desktop-app::external_qt +) + +target_link_libraries(external_fcitx5_qt +INTERFACE + external_fcitx5_qt_init + $ +) diff --git a/external/fcitx_qt5/CMakeLists.txt b/external/fcitx_qt5/CMakeLists.txt index 76337c8..8945c84 100644 --- a/external/fcitx_qt5/CMakeLists.txt +++ b/external/fcitx_qt5/CMakeLists.txt @@ -19,11 +19,6 @@ set(fcitx_qt5_src ${fcitx_qt5_loc}/qt${QT_VERSION_MAJOR}/platforminputcontext) set_target_properties(external_fcitx_qt5 PROPERTIES AUTOMOC ON) -nice_target_sources(external_fcitx_qt5 ${CMAKE_CURRENT_SOURCE_DIR} -PRIVATE - init.cpp -) - nice_target_sources(external_fcitx_qt5 ${fcitx_qt5_src} PRIVATE fcitxinputcontextproxy.cpp @@ -80,3 +75,23 @@ else() xkbcommon ) endif() + +add_library(external_fcitx_qt5_init OBJECT) +add_library(desktop-app::external_fcitx_qt5_init ALIAS external_fcitx_qt5_init) +init_target(external_fcitx_qt5_init "(external)") + +nice_target_sources(external_fcitx_qt5_init ${CMAKE_CURRENT_SOURCE_DIR} +PRIVATE + init.cpp +) + +target_link_libraries(external_fcitx_qt5_init +PRIVATE + desktop-app::external_qt +) + +target_link_libraries(external_fcitx_qt5 +INTERFACE + external_fcitx_qt5_init + $ +) diff --git a/external/hime_qt/CMakeLists.txt b/external/hime_qt/CMakeLists.txt index 562f0d7..6f8d744 100644 --- a/external/hime_qt/CMakeLists.txt +++ b/external/hime_qt/CMakeLists.txt @@ -19,11 +19,6 @@ set(hime_qt_src ${hime_loc}/src/qt5-im) set_target_properties(external_hime_qt PROPERTIES AUTOMOC ON) -nice_target_sources(external_hime_qt ${CMAKE_CURRENT_SOURCE_DIR} -PRIVATE - init.cpp -) - nice_target_sources(external_hime_qt ${hime_qt_src} PRIVATE hime-imcontext-qt.cpp @@ -48,3 +43,23 @@ PRIVATE desktop-app::external_hime_im_client desktop-app::external_qt ) + +add_library(external_hime_qt_init OBJECT) +add_library(desktop-app::external_hime_qt_init ALIAS external_hime_qt_init) +init_target(external_hime_qt_init "(external)") + +nice_target_sources(external_hime_qt_init ${CMAKE_CURRENT_SOURCE_DIR} +PRIVATE + init.cpp +) + +target_link_libraries(external_hime_qt_init +PRIVATE + desktop-app::external_qt +) + +target_link_libraries(external_hime_qt +INTERFACE + external_hime_qt_init + $ +) diff --git a/external/kimageformats/CMakeLists.txt b/external/kimageformats/CMakeLists.txt index 121eed5..d501ac5 100644 --- a/external/kimageformats/CMakeLists.txt +++ b/external/kimageformats/CMakeLists.txt @@ -30,10 +30,6 @@ DEPENDS ${kimageformats_src}/jxl.json ) -nice_target_sources(external_kimageformats ${CMAKE_CURRENT_SOURCE_DIR} -PRIVATE - init.cpp -) nice_target_sources(external_kimageformats ${kimageformats_src} PRIVATE avif.cpp @@ -109,3 +105,23 @@ else() lcms2 ) endif() + +add_library(external_kimageformats_init OBJECT) +add_library(desktop-app::external_kimageformats_init ALIAS external_kimageformats_init) +init_target(external_kimageformats_init "(external)") + +nice_target_sources(external_kimageformats_init ${CMAKE_CURRENT_SOURCE_DIR} +PRIVATE + init.cpp +) + +target_link_libraries(external_kimageformats_init +PRIVATE + desktop-app::external_qt +) + +target_link_libraries(external_kimageformats +INTERFACE + external_kimageformats_init + $ +) diff --git a/external/nimf_qt5/CMakeLists.txt b/external/nimf_qt5/CMakeLists.txt index 53b0803..d4b0524 100644 --- a/external/nimf_qt5/CMakeLists.txt +++ b/external/nimf_qt5/CMakeLists.txt @@ -20,11 +20,6 @@ set(nimf_qt5_src ${nimf_loc}/modules/clients/qt5) set_target_properties(external_nimf_qt5 PROPERTIES AUTOMOC ON) -nice_target_sources(external_nimf_qt5 ${CMAKE_CURRENT_SOURCE_DIR} -PRIVATE - init.cpp -) - nice_target_sources(external_nimf_qt5 ${nimf_qt5_src} PRIVATE im-nimf-qt5.cpp @@ -53,3 +48,23 @@ target_link_libraries(external_nimf_qt5 PRIVATE desktop-app::external_qt ) + +add_library(external_nimf_qt5_init OBJECT) +add_library(desktop-app::external_nimf_qt5_init ALIAS external_nimf_qt5_init) +init_target(external_nimf_qt5_init "(external)") + +nice_target_sources(external_nimf_qt5_init ${CMAKE_CURRENT_SOURCE_DIR} +PRIVATE + init.cpp +) + +target_link_libraries(external_nimf_qt5_init +PRIVATE + desktop-app::external_qt +) + +target_link_libraries(external_nimf_qt5 +INTERFACE + external_nimf_qt5_init + $ +) From cca37b4da9e9d33f9dae7734a5ffabe05efcfec4 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 27 Jun 2023 02:57:46 +0400 Subject: [PATCH 140/215] Use the new possibility to disable cppgir examples --- external/glib/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/glib/CMakeLists.txt b/external/glib/CMakeLists.txt index 20b62a7..2966200 100644 --- a/external/glib/CMakeLists.txt +++ b/external/glib/CMakeLists.txt @@ -10,7 +10,7 @@ add_library(desktop-app::external_glib ALIAS external_glib) function(add_cppgir) # isolate scope set(BUILD_TESTING OFF) set(BUILD_DOC OFF) - set(CMAKE_DISABLE_FIND_PACKAGE_Qt5Core ON) + set(BUILD_EXAMPLES OFF) add_subdirectory(cppgir EXCLUDE_FROM_ALL) endfunction() add_cppgir() From 656ef7e259c06734bcee7519099fcb0e1e9b62c9 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 27 Jun 2023 03:23:59 +0400 Subject: [PATCH 141/215] Fix build with make --- external/glib/generate_dbus.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/external/glib/generate_dbus.cmake b/external/glib/generate_dbus.cmake index 98a4c9e..869cbd1 100644 --- a/external/glib/generate_dbus.cmake +++ b/external/glib/generate_dbus.cmake @@ -53,6 +53,7 @@ function(generate_dbus target_name interface_prefix namespace interface_file) target_link_libraries(${target_name}_${namespace} INTERFACE ${target_name}_${namespace}_dbus) generate_gir(${target_name}_${namespace} ${namespace} Gio-2.0 ${target_name}_${namespace}_dbus) generate_cppgir(${target_name}_${namespace} ${CMAKE_CURRENT_BINARY_DIR}/gen/${target_name}_${namespace}.gir) + add_dependencies(${target_name}_${namespace}_cppgir ${target_name}_${namespace}_gir) get_target_property(target_type ${target_name} TYPE) if (${target_type} STREQUAL "INTERFACE_LIBRARY") From dbc4f3aaed033915f8014fdbb6d115ec566c205a Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 27 Jun 2023 19:07:42 +0400 Subject: [PATCH 142/215] Disable cppgir warnings They're too verbose --- external/glib/generate_cppgir.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/external/glib/generate_cppgir.cmake b/external/glib/generate_cppgir.cmake index 743b77f..a95d513 100644 --- a/external/glib/generate_cppgir.cmake +++ b/external/glib/generate_cppgir.cmake @@ -21,6 +21,8 @@ function(generate_cppgir target_name gir) ${gen_timestamp} COMMAND cppgir + --debug + 1 --class --expected --ignore From 44722b372ebef2605ecd8ca843618c2e65e57f60 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 27 Jun 2023 21:51:14 +0400 Subject: [PATCH 143/215] Forward cmake return code --- run_cmake.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/run_cmake.py b/run_cmake.py index ccfb873..74f2e1e 100644 --- a/run_cmake.py +++ b/run_cmake.py @@ -66,6 +66,4 @@ def run(project, arguments, buildType=''): os.remove(full) print('Cleared previous.') os.chdir(basePath) - subprocess.call(command, shell=True) - - return 0 + return subprocess.call(command, shell=True) From 6fcd7970f56b0254d0b58964d3bbea1bddb935d6 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 1 Jul 2023 16:17:07 +0400 Subject: [PATCH 144/215] Update cppgir --- external/glib/cppgir | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/glib/cppgir b/external/glib/cppgir index 70b0e3d..ada922a 160000 --- a/external/glib/cppgir +++ b/external/glib/cppgir @@ -1 +1 @@ -Subproject commit 70b0e3d522cec60316d116dcbd919b797e85685a +Subproject commit ada922a260479da27c989e39ed47e17a36cc2969 From 3eec2fe482d4a9afcf8c5ae78da647f277bcc6f0 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 1 Jul 2023 17:12:14 +0400 Subject: [PATCH 145/215] Make g-ir-scanner quiet as well --- external/glib/generate_gir.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/external/glib/generate_gir.cmake b/external/glib/generate_gir.cmake index 81fe796..643d049 100644 --- a/external/glib/generate_gir.cmake +++ b/external/glib/generate_gir.cmake @@ -20,6 +20,7 @@ function(generate_gir target_name namespace deps src_target_name) ${gen_file} COMMAND ${DESKTOP_APP_GIRSCANNER} + --quiet -n ${namespace} --nsversion From f20e647e297b6dd006e77f288465e6a1cdab10e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Novomesk=C3=BD?= Date: Tue, 27 Jun 2023 11:22:11 +0200 Subject: [PATCH 146/215] Update library name on Windows New version of libheif changed library name --- external/kimageformats/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/kimageformats/CMakeLists.txt b/external/kimageformats/CMakeLists.txt index d501ac5..5aa377b 100644 --- a/external/kimageformats/CMakeLists.txt +++ b/external/kimageformats/CMakeLists.txt @@ -80,7 +80,7 @@ elseif (WIN32) PRIVATE ${libs_loc}/libavif/$,Debug,Release>/avif.lib ${libs_loc}/libheif/libheif/$,Debug,Release>/heif.lib - ${libs_loc}/libde265/libde265/$,Debug,Release>/de265.lib + ${libs_loc}/libde265/libde265/$,Debug,Release>/libde265.lib ${libs_loc}/dav1d/builddir-$,debug,release>/src/libdav1d.a ${libs_loc}/libjxl/lib/$,Debug,Release>/jxl-static.lib ${libs_loc}/libjxl/lib/$,Debug,Release>/jxl_threads-static.lib From f097715e299c496fa33bb66f51e848296244589c Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 12 Jul 2023 21:55:48 +0400 Subject: [PATCH 147/215] Use fast linking by lld in Debug builds. --- options_linux.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/options_linux.cmake b/options_linux.cmake index eca8149..3b97be4 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -53,6 +53,8 @@ if (NOT DESKTOP_APP_USE_PACKAGED) INTERFACE -static-libstdc++ -static-libgcc + $<$:-fuse-ld=lld> + $<$:-s> ) elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_link_static_libraries(common_options From 982546b169df3d479e6511425870327559b38a89 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 12 Jul 2023 22:01:06 +0400 Subject: [PATCH 148/215] Force usage of GSL fork because of a libstdc++ bug. --- external/gsl/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/external/gsl/CMakeLists.txt b/external/gsl/CMakeLists.txt index adc4353..af8b9b4 100644 --- a/external/gsl/CMakeLists.txt +++ b/external/gsl/CMakeLists.txt @@ -7,6 +7,7 @@ add_library(external_gsl INTERFACE IMPORTED GLOBAL) add_library(desktop-app::external_gsl ALIAS external_gsl) +#[[ if (DESKTOP_APP_USE_PACKAGED) if (DESKTOP_APP_USE_PACKAGED_LAZY) find_package(Microsoft.GSL 4.0.0 QUIET) @@ -19,6 +20,7 @@ if (DESKTOP_APP_USE_PACKAGED) return() endif() endif() +]] target_include_directories(external_gsl SYSTEM INTERFACE From 6d67365e52480edbde2b2596844c26b56a8644dc Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 14 Jul 2023 15:38:23 +0400 Subject: [PATCH 149/215] Revert "Use fast linking by lld in Debug builds." This reverts commit f097715e299c496fa33bb66f51e848296244589c. Maybe it will re-enabled after deprecating old systems. --- options_linux.cmake | 2 -- 1 file changed, 2 deletions(-) diff --git a/options_linux.cmake b/options_linux.cmake index 3b97be4..eca8149 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -53,8 +53,6 @@ if (NOT DESKTOP_APP_USE_PACKAGED) INTERFACE -static-libstdc++ -static-libgcc - $<$:-fuse-ld=lld> - $<$:-s> ) elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_link_static_libraries(common_options From 0620bb7b87a0ec9195151fd5eb0cf38656c1280b Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 17 Jun 2023 16:01:49 +0400 Subject: [PATCH 150/215] Use new glibmm 2.78 API --- external/glibmm/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/external/glibmm/CMakeLists.txt b/external/glibmm/CMakeLists.txt index 8547890..1251d88 100644 --- a/external/glibmm/CMakeLists.txt +++ b/external/glibmm/CMakeLists.txt @@ -8,8 +8,8 @@ add_library(external_glibmm INTERFACE IMPORTED GLOBAL) add_library(desktop-app::external_glibmm ALIAS external_glibmm) find_package(PkgConfig REQUIRED) -pkg_check_modules(GLIBMM REQUIRED IMPORTED_TARGET glibmm-2.68>=2.76) -pkg_check_modules(GIOMM REQUIRED IMPORTED_TARGET giomm-2.68>=2.76) +pkg_check_modules(GLIBMM REQUIRED IMPORTED_TARGET glibmm-2.68>=2.77) +pkg_check_modules(GIOMM REQUIRED IMPORTED_TARGET giomm-2.68>=2.77) if (DESKTOP_APP_USE_PACKAGED) target_link_libraries(external_glibmm From d1c98b4c472c7b59c239006a06d7a784a60a347f Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 1 Aug 2023 16:05:10 +0400 Subject: [PATCH 151/215] Update cppgir --- external/glib/cppgir | 2 +- external/glib/generate_cppgir.cmake | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/external/glib/cppgir b/external/glib/cppgir index ada922a..82fd185 160000 --- a/external/glib/cppgir +++ b/external/glib/cppgir @@ -1 +1 @@ -Subproject commit ada922a260479da27c989e39ed47e17a36cc2969 +Subproject commit 82fd18518cea24eeba8dcbe3909c72498935457c diff --git a/external/glib/generate_cppgir.cmake b/external/glib/generate_cppgir.cmake index a95d513..1a6b41e 100644 --- a/external/glib/generate_cppgir.cmake +++ b/external/glib/generate_cppgir.cmake @@ -24,6 +24,7 @@ function(generate_cppgir target_name gir) --debug 1 --class + --class-full --expected --ignore ${cmake_helpers_loc}/external/glib/cppgir/data/cppgir.ignore:${cmake_helpers_loc}/external/glib/cppgir/data/cppgir_unix.ignore From 8714461f776e24bc2a7b8fa1898fb658db806d7e Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 4 Aug 2023 19:00:52 +0400 Subject: [PATCH 152/215] Update cppgir to the namespaced targets --- external/glib/cppgir | 2 +- external/glib/generate_cppgir.cmake | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/external/glib/cppgir b/external/glib/cppgir index 82fd185..ef6d50a 160000 --- a/external/glib/cppgir +++ b/external/glib/cppgir @@ -1 +1 @@ -Subproject commit 82fd18518cea24eeba8dcbe3909c72498935457c +Subproject commit ef6d50ababb13ab7c9a13cc46d3500d6e02a98f2 diff --git a/external/glib/generate_cppgir.cmake b/external/glib/generate_cppgir.cmake index 1a6b41e..e084f1e 100644 --- a/external/glib/generate_cppgir.cmake +++ b/external/glib/generate_cppgir.cmake @@ -20,7 +20,7 @@ function(generate_cppgir target_name gir) OUTPUT ${gen_timestamp} COMMAND - cppgir + CppGir::cppgir --debug 1 --class @@ -35,17 +35,17 @@ function(generate_cppgir target_name gir) echo 1> ${gen_timestamp} COMMENT "Generating C++ wrapper for ${gir} (${target_name})" DEPENDS - cppgir + CppGir::cppgir ${gir_path} ) generate_target(${target_name} cppgir ${gen_timestamp} "" ${gen_dst}) get_target_property(target_type ${target_name} TYPE) if (${target_type} STREQUAL "INTERFACE_LIBRARY") - target_link_libraries(${target_name} INTERFACE gi) + target_link_libraries(${target_name} INTERFACE CppGir::gi) target_compile_definitions(${target_name} INTERFACE GI_INLINE GI_OBJECT_NEWV) else() - target_link_libraries(${target_name} PUBLIC gi) + target_link_libraries(${target_name} PUBLIC CppGir::gi) target_compile_definitions(${target_name} PUBLIC GI_INLINE GI_OBJECT_NEWV) endif() endfunction() From 002093a8d0133f33758a8e559f53bef21175209b Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 5 Aug 2023 23:22:30 +0400 Subject: [PATCH 153/215] Fix Qt >= 6.5 version check --- external/qt/package.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/qt/package.cmake b/external/qt/package.cmake index 2fcdf98..cc2dfaa 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -41,7 +41,7 @@ find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS Quick QuickWidgets QUIET) set(qt_version_6_5_or_greater 0) if (QT_VERSION_MAJOR GREATER_EQUAL 6) - if (QT_VERSION_MINOR GREATER_EQUAL 5) + if (QT_VERSION_MAJOR GREATER 6 OR Qt6_VERSION_MINOR GREATER_EQUAL 5) set(qt_version_6_5_or_greater 1) endif() find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGL OpenGLWidgets REQUIRED) From 92e35993aa437ee212f677c96a717078124cfd65 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 9 Aug 2023 20:42:31 +0400 Subject: [PATCH 154/215] Get optional string support in cppgir --- external/glib/cppgir | 2 +- external/glib/generate_cppgir.cmake | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/external/glib/cppgir b/external/glib/cppgir index ef6d50a..d484910 160000 --- a/external/glib/cppgir +++ b/external/glib/cppgir @@ -1 +1 @@ -Subproject commit ef6d50ababb13ab7c9a13cc46d3500d6e02a98f2 +Subproject commit d4849109daa597dfb5a25aed3e0d3018237d67d2 diff --git a/external/glib/generate_cppgir.cmake b/external/glib/generate_cppgir.cmake index e084f1e..a3cdfe7 100644 --- a/external/glib/generate_cppgir.cmake +++ b/external/glib/generate_cppgir.cmake @@ -26,6 +26,7 @@ function(generate_cppgir target_name gir) --class --class-full --expected + --optional --ignore ${cmake_helpers_loc}/external/glib/cppgir/data/cppgir.ignore:${cmake_helpers_loc}/external/glib/cppgir/data/cppgir_unix.ignore --output From 8316cfd1672b56f74f5dd4fa28b0695fcfdcb528 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 31 May 2023 06:15:33 +0400 Subject: [PATCH 155/215] Optional library loading on Linux with Implib --- .gitmodules | 3 + CMakeLists.txt | 6 - external/Implib.so | 1 + external/qt/CMakeLists.txt | 23 +- external/wayland_client/CMakeLists.txt | 2 +- external/xcb/CMakeLists.txt | 2 +- linux_wayland_helper/CMakeLists.txt | 19 - linux_wayland_helper/linux_wayland_helper.cpp | 667 ------------------ linux_xcb_helper/CMakeLists.txt | 14 - linux_xcb_helper/linux_xcb_helper.cpp | 53 -- options_linux.cmake | 4 + target_link_optional_libraries.cmake | 86 +++ 12 files changed, 109 insertions(+), 771 deletions(-) create mode 160000 external/Implib.so delete mode 100644 linux_wayland_helper/CMakeLists.txt delete mode 100644 linux_wayland_helper/linux_wayland_helper.cpp delete mode 100644 linux_xcb_helper/CMakeLists.txt delete mode 100644 linux_xcb_helper/linux_xcb_helper.cpp create mode 100644 target_link_optional_libraries.cmake diff --git a/.gitmodules b/.gitmodules index c92fbea..3d3dbe7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "external/glib/cppgir"] path = external/glib/cppgir url = https://gitlab.com/mnauw/cppgir.git +[submodule "external/Implib.so"] + path = external/Implib.so + url = https://github.com/yugr/Implib.so.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a896fb..bb8789c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,12 +8,6 @@ add_subdirectory(external) if (LINUX AND NOT DESKTOP_APP_DISABLE_JEMALLOC) add_subdirectory(linux_jemalloc_helper) endif() -if (LINUX AND NOT DESKTOP_APP_USE_PACKAGED) - add_subdirectory(linux_xcb_helper) -endif() -if (LINUX AND NOT DESKTOP_APP_USE_PACKAGED) - add_subdirectory(linux_wayland_helper) -endif() if (DESKTOP_APP_USE_ALLOCATION_TRACER) add_subdirectory(linux_allocation_tracer) endif() diff --git a/external/Implib.so b/external/Implib.so new file mode 160000 index 0000000..340e5d3 --- /dev/null +++ b/external/Implib.so @@ -0,0 +1 @@ +Subproject commit 340e5d32a8a3fcc7ac71136abeeb80b4d7dfb9fc diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 78e9d51..cd7ab5e 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -306,28 +306,31 @@ if (LINUX) xcb-keysyms ) if (TARGET Qt::WaylandClient) - target_link_libraries(external_qt + target_link_optional_libraries(external_qt INTERFACE - desktop-app::linux_wayland_helper + wayland-egl + wayland-cursor + wayland-client ) endif() if (TARGET Qt::WaylandCompositor) - target_link_static_libraries(external_qt + target_link_optional_libraries(external_qt INTERFACE wayland-server - ffi ) endif() - target_link_libraries(external_qt + target_link_optional_libraries(external_qt INTERFACE - desktop-app::linux_xcb_helper - fontconfig - freetype EGL GL - xcb - X11 X11-xcb + xcb + ) + target_link_libraries(external_qt + INTERFACE + fontconfig + freetype + X11 glib-2.0 ) endif() diff --git a/external/wayland_client/CMakeLists.txt b/external/wayland_client/CMakeLists.txt index cda9899..e310fae 100644 --- a/external/wayland_client/CMakeLists.txt +++ b/external/wayland_client/CMakeLists.txt @@ -12,5 +12,5 @@ if (DESKTOP_APP_USE_PACKAGED) pkg_check_modules(WAYLAND_CLIENT REQUIRED IMPORTED_TARGET wayland-client) target_link_libraries(external_wayland_client INTERFACE PkgConfig::WAYLAND_CLIENT) else() - target_link_libraries(external_wayland_client INTERFACE desktop-app::linux_wayland_helper) + target_link_optional_libraries(external_wayland_client INTERFACE wayland-client) endif() diff --git a/external/xcb/CMakeLists.txt b/external/xcb/CMakeLists.txt index 0f16bf3..c6ee5b3 100644 --- a/external/xcb/CMakeLists.txt +++ b/external/xcb/CMakeLists.txt @@ -16,5 +16,5 @@ if (DESKTOP_APP_USE_PACKAGED) pkg_check_modules(XCB REQUIRED IMPORTED_TARGET xcb) target_link_libraries(external_xcb INTERFACE PkgConfig::XCB) else() - target_link_libraries(external_xcb INTERFACE xcb) + target_link_optional_libraries(external_xcb INTERFACE xcb) endif() diff --git a/linux_wayland_helper/CMakeLists.txt b/linux_wayland_helper/CMakeLists.txt deleted file mode 100644 index c554e94..0000000 --- a/linux_wayland_helper/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -# This file is part of Desktop App Toolkit, -# a set of libraries for developing nice desktop applications. -# -# For license and copyright information please follow this link: -# https://github.com/desktop-app/legal/blob/master/LEGAL - -add_library(linux_wayland_helper STATIC) -init_target(linux_wayland_helper "(external)") -add_library(desktop-app::linux_wayland_helper ALIAS linux_wayland_helper) - -nice_target_sources(linux_wayland_helper ${CMAKE_CURRENT_SOURCE_DIR} -PRIVATE - linux_wayland_helper.cpp -) - -target_link_libraries(linux_wayland_helper -PRIVATE - desktop-app::external_gsl -) diff --git a/linux_wayland_helper/linux_wayland_helper.cpp b/linux_wayland_helper/linux_wayland_helper.cpp deleted file mode 100644 index 3c95a3b..0000000 --- a/linux_wayland_helper/linux_wayland_helper.cpp +++ /dev/null @@ -1,667 +0,0 @@ -// This file is part of Desktop App Toolkit, -// a set of libraries for developing nice desktop applications. -// -// For license and copyright information please follow this link: -// https://github.com/desktop-app/legal/blob/master/LEGAL -// -#include -#include -#include -#include -#include -#include - -#define LOAD_SYMBOL(handle, func) LoadSymbol(handle, #func, func) -#define LOAD_SYMBOL_SILENT(handle, func) LoadSymbol(handle, #func, func, true) - -namespace Wayland { -namespace { - -constexpr auto WL_CLOSURE_MAX_ARGS = 20; - -struct wl_egl_window *(*wl_egl_window_create)( - struct wl_surface *surface, - int width, - int height); -void (*wl_egl_window_destroy)(struct wl_egl_window *egl_window); -void (*wl_egl_window_resize)( - struct wl_egl_window *egl_window, - int width, - int height, - int dx, - int dy); -void (*wl_egl_window_get_attached_size)( - struct wl_egl_window *egl_window, - int *width, - int *height); - -struct wl_buffer *(*wl_cursor_image_get_buffer)( - struct wl_cursor_image *image); -struct wl_cursor_theme *(*wl_cursor_theme_load)( - const char *name, - int size, - struct wl_shm *shm); -void (*wl_cursor_theme_destroy)(struct wl_cursor_theme *theme); -struct wl_cursor *(*wl_cursor_theme_get_cursor)( - struct wl_cursor_theme *theme, - const char *name); - -int (*wl_cursor_frame_and_duration)( - struct wl_cursor *cursor, - uint32_t time, - uint32_t *duration); - -void (*wl_proxy_destroy)(struct wl_proxy *proxy); -uint32_t (*wl_proxy_get_version)(struct wl_proxy *proxy); -int (*wl_proxy_add_listener)( - struct wl_proxy *proxy, - void (**implementation)(void), - void *data); -void (*wl_proxy_set_user_data)(struct wl_proxy *proxy, void *user_data); -void *(*wl_proxy_get_user_data)(struct wl_proxy *proxy); -int (*wl_display_get_fd)(struct wl_display *display); -int (*wl_display_get_error)(struct wl_display *display); -int (*wl_display_dispatch)(struct wl_display *display); -struct wl_event_queue *(*wl_display_create_queue)(struct wl_display *display); -int (*wl_display_dispatch_queue_pending)( - struct wl_display *display, - struct wl_event_queue *queue); -int (*wl_display_prepare_read_queue)( - struct wl_display *display, - struct wl_event_queue *queue); -int (*wl_display_flush)(struct wl_display *display); -void (*wl_display_cancel_read)(struct wl_display *display); -int (*wl_display_read_events)(struct wl_display *display); -void (*wl_event_queue_destroy)(struct wl_event_queue *queue); -int (*wl_display_prepare_read)(struct wl_display *display); -int (*wl_display_dispatch_pending)(struct wl_display *display); -struct wl_display *(*wl_display_connect)(const char *name); -void (*wl_display_disconnect)(struct wl_display *display); -void *(*wl_proxy_create_wrapper)(void *proxy); -void (*wl_proxy_wrapper_destroy)(void *proxy_wrapper); -void (*wl_proxy_set_queue)(struct wl_proxy *proxy, struct wl_event_queue *queue); -int (*wl_display_roundtrip)(struct wl_display *display); -struct wl_proxy *(*wl_proxy_marshal_array_constructor)( - struct wl_proxy *proxy, - uint32_t opcode, - union wl_argument *args, - const struct wl_interface *interface); -struct wl_proxy *(*wl_proxy_marshal_array_constructor_versioned)( - struct wl_proxy *proxy, - uint32_t opcode, - union wl_argument *args, - const struct wl_interface *interface, - uint32_t version); -struct wl_proxy *(*wl_proxy_marshal_array_flags)( - struct wl_proxy *proxy, - uint32_t opcode, - const struct wl_interface *interface, - uint32_t version, - uint32_t flags, - union wl_argument *args); -uint32_t (*wl_proxy_get_id)(struct wl_proxy *proxy); -const void *(*wl_proxy_get_listener)(struct wl_proxy *proxy); - -struct argument_details { - char type; - int nullable; -}; - -const char *get_next_argument( - const char *signature, - struct argument_details *details) { - details->nullable = 0; - for(; *signature; ++signature) { - switch(*signature) { - case 'i': - case 'u': - case 'f': - case 's': - case 'o': - case 'n': - case 'a': - case 'h': - details->type = *signature; - return signature + 1; - case '?': - details->nullable = 1; - } - } - details->type = '\0'; - return signature; -} - -void wl_argument_from_va_list( - const char *signature, - union wl_argument *args, - int count, - va_list ap) { - int i; - const char *sig_iter; - struct argument_details arg; - - sig_iter = signature; - for (i = 0; i < count; i++) { - sig_iter = get_next_argument(sig_iter, &arg); - - switch(arg.type) { - case 'i': - args[i].i = va_arg(ap, int32_t); - break; - case 'u': - args[i].u = va_arg(ap, uint32_t); - break; - case 'f': - args[i].f = va_arg(ap, wl_fixed_t); - break; - case 's': - args[i].s = va_arg(ap, const char *); - break; - case 'o': - args[i].o = va_arg(ap, struct wl_object *); - break; - case 'n': - args[i].o = va_arg(ap, struct wl_object *); - break; - case 'a': - args[i].a = va_arg(ap, struct wl_array *); - break; - case 'h': - args[i].h = va_arg(ap, int32_t); - break; - case '\0': - return; - } - } -} - -struct HandleDeleter { - void operator()(void *handle) { - dlclose(handle); - } -}; - -using Handle = std::unique_ptr; - -bool LoadLibrary(Handle &handle, const char *name) { - handle = Handle(dlopen(name, RTLD_LAZY | RTLD_NODELETE)); - if (handle) { - return true; - } - std::cerr << dlerror() << std::endl; - return false; -} - -template -inline bool LoadSymbol( - const Handle &handle, - const char *name, - Function &func, - bool silent = false) { - func = handle - ? reinterpret_cast(dlsym(handle.get(), name)) - : nullptr; - if (const auto error = dlerror(); error && !silent) { - std::cerr << error << std::endl; - } - return (func != nullptr); -} - -bool Resolve() { - static const auto loaded = [] { - auto egl = Handle(); - auto cursor = Handle(); - auto client = Handle(); - const auto required = LoadLibrary(egl, "libwayland-egl.so.1") - && LOAD_SYMBOL(egl, wl_egl_window_create) - && LOAD_SYMBOL(egl, wl_egl_window_destroy) - && LOAD_SYMBOL(egl, wl_egl_window_resize) - && LOAD_SYMBOL(egl, wl_egl_window_get_attached_size) - && LoadLibrary(cursor, "libwayland-cursor.so.0") - && LOAD_SYMBOL(cursor, wl_cursor_image_get_buffer) - && LOAD_SYMBOL(cursor, wl_cursor_theme_load) - && LOAD_SYMBOL(cursor, wl_cursor_theme_destroy) - && LOAD_SYMBOL(cursor, wl_cursor_theme_get_cursor) - && LOAD_SYMBOL(cursor, wl_cursor_frame_and_duration) - && LoadLibrary(client, "libwayland-client.so.0") - && LOAD_SYMBOL(client, wl_proxy_destroy) - && LOAD_SYMBOL(client, wl_proxy_get_version) - && LOAD_SYMBOL(client, wl_proxy_add_listener) - && LOAD_SYMBOL(client, wl_proxy_set_user_data) - && LOAD_SYMBOL(client, wl_proxy_get_user_data) - && LOAD_SYMBOL(client, wl_display_get_fd) - && LOAD_SYMBOL(client, wl_display_get_error) - && LOAD_SYMBOL(client, wl_display_dispatch) - && LOAD_SYMBOL(client, wl_display_create_queue) - && LOAD_SYMBOL(client, wl_display_dispatch_queue_pending) - && LOAD_SYMBOL(client, wl_display_prepare_read_queue) - && LOAD_SYMBOL(client, wl_display_flush) - && LOAD_SYMBOL(client, wl_display_cancel_read) - && LOAD_SYMBOL(client, wl_display_read_events) - && LOAD_SYMBOL(client, wl_event_queue_destroy) - && LOAD_SYMBOL(client, wl_display_prepare_read) - && LOAD_SYMBOL(client, wl_display_dispatch_pending) - && LOAD_SYMBOL(client, wl_display_connect) - && LOAD_SYMBOL(client, wl_display_disconnect) - && LOAD_SYMBOL(client, wl_proxy_create_wrapper) - && LOAD_SYMBOL(client, wl_proxy_wrapper_destroy) - && LOAD_SYMBOL(client, wl_proxy_set_queue) - && LOAD_SYMBOL(client, wl_display_roundtrip) - && LOAD_SYMBOL(client, wl_proxy_marshal_array_constructor) - && LOAD_SYMBOL(client, wl_proxy_marshal_array_constructor_versioned) - && LOAD_SYMBOL(client, wl_proxy_get_id) - && LOAD_SYMBOL(client, wl_proxy_get_listener); - LOAD_SYMBOL_SILENT(client, wl_proxy_marshal_array_flags); - return required; - }(); - return loaded; -} - -} // namespace -} // namespace Wayland - -namespace W = Wayland; - -extern "C" { - -struct wl_egl_window *wl_egl_window_create( - struct wl_surface *surface, - int width, - int height) { - Expects(W::wl_egl_window_create != nullptr); - - return W::wl_egl_window_create(surface, width, height); -} - -void wl_egl_window_destroy(struct wl_egl_window *egl_window) { - Expects(W::wl_egl_window_destroy != nullptr); - - W::wl_egl_window_destroy(egl_window); -} - -void wl_egl_window_resize( - struct wl_egl_window *egl_window, - int width, - int height, - int dx, - int dy) { - Expects(W::wl_egl_window_resize != nullptr); - - W::wl_egl_window_resize(egl_window, width, height, dx, dy); -} - -void wl_egl_window_get_attached_size( - struct wl_egl_window *egl_window, - int *width, - int *height) { - Expects(W::wl_egl_window_get_attached_size != nullptr); - - W::wl_egl_window_get_attached_size(egl_window, width, height); -} - -struct wl_buffer *wl_cursor_image_get_buffer(struct wl_cursor_image *image) { - Expects(W::wl_cursor_image_get_buffer != nullptr); - - return W::wl_cursor_image_get_buffer(image); -} - -struct wl_cursor_theme *wl_cursor_theme_load( - const char *name, - int size, - struct wl_shm *shm) { - Expects(W::wl_cursor_theme_load != nullptr); - - return W::wl_cursor_theme_load(name, size, shm); -} - -void wl_cursor_theme_destroy(struct wl_cursor_theme *theme) { - Expects(W::wl_cursor_theme_destroy != nullptr); - - W::wl_cursor_theme_destroy(theme); -} - -struct wl_cursor *wl_cursor_theme_get_cursor( - struct wl_cursor_theme *theme, - const char *name) { - Expects(W::wl_cursor_theme_get_cursor != nullptr); - - return W::wl_cursor_theme_get_cursor(theme, name); -} - -int wl_cursor_frame_and_duration( - struct wl_cursor *cursor, - uint32_t time, - uint32_t *duration) { - Expects(W::wl_cursor_frame_and_duration != nullptr); - - return W::wl_cursor_frame_and_duration(cursor, time, duration); -} - -void wl_proxy_destroy(struct wl_proxy *proxy) { - Expects(W::wl_proxy_destroy != nullptr); - - W::wl_proxy_destroy(proxy); -} - -uint32_t wl_proxy_get_version(struct wl_proxy *proxy) { - Expects(W::wl_proxy_get_version != nullptr); - - return W::wl_proxy_get_version(proxy); -} - -int wl_proxy_add_listener( - struct wl_proxy *proxy, - void (**implementation)(void), - void *data) { - Expects(W::wl_proxy_add_listener != nullptr); - - return W::wl_proxy_add_listener(proxy, implementation, data); -} - -void wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data) { - Expects(W::wl_proxy_set_user_data != nullptr); - - W::wl_proxy_set_user_data(proxy, user_data); -} - -void *wl_proxy_get_user_data(struct wl_proxy *proxy) { - Expects(W::wl_proxy_get_user_data != nullptr); - - return W::wl_proxy_get_user_data(proxy); -} - -int wl_display_get_fd(struct wl_display *display) { - Expects(W::wl_display_get_fd != nullptr); - - return W::wl_display_get_fd(display); -} - -int wl_display_get_error(struct wl_display *display) { - Expects(W::wl_display_get_error != nullptr); - - return W::wl_display_get_error(display); -} - -int wl_display_dispatch(struct wl_display *display) { - Expects(W::wl_display_dispatch != nullptr); - - return W::wl_display_dispatch(display); -} - -struct wl_event_queue *wl_display_create_queue(struct wl_display *display) { - Expects(W::wl_display_create_queue != nullptr); - - return W::wl_display_create_queue(display); -} - -int wl_display_dispatch_queue_pending( - struct wl_display *display, - struct wl_event_queue *queue) { - Expects(W::wl_display_dispatch_queue_pending != nullptr); - - return W::wl_display_dispatch_queue_pending(display, queue); -} - -int wl_display_prepare_read_queue( - struct wl_display *display, - struct wl_event_queue *queue) { - Expects(W::wl_display_prepare_read_queue != nullptr); - - return W::wl_display_prepare_read_queue(display, queue); -} - -int wl_display_flush(struct wl_display *display) { - Expects(W::wl_display_flush != nullptr); - - return W::wl_display_flush(display); -} - -void wl_display_cancel_read(struct wl_display *display) { - Expects(W::wl_display_cancel_read != nullptr); - - W::wl_display_cancel_read(display); -} - -int wl_display_read_events(struct wl_display *display) { - Expects(W::wl_display_read_events != nullptr); - - return W::wl_display_read_events(display); -} - -void wl_event_queue_destroy(struct wl_event_queue *queue) { - Expects(W::wl_event_queue_destroy != nullptr); - - W::wl_event_queue_destroy(queue); -} - -int wl_display_prepare_read(struct wl_display *display) { - Expects(W::wl_display_prepare_read != nullptr); - - return W::wl_display_prepare_read(display); -} - -int wl_display_dispatch_pending(struct wl_display *display) { - Expects(W::wl_display_dispatch_pending != nullptr); - - return W::wl_display_dispatch_pending(display); -} - -struct wl_display *wl_display_connect(const char *name) { - if (!W::Resolve()) { - errno = ENOENT; - return nullptr; - } - return W::wl_display_connect(name); -} - -void wl_display_disconnect(struct wl_display *display) { - Expects(W::wl_display_disconnect != nullptr); - - W::wl_display_disconnect(display); -} - -void *wl_proxy_create_wrapper(void *proxy) { - Expects(W::wl_proxy_create_wrapper != nullptr); - - return W::wl_proxy_create_wrapper(proxy); -} - -void wl_proxy_wrapper_destroy(void *proxy_wrapper) { - Expects(W::wl_proxy_wrapper_destroy != nullptr); - - W::wl_proxy_wrapper_destroy(proxy_wrapper); -} - -void wl_proxy_set_queue( - struct wl_proxy *proxy, - struct wl_event_queue *queue) { - Expects(W::wl_proxy_set_queue != nullptr); - - W::wl_proxy_set_queue(proxy, queue); -} - -int wl_display_roundtrip(struct wl_display *display) { - Expects(W::wl_display_roundtrip != nullptr); - - return W::wl_display_roundtrip(display); -} - -struct wl_proxy *wl_proxy_marshal_array_constructor( - struct wl_proxy *proxy, - uint32_t opcode, - union wl_argument *args, - const struct wl_interface *interface) { - Expects(W::wl_proxy_marshal_array_constructor != nullptr); - - return W::wl_proxy_marshal_array_constructor( - proxy, - opcode, - args, - interface); -} - -struct wl_proxy *wl_proxy_marshal_array_constructor_versioned( - struct wl_proxy *proxy, - uint32_t opcode, - union wl_argument *args, - const struct wl_interface *interface, - uint32_t version) { - Expects(W::wl_proxy_marshal_array_constructor_versioned != nullptr); - - return W::wl_proxy_marshal_array_constructor_versioned( - proxy, - opcode, - args, - interface, - version); -} - -struct wl_proxy *wl_proxy_marshal_array_flags( - struct wl_proxy *proxy, - uint32_t opcode, - const struct wl_interface *interface, - uint32_t version, - uint32_t flags, - union wl_argument *args) { - Expects(W::wl_proxy_marshal_array_flags != nullptr); - - return W::wl_proxy_marshal_array_flags( - proxy, - opcode, - interface, - version, - flags, - args); -} - -uint32_t wl_proxy_get_id(struct wl_proxy *proxy) { - Expects(W::wl_proxy_get_id != nullptr); - - return W::wl_proxy_get_id(proxy); -} - -const void *wl_proxy_get_listener(struct wl_proxy *proxy) { - Expects(W::wl_proxy_get_listener != nullptr); - - return W::wl_proxy_get_listener(proxy); -} - -void wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...) { - union wl_argument args[W::WL_CLOSURE_MAX_ARGS]; - va_list ap; - - va_start(ap, opcode); - - // wl_proxy { wl_object { wl_interface *, ... }, ... } - struct wl_object *object = (struct wl_object*)proxy; - struct wl_interface *interface = *((struct wl_interface**)object); - W::wl_argument_from_va_list( - interface->methods[opcode].signature, - args, - W::WL_CLOSURE_MAX_ARGS, - ap); - - va_end(ap); - - wl_proxy_marshal_array_constructor(proxy, opcode, args, nullptr); -} - -struct wl_proxy *wl_proxy_marshal_constructor( - struct wl_proxy *proxy, - uint32_t opcode, - const struct wl_interface *interface, - ...) { - union wl_argument args[W::WL_CLOSURE_MAX_ARGS]; - va_list ap; - - va_start(ap, interface); - - // wl_proxy { wl_object { wl_interface *, ... }, ... } - struct wl_object *object = (struct wl_object*)proxy; - struct wl_interface *i = *((struct wl_interface**)object); - W::wl_argument_from_va_list( - i->methods[opcode].signature, - args, - W::WL_CLOSURE_MAX_ARGS, - ap); - - va_end(ap); - - return wl_proxy_marshal_array_constructor(proxy, opcode, args, interface); -} - -struct wl_proxy *wl_proxy_marshal_constructor_versioned( - struct wl_proxy *proxy, - uint32_t opcode, - const struct wl_interface *interface, - uint32_t version, - ...) { - union wl_argument args[W::WL_CLOSURE_MAX_ARGS]; - va_list ap; - - va_start(ap, version); - - // wl_proxy { wl_object { wl_interface *, ... }, ... } - struct wl_object *object = (struct wl_object*)proxy; - struct wl_interface *i = *((struct wl_interface**)object); - W::wl_argument_from_va_list( - i->methods[opcode].signature, - args, - W::WL_CLOSURE_MAX_ARGS, - ap); - - va_end(ap); - - return wl_proxy_marshal_array_constructor_versioned(proxy, opcode, - args, interface, - version); -} - -struct wl_proxy *wl_proxy_marshal_flags( - struct wl_proxy *proxy, - uint32_t opcode, - const struct wl_interface *interface, - uint32_t version, - uint32_t flags, - ...) { - union wl_argument args[W::WL_CLOSURE_MAX_ARGS]; - va_list ap; - - va_start(ap, flags); - - // wl_proxy { wl_object { wl_interface *, ... }, ... } - struct wl_object *object = (struct wl_object*)proxy; - struct wl_interface *i = *((struct wl_interface**)object); - W::wl_argument_from_va_list( - i->methods[opcode].signature, - args, - W::WL_CLOSURE_MAX_ARGS, - ap); - - va_end(ap); - - if (W::wl_proxy_marshal_array_flags == nullptr) { - const auto result = wl_proxy_marshal_array_constructor_versioned( - proxy, - opcode, - args, - interface, - version); - - if (flags & WL_MARSHAL_FLAG_DESTROY) { - wl_proxy_destroy(proxy); - } - - return result; - } - - return wl_proxy_marshal_array_flags( - proxy, - opcode, - interface, - version, - flags, - args); -} - -} // extern "C" diff --git a/linux_xcb_helper/CMakeLists.txt b/linux_xcb_helper/CMakeLists.txt deleted file mode 100644 index 8344d6b..0000000 --- a/linux_xcb_helper/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# This file is part of Desktop App Toolkit, -# a set of libraries for developing nice desktop applications. -# -# For license and copyright information please follow this link: -# https://github.com/desktop-app/legal/blob/master/LEGAL - -add_library(linux_xcb_helper STATIC) -init_target(linux_xcb_helper "(external)") -add_library(desktop-app::linux_xcb_helper ALIAS linux_xcb_helper) - -nice_target_sources(linux_xcb_helper ${CMAKE_CURRENT_SOURCE_DIR} -PRIVATE - linux_xcb_helper.cpp -) diff --git a/linux_xcb_helper/linux_xcb_helper.cpp b/linux_xcb_helper/linux_xcb_helper.cpp deleted file mode 100644 index e056830..0000000 --- a/linux_xcb_helper/linux_xcb_helper.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// This file is part of Desktop App Toolkit, -// a set of libraries for developing nice desktop applications. -// -// For license and copyright information please follow this link: -// https://github.com/desktop-app/legal/blob/master/LEGAL -// -#include -#include -#include -#include - -unsigned int xcb_send_request_with_fds( - xcb_connection_t *c, - int flags, - struct iovec *vector, - const xcb_protocol_request_t *req, - unsigned int num_fds, - int *fds) { - const auto send_request_with_fds = reinterpret_cast(dlsym(RTLD_NEXT, "xcb_send_request_with_fds")); - - if (!dlerror()) { - return send_request_with_fds(c, flags, vector, req, num_fds, fds); - } - - const auto send_fd = reinterpret_cast( - dlsym(RTLD_NEXT, "xcb_send_fd")); - - if (dlerror()) { - abort(); - } - - const auto send_request = reinterpret_cast(dlsym(RTLD_NEXT, "xcb_send_request")); - - if (dlerror()) { - abort(); - } - - for (int i = 0; i != num_fds; ++i) { - send_fd(c, fds[i]); - } - - return send_request(c, flags, vector, req); -} diff --git a/options_linux.cmake b/options_linux.cmake index eca8149..0d38ef0 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -48,6 +48,10 @@ if (DESKTOP_APP_SPECIAL_TARGET) endif() if (NOT DESKTOP_APP_USE_PACKAGED) + target_link_options(common_options + INTERFACE + -Wl,-z,muldefs + ) if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") target_link_options(common_options INTERFACE diff --git a/target_link_optional_libraries.cmake b/target_link_optional_libraries.cmake new file mode 100644 index 0000000..59b7641 --- /dev/null +++ b/target_link_optional_libraries.cmake @@ -0,0 +1,86 @@ +# This file is part of Desktop App Toolkit, +# a set of libraries for developing nice desktop applications. +# +# For license and copyright information please follow this link: +# https://github.com/desktop-app/legal/blob/master/LEGAL + +function(generate_implib) + find_package(Python3 REQUIRED) + + set(gen_dst ${CMAKE_CURRENT_BINARY_DIR}/gen) + file(MAKE_DIRECTORY ${gen_dst}) + + foreach (lib ${ARGN}) + string(MAKE_C_IDENTIFIER ${lib} lib_identifier) + find_library(DESKTOP_APP_${lib_identifier}_PATH ${lib} REQUIRED) + get_filename_component(lib_file ${DESKTOP_APP_${lib_identifier}_PATH} NAME) + + set(gen_timestamp ${gen_dst}/implib_${lib_identifier}.timestamp) + set(gen_files + ${gen_dst}/${lib_file}.init.c + ${gen_dst}/${lib_file}.tramp.S + ) + + add_custom_command( + OUTPUT + ${gen_timestamp} + BYPRODUCTS + ${gen_files} + COMMAND + ${Python3_EXECUTABLE} + ${cmake_helpers_loc}/external/Implib.so/implib-gen.py + -o + ${gen_dst} + ${DESKTOP_APP_${lib_identifier}_PATH} + COMMAND + echo 1> ${gen_timestamp} + COMMENT "Generating dlopen helper for ${lib_file}" + DEPENDS + ${DESKTOP_APP_${lib_identifier}_PATH} + ) + + add_library(implib_${lib_identifier} STATIC) + init_target(implib_${lib_identifier} "(gen)") + generate_target(implib_${lib_identifier} timestamp ${gen_timestamp} "${gen_files}" ${gen_dst}) + endforeach() +endfunction() + +function(target_link_optional_libraries target_name) + set(writing_now "") + set(private_libs "") + set(public_libs "") + set(interface_libs "") + foreach (entry ${ARGN}) + if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") + set(writing_now ${entry}) + else() + string(MAKE_C_IDENTIFIER ${entry} entry_identifier) + if (NOT TARGET implib_${entry_identifier}) + generate_implib(${entry}) + endif() + set(result + $ + $ + ) + if ("${writing_now}" STREQUAL "PRIVATE") + list(APPEND private_libs ${result}) + elseif ("${writing_now}" STREQUAL "PUBLIC") + list(APPEND public_libs ${result}) + elseif ("${writing_now}" STREQUAL "INTERFACE") + list(APPEND interface_libs ${result}) + else() + message(FATAL_ERROR "Unknown libraries scope for target ${target_name}") + endif() + endif() + endforeach() + + if (NOT "${public_libs}" STREQUAL "") + target_link_libraries(${target_name} PUBLIC ${public_libs}) + endif() + if (NOT "${private_libs}" STREQUAL "") + target_link_libraries(${target_name} PRIVATE ${private_libs}) + endif() + if (NOT "${interface_libs}" STREQUAL "") + target_link_libraries(${target_name} INTERFACE ${interface_libs}) + endif() +endfunction() From ae0986c9efd28c61783cfe106f8bd1b0ba3b3920 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 31 May 2023 08:28:28 +0400 Subject: [PATCH 156/215] Build ffmpeg with vaapi/vdpau --- external/ffmpeg/CMakeLists.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/external/ffmpeg/CMakeLists.txt b/external/ffmpeg/CMakeLists.txt index 48b2fdf..2c941dc 100644 --- a/external/ffmpeg/CMakeLists.txt +++ b/external/ffmpeg/CMakeLists.txt @@ -76,15 +76,35 @@ elseif (LINUX) list(APPEND ffmpeg_lib_list -ldav1d -llzma + $ + $ + $ + $ + $ + -lXv + -lXext ) endif() # Workaround cmake's random order on Linux... if (LINUX) + generate_implib( + vdpau + va-x11 + va-drm + va + drm + ) list(JOIN ffmpeg_lib_list , ffmpeg_lib_link) target_link_libraries(external_ffmpeg INTERFACE -Wl,--push-state,-Bstatic,${ffmpeg_lib_link},--pop-state + $ + $ + $ + $ + $ + X11 ) else() target_link_libraries(external_ffmpeg From 3ffc5e6bf584d9b60e66d7c533f87e9276813863 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 18 Aug 2023 10:47:41 +0200 Subject: [PATCH 157/215] Remove -no_compact_unwind, it breaks exceptions in OpenAL. --- options_mac.cmake | 5 ----- 1 file changed, 5 deletions(-) diff --git a/options_mac.cmake b/options_mac.cmake index 48f5e29..8279e4a 100644 --- a/options_mac.cmake +++ b/options_mac.cmake @@ -47,11 +47,6 @@ if (DESKTOP_APP_SPECIAL_TARGET) ) endif() -target_link_options(common_options -INTERFACE - -Wl,-no_compact_unwind -) - target_link_frameworks(common_options INTERFACE Cocoa From 73d7379276fa2cbf0995456face7fa7fe62789e2 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 18 Aug 2023 16:48:59 +0400 Subject: [PATCH 158/215] Move moldefs to the already existing target_link_options block --- options_linux.cmake | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/options_linux.cmake b/options_linux.cmake index 0d38ef0..c96ff9b 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -48,10 +48,6 @@ if (DESKTOP_APP_SPECIAL_TARGET) endif() if (NOT DESKTOP_APP_USE_PACKAGED) - target_link_options(common_options - INTERFACE - -Wl,-z,muldefs - ) if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") target_link_options(common_options INTERFACE @@ -77,6 +73,7 @@ if (NOT DESKTOP_APP_USE_PACKAGED) INTERFACE $>,$,${interprocedural_optimization_values}>,$>,${interprocedural_optimization_values}>> -rdynamic + -Wl,-z,muldefs ) endif() From bd556e2a16d34ad876054fb3ab25e83481af652a Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 18 Aug 2023 16:49:38 +0400 Subject: [PATCH 159/215] Update cppgir --- external/glib/cppgir | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/glib/cppgir b/external/glib/cppgir index d484910..fa34615 160000 --- a/external/glib/cppgir +++ b/external/glib/cppgir @@ -1 +1 @@ -Subproject commit d4849109daa597dfb5a25aed3e0d3018237d67d2 +Subproject commit fa346156b25dd79a8bf5a50cd10022858b859984 From a98ccbffb4b882124a0675a07d34bc5cc38e55e9 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 24 Aug 2023 18:03:11 +0200 Subject: [PATCH 160/215] Update WebView2 to 1.0.1901.177. --- nuget.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuget.cmake b/nuget.cmake index 36e3d50..8bfac58 100644 --- a/nuget.cmake +++ b/nuget.cmake @@ -45,7 +45,7 @@ function(nuget_add_package package_name package package_version) endfunction() function(nuget_add_webview target_name) - nuget_add_package(webview2 "Microsoft.Web.WebView2" 1.0.1185.39) + nuget_add_package(webview2 "Microsoft.Web.WebView2" 1.0.1901.177) set(webview2_loc_native ${webview2_loc}/build/native) # target_link_libraries(${target_name} From 9fd1c758053f88c2a432e61991ac6d7fbc9af263 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 25 Aug 2023 06:43:09 +0400 Subject: [PATCH 161/215] Make implib quiet --- target_link_optional_libraries.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/target_link_optional_libraries.cmake b/target_link_optional_libraries.cmake index 59b7641..32436d1 100644 --- a/target_link_optional_libraries.cmake +++ b/target_link_optional_libraries.cmake @@ -29,6 +29,7 @@ function(generate_implib) COMMAND ${Python3_EXECUTABLE} ${cmake_helpers_loc}/external/Implib.so/implib-gen.py + -q -o ${gen_dst} ${DESKTOP_APP_${lib_identifier}_PATH} From dbe089746f9ae84456f3c5dafa392190a88db2d1 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 27 Aug 2023 00:24:15 +0400 Subject: [PATCH 162/215] Re-use base_linux_library --- .../hime_im_client/hime_im_client_helper.cpp | 67 ++++++------------- 1 file changed, 19 insertions(+), 48 deletions(-) diff --git a/external/hime_qt/hime_im_client/hime_im_client_helper.cpp b/external/hime_qt/hime_im_client/hime_im_client_helper.cpp index 7ad8ed6..ffb1a95 100644 --- a/external/hime_qt/hime_im_client/hime_im_client_helper.cpp +++ b/external/hime_qt/hime_im_client/hime_im_client_helper.cpp @@ -4,13 +4,10 @@ // For license and copyright information please follow this link: // https://github.com/desktop-app/legal/blob/master/LEGAL // -#include +#include "base/platform/linux/base_linux_library.h" + #include #include -#include -#include - -#define LOAD_SYMBOL(handle, func) LoadSymbol(handle, #func, func) namespace HimeHelper { namespace { @@ -50,51 +47,25 @@ void (*hime_im_client_set_client_window)( const Window win); void (*hime_im_client_set_window)(HIME_client_handle *handle, Window win); -struct HandleDeleter { - void operator()(void *handle) { - dlclose(handle); - } -}; - -using Handle = std::unique_ptr; - -bool LoadLibrary(Handle &handle, const char *name) { - handle = Handle(dlopen(name, RTLD_LAZY | RTLD_NODELETE)); - if (handle) { - return true; - } - std::cerr << dlerror() << std::endl; - return false; -} - -template -inline bool LoadSymbol(const Handle &handle, const char *name, Function &func) { - func = handle - ? reinterpret_cast(dlsym(handle.get(), name)) - : nullptr; - if (const auto error = dlerror()) { - std::cerr << error << std::endl; - } - return (func != nullptr); -} - bool Resolve() { static const auto loaded = [&] { - auto lib = Handle(); - return LoadLibrary(lib, "libhime-im-client.so.1") - && LOAD_SYMBOL(lib, hime_im_client_close) - && LOAD_SYMBOL(lib, hime_im_client_focus_in) - && LOAD_SYMBOL(lib, hime_im_client_focus_out) - && LOAD_SYMBOL(lib, hime_im_client_focus_out2) - && LOAD_SYMBOL(lib, hime_im_client_forward_key_press) - && LOAD_SYMBOL(lib, hime_im_client_forward_key_release) - && LOAD_SYMBOL(lib, hime_im_client_get_preedit) - && LOAD_SYMBOL(lib, hime_im_client_open) - && LOAD_SYMBOL(lib, hime_im_client_reset) - && LOAD_SYMBOL(lib, hime_im_client_set_cursor_location) - && LOAD_SYMBOL(lib, hime_im_client_set_flags) - && (LOAD_SYMBOL(lib, hime_im_client_set_client_window) - || LOAD_SYMBOL(lib, hime_im_client_set_window)); + const auto lib = base::Platform::LoadLibrary( + "libhime-im-client.so.1", + RTLD_NODELETE); + return lib + && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_close) + && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_focus_in) + && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_focus_out) + && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_focus_out2) + && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_forward_key_press) + && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_forward_key_release) + && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_get_preedit) + && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_open) + && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_reset) + && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_set_cursor_location) + && LOAD_LIBRARY_SYMBOL(lib, hime_im_client_set_flags) + && (LOAD_LIBRARY_SYMBOL(lib, hime_im_client_set_client_window) + || LOAD_LIBRARY_SYMBOL(lib, hime_im_client_set_window)); }(); return loaded; } From 385ba19a52ee7fc04aeac5a55d717896e8a4793e Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 29 Aug 2023 17:31:58 +0400 Subject: [PATCH 163/215] Add missing lib_base dependency to hime helper --- external/hime_qt/hime_im_client/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/external/hime_qt/hime_im_client/CMakeLists.txt b/external/hime_qt/hime_im_client/CMakeLists.txt index a5017c3..90aafb4 100644 --- a/external/hime_qt/hime_im_client/CMakeLists.txt +++ b/external/hime_qt/hime_im_client/CMakeLists.txt @@ -27,6 +27,11 @@ PUBLIC ${hime_im_client_src} ) +target_link_libraries(external_hime_im_client +PRIVATE + desktop-app::lib_base +) + find_package(PkgConfig REQUIRED) pkg_check_modules(X11 REQUIRED x11) From 504e56469be1113af8f69cccb667f12948aede71 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 30 Aug 2023 06:47:48 +0400 Subject: [PATCH 164/215] Switch kimageformats to automoc The new version tells cmake to generate files per-source --- external/kimageformats/CMakeLists.txt | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/external/kimageformats/CMakeLists.txt b/external/kimageformats/CMakeLists.txt index 5aa377b..e3694a9 100644 --- a/external/kimageformats/CMakeLists.txt +++ b/external/kimageformats/CMakeLists.txt @@ -17,18 +17,7 @@ init_target(external_kimageformats "(external)") set(kimageformats_loc ${third_party_loc}/kimageformats) set(kimageformats_src ${kimageformats_loc}/src/imageformats) -set(kimageformats_srcs) -qt_wrap_cpp(kimageformats_srcs - ${kimageformats_src}/avif_p.h - ${kimageformats_src}/heif_p.h - ${kimageformats_src}/jxl_p.h -TARGET - external_kimageformats -DEPENDS - ${kimageformats_src}/avif.json - ${kimageformats_src}/heif.json - ${kimageformats_src}/jxl.json -) +set_target_properties(external_kimageformats PROPERTIES AUTOMOC ON) nice_target_sources(external_kimageformats ${kimageformats_src} PRIVATE @@ -36,7 +25,6 @@ PRIVATE heif.cpp jxl.cpp ) -target_sources(external_kimageformats PRIVATE ${kimageformats_srcs}) target_compile_definitions(external_kimageformats PRIVATE From 90ddbede235544c2b0369b21a17f1605acc438d4 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 30 Aug 2023 06:49:58 +0400 Subject: [PATCH 165/215] Remove no more used define by new kimageformats --- external/kimageformats/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/external/kimageformats/CMakeLists.txt b/external/kimageformats/CMakeLists.txt index e3694a9..0a002bd 100644 --- a/external/kimageformats/CMakeLists.txt +++ b/external/kimageformats/CMakeLists.txt @@ -29,7 +29,6 @@ PRIVATE target_compile_definitions(external_kimageformats PRIVATE QT_STATICPLUGIN - KIMG_JXL_API_VERSION=70 ) target_link_libraries(external_kimageformats From 121c2afbbbf0ea89522da79cff56380fb1796c34 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 30 Aug 2023 06:50:19 +0400 Subject: [PATCH 166/215] Enable QOI support by kimageformats --- external/kimageformats/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/external/kimageformats/CMakeLists.txt b/external/kimageformats/CMakeLists.txt index 0a002bd..03e63cd 100644 --- a/external/kimageformats/CMakeLists.txt +++ b/external/kimageformats/CMakeLists.txt @@ -24,6 +24,7 @@ PRIVATE avif.cpp heif.cpp jxl.cpp + qoi.cpp ) target_compile_definitions(external_kimageformats From a7129002d476eb75a8a081798df3467ee880e3ed Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 2 Sep 2023 14:14:48 +0400 Subject: [PATCH 167/215] Update cppgir --- external/glib/cppgir | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/glib/cppgir b/external/glib/cppgir index fa34615..69ef481 160000 --- a/external/glib/cppgir +++ b/external/glib/cppgir @@ -1 +1 @@ -Subproject commit fa346156b25dd79a8bf5a50cd10022858b859984 +Subproject commit 69ef481cba38e848554cc5403b8d4141d3c51335 From 2440fc9e87b40b7224e927bfc3b914146d0cd4cf Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 2 Sep 2023 23:18:21 +0400 Subject: [PATCH 168/215] Workaround cmake bug 25222 --- external/gsl/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/external/gsl/CMakeLists.txt b/external/gsl/CMakeLists.txt index af8b9b4..8eaf19c 100644 --- a/external/gsl/CMakeLists.txt +++ b/external/gsl/CMakeLists.txt @@ -22,6 +22,11 @@ if (DESKTOP_APP_USE_PACKAGED) endif() ]] +# https://gitlab.kitware.com/cmake/cmake/-/issues/25222 +if (NOT EXISTS ${third_party_loc}/GSL/include) + message(FATAL_ERROR "Guidelines Support Library is not found") +endif() + target_include_directories(external_gsl SYSTEM INTERFACE ${third_party_loc}/GSL/include From 491a7fdbae6629dd06a53fc17ac06e6827f4b295 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 13 Sep 2023 17:29:48 +0400 Subject: [PATCH 169/215] Link system libwebp instead of Qt-s. --- external/qt/CMakeLists.txt | 30 +++++++++++++++++++++++++++++- external/qt/package.cmake | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index cd7ab5e..eabf54f 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -130,6 +130,7 @@ else() lib/${qt_lib_prefix}qtlibpng lib/${qt_lib_prefix}qtpcre2 ) + endif() set(qt_libs_list "") @@ -279,7 +280,30 @@ INTERFACE $ ) -if (LINUX) +if (WIN32) + if (build_win64) + set(libwebp_release_folder x64) + else() + set(libwebp_release_folder x86) + endif() + + set(webp_lib_loc ${libs_loc}/libwebp/out/$,debug,release>-static/${libwebp_release_folder}/lib) + + target_link_libraries(external_qt + INTERFACE + ${webp_lib_loc}/libwebp$<$:_debug>.lib + ${webp_lib_loc}/libwebpdemux$<$:_debug>.lib + ${webp_lib_loc}/libwebpmux$<$:_debug>.lib + ) +elseif (APPLE) + target_link_libraries(external_qt + INTERFACE + ${libs_loc}/local/lib/libwebp.a + ${libs_loc}/local/lib/libwebpdemux.a + ${libs_loc}/local/lib/libwebpmux.a + ${libs_loc}/local/lib/libsharpyuv.a + ) + elseif (LINUX) target_include_directories(external_qt SYSTEM INTERFACE ${qt_loc}/mkspecs/linux-g++ @@ -304,6 +328,10 @@ if (LINUX) xcb-util xcb-render-util xcb-keysyms + webpmux + webpdemux + webp + sharpyuv ) if (TARGET Qt::WaylandClient) target_link_optional_libraries(external_qt diff --git a/external/qt/package.cmake b/external/qt/package.cmake index cc2dfaa..a4283f4 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -21,7 +21,7 @@ if (NOT DESKTOP_APP_USE_PACKAGED) set(qt_loc /usr/local/desktop-app/Qt-${qt_version}) endif() - set(CMAKE_PREFIX_PATH ${qt_loc}) + set(CMAKE_PREFIX_PATH ${qt_loc} ${libs_loc}/local) endif() if (NOT DEFINED QT_VERSION_MAJOR) From 975d33e6ae5442e330f78a03fb103d8aaaf5018d Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 5 Jun 2023 09:23:04 +0400 Subject: [PATCH 170/215] Try to re-enable -pie Ubuntu 20.04 has new enough shared-mime-info --- options_linux.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options_linux.cmake b/options_linux.cmake index c96ff9b..912d50c 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -88,7 +88,7 @@ if (NOT DESKTOP_APP_USE_PACKAGED OR DESKTOP_APP_SPECIAL_TARGET) INTERFACE -Wl,-z,relro -Wl,-z,now - # -pie # https://gitlab.gnome.org/GNOME/nautilus/-/issues/1601 + -pie ) target_compile_definitions(common_options INTERFACE From 900e33b26760b0a8cdb78665ac150cfdaf8c3f0a Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 5 Jun 2023 09:23:41 +0400 Subject: [PATCH 171/215] Use _FORTIFY_SOURCE=3 supported by GCC 12 --- external/dispatch/CMakeLists.txt | 4 ++-- external/jemalloc/CMakeLists.txt | 4 ++-- options_linux.cmake | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/external/dispatch/CMakeLists.txt b/external/dispatch/CMakeLists.txt index 0431d88..f877211 100644 --- a/external/dispatch/CMakeLists.txt +++ b/external/dispatch/CMakeLists.txt @@ -17,8 +17,8 @@ if (NOT DESKTOP_APP_DISPATCH_LIBRARIES OR NOT DESKTOP_APP_DISPATCH_INCLUDE_DIRS) if (NOT DESKTOP_APP_USE_PACKAGED OR DESKTOP_APP_SPECIAL_TARGET) set(dispatch_extra_args -DCMAKE_BUILD_TYPE=Release - "-DCMAKE_C_FLAGS=-g -pipe -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS" - "-DCMAKE_CXX_FLAGS=-g -pipe -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS" + "-DCMAKE_C_FLAGS=-g -pipe -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS" + "-DCMAKE_CXX_FLAGS=-g -pipe -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS" ) elseif (DEFINED CMAKE_BUILD_TYPE) set(dispatch_extra_args diff --git a/external/jemalloc/CMakeLists.txt b/external/jemalloc/CMakeLists.txt index c66ea66..3297db4 100644 --- a/external/jemalloc/CMakeLists.txt +++ b/external/jemalloc/CMakeLists.txt @@ -39,8 +39,8 @@ ExternalProject_Add(jemalloc CONFIGURE_COMMAND env CC=clang CXX=clang++ - "$>,$>,EXTRA_CFLAGS=-fstack-protector-all -DNDEBUG -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS,=>" - "$>,$>,EXTRA_CXXFLAGS=-fstack-protector-all -DNDEBUG -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS,=>" + "$>,$>,EXTRA_CFLAGS=-fstack-protector-all -DNDEBUG -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS,=>" + "$>,$>,EXTRA_CXXFLAGS=-fstack-protector-all -DNDEBUG -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS,=>" ./autogen.sh --disable-shared BUILD_COMMAND make $<$>:-j${N}> BUILD_IN_SOURCE 1 diff --git a/options_linux.cmake b/options_linux.cmake index 912d50c..8b5c482 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -92,7 +92,7 @@ if (NOT DESKTOP_APP_USE_PACKAGED OR DESKTOP_APP_SPECIAL_TARGET) ) target_compile_definitions(common_options INTERFACE - $<$>:_FORTIFY_SOURCE=2> + $<$>:_FORTIFY_SOURCE=3> _GLIBCXX_ASSERTIONS ) endif() From f0bd6fafa296332097997680b24e35c48c55a5f8 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 6 Jun 2023 06:03:54 +0400 Subject: [PATCH 172/215] Enable stack clash protection with Clang --- external/dispatch/CMakeLists.txt | 4 ++-- external/jemalloc/CMakeLists.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/external/dispatch/CMakeLists.txt b/external/dispatch/CMakeLists.txt index f877211..11cc606 100644 --- a/external/dispatch/CMakeLists.txt +++ b/external/dispatch/CMakeLists.txt @@ -17,8 +17,8 @@ if (NOT DESKTOP_APP_DISPATCH_LIBRARIES OR NOT DESKTOP_APP_DISPATCH_INCLUDE_DIRS) if (NOT DESKTOP_APP_USE_PACKAGED OR DESKTOP_APP_SPECIAL_TARGET) set(dispatch_extra_args -DCMAKE_BUILD_TYPE=Release - "-DCMAKE_C_FLAGS=-g -pipe -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS" - "-DCMAKE_CXX_FLAGS=-g -pipe -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS" + "-DCMAKE_C_FLAGS=-g -pipe -fPIC -fstack-protector-all -fstack-clash-protection -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS" + "-DCMAKE_CXX_FLAGS=-g -pipe -fPIC -fstack-protector-all -fstack-clash-protection -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS" ) elseif (DEFINED CMAKE_BUILD_TYPE) set(dispatch_extra_args diff --git a/external/jemalloc/CMakeLists.txt b/external/jemalloc/CMakeLists.txt index 3297db4..809b828 100644 --- a/external/jemalloc/CMakeLists.txt +++ b/external/jemalloc/CMakeLists.txt @@ -39,8 +39,8 @@ ExternalProject_Add(jemalloc CONFIGURE_COMMAND env CC=clang CXX=clang++ - "$>,$>,EXTRA_CFLAGS=-fstack-protector-all -DNDEBUG -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS,=>" - "$>,$>,EXTRA_CXXFLAGS=-fstack-protector-all -DNDEBUG -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS,=>" + "$>,$>,EXTRA_CFLAGS=-fstack-protector-all -fstack-clash-protection -DNDEBUG -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS,=>" + "$>,$>,EXTRA_CXXFLAGS=-fstack-protector-all -fstack-clash-protection -DNDEBUG -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS,=>" ./autogen.sh --disable-shared BUILD_COMMAND make $<$>:-j${N}> BUILD_IN_SOURCE 1 From 15f79e19f58e561fbf766f607df13788cb612930 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 6 Jun 2023 05:01:23 +0400 Subject: [PATCH 173/215] Enable control flow protection with Clang --- external/dispatch/CMakeLists.txt | 4 ++-- external/jemalloc/CMakeLists.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/external/dispatch/CMakeLists.txt b/external/dispatch/CMakeLists.txt index 11cc606..5d6dd62 100644 --- a/external/dispatch/CMakeLists.txt +++ b/external/dispatch/CMakeLists.txt @@ -17,8 +17,8 @@ if (NOT DESKTOP_APP_DISPATCH_LIBRARIES OR NOT DESKTOP_APP_DISPATCH_INCLUDE_DIRS) if (NOT DESKTOP_APP_USE_PACKAGED OR DESKTOP_APP_SPECIAL_TARGET) set(dispatch_extra_args -DCMAKE_BUILD_TYPE=Release - "-DCMAKE_C_FLAGS=-g -pipe -fPIC -fstack-protector-all -fstack-clash-protection -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS" - "-DCMAKE_CXX_FLAGS=-g -pipe -fPIC -fstack-protector-all -fstack-clash-protection -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS" + "-DCMAKE_C_FLAGS=-g -pipe -fPIC -fstack-protector-all -fstack-clash-protection -fcf-protection -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS" + "-DCMAKE_CXX_FLAGS=-g -pipe -fPIC -fstack-protector-all -fstack-clash-protection -fcf-protection -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS" ) elseif (DEFINED CMAKE_BUILD_TYPE) set(dispatch_extra_args diff --git a/external/jemalloc/CMakeLists.txt b/external/jemalloc/CMakeLists.txt index 809b828..70f2f1b 100644 --- a/external/jemalloc/CMakeLists.txt +++ b/external/jemalloc/CMakeLists.txt @@ -39,8 +39,8 @@ ExternalProject_Add(jemalloc CONFIGURE_COMMAND env CC=clang CXX=clang++ - "$>,$>,EXTRA_CFLAGS=-fstack-protector-all -fstack-clash-protection -DNDEBUG -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS,=>" - "$>,$>,EXTRA_CXXFLAGS=-fstack-protector-all -fstack-clash-protection -DNDEBUG -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS,=>" + "$>,$>,EXTRA_CFLAGS=-fstack-protector-all -fstack-clash-protection -fcf-protection -DNDEBUG -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS,=>" + "$>,$>,EXTRA_CXXFLAGS=-fstack-protector-all -fstack-clash-protection -fcf-protection -DNDEBUG -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS,=>" ./autogen.sh --disable-shared BUILD_COMMAND make $<$>:-j${N}> BUILD_IN_SOURCE 1 From ab8fd93ceeabb6f3f15603657ac6df59dba9e421 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 5 Jun 2023 11:19:24 +0400 Subject: [PATCH 174/215] Try to speed up non-LTO linking with LLD again --- options_linux.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options_linux.cmake b/options_linux.cmake index 8b5c482..2d5d65e 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -67,7 +67,7 @@ if (NOT DESKTOP_APP_USE_PACKAGED) endif() set(interprocedural_optimization_config $>>) set(interprocedural_optimization_value_on -fwhole-program) - set(interprocedural_optimization_value_off -fno-use-linker-plugin) + set(interprocedural_optimization_value_off -fuse-ld=lld -fno-use-linker-plugin) set(interprocedural_optimization_values ${interprocedural_optimization_value_on},$<$>,$>:${interprocedural_optimization_value_off}>) target_link_options(common_options INTERFACE From b99a79b9a221299cc37255cd7a03f6ee67976510 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 25 Jun 2023 11:15:01 +0400 Subject: [PATCH 175/215] Link QGlibNetworkInformationPlugin --- external/qt/CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index eabf54f..2b1bd7e 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -190,13 +190,14 @@ elseif (APPLE) endforeach() else() set(qt_libs - plugins/platforminputcontexts/${qt_lib_prefix}composeplatforminputcontextplugin - plugins/platformthemes/${qt_lib_prefix}qgtk3 plugins/platforms/${qt_lib_prefix}qxcb - plugins/tls/${qt_lib_prefix}qopensslbackend plugins/xcbglintegrations/${qt_lib_prefix}qxcb-egl-integration plugins/xcbglintegrations/${qt_lib_prefix}qxcb-glx-integration + plugins/platforminputcontexts/${qt_lib_prefix}composeplatforminputcontextplugin plugins/iconengines/${qt_lib_prefix}qsvgicon + plugins/platformthemes/${qt_lib_prefix}qgtk3 + plugins/tls/${qt_lib_prefix}qopensslbackend + plugins/networkinformation/${qt_lib_prefix}qglib lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}XcbQpa ${common_qt_libs} ) @@ -208,6 +209,7 @@ else() $ $ $ + $ ) if (TARGET Qt::DBus) list(APPEND qt_libs @@ -359,6 +361,8 @@ elseif (APPLE) fontconfig freetype X11 + gio-2.0 + gobject-2.0 glib-2.0 ) endif() From 7b9e2b60b444582d541a6dbefdc8848080771b93 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 19 Jul 2023 16:12:30 +0400 Subject: [PATCH 176/215] Let cppgir use g_object_new_with_properties --- external/glib/generate_cppgir.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/external/glib/generate_cppgir.cmake b/external/glib/generate_cppgir.cmake index a3cdfe7..c9872a6 100644 --- a/external/glib/generate_cppgir.cmake +++ b/external/glib/generate_cppgir.cmake @@ -44,9 +44,9 @@ function(generate_cppgir target_name gir) get_target_property(target_type ${target_name} TYPE) if (${target_type} STREQUAL "INTERFACE_LIBRARY") target_link_libraries(${target_name} INTERFACE CppGir::gi) - target_compile_definitions(${target_name} INTERFACE GI_INLINE GI_OBJECT_NEWV) + target_compile_definitions(${target_name} INTERFACE GI_INLINE) else() target_link_libraries(${target_name} PUBLIC CppGir::gi) - target_compile_definitions(${target_name} PUBLIC GI_INLINE GI_OBJECT_NEWV) + target_compile_definitions(${target_name} PUBLIC GI_INLINE) endif() endfunction() From 5735ef13c72bac000ab1b402cbc4ce7bdd2b353a Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 20 Aug 2023 04:04:00 +0400 Subject: [PATCH 177/215] Use -fno-omit-frame-pointer for better backtraces --- external/dispatch/CMakeLists.txt | 4 ++-- external/jemalloc/CMakeLists.txt | 4 ++-- options_linux.cmake | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/external/dispatch/CMakeLists.txt b/external/dispatch/CMakeLists.txt index 5d6dd62..91f5b45 100644 --- a/external/dispatch/CMakeLists.txt +++ b/external/dispatch/CMakeLists.txt @@ -17,8 +17,8 @@ if (NOT DESKTOP_APP_DISPATCH_LIBRARIES OR NOT DESKTOP_APP_DISPATCH_INCLUDE_DIRS) if (NOT DESKTOP_APP_USE_PACKAGED OR DESKTOP_APP_SPECIAL_TARGET) set(dispatch_extra_args -DCMAKE_BUILD_TYPE=Release - "-DCMAKE_C_FLAGS=-g -pipe -fPIC -fstack-protector-all -fstack-clash-protection -fcf-protection -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS" - "-DCMAKE_CXX_FLAGS=-g -pipe -fPIC -fstack-protector-all -fstack-clash-protection -fcf-protection -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS" + "-DCMAKE_C_FLAGS=-g -pipe -fPIC -fno-omit-frame-pointer -fstack-protector-all -fstack-clash-protection -fcf-protection -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS" + "-DCMAKE_CXX_FLAGS=-g -pipe -fPIC -fno-omit-frame-pointer -fstack-protector-all -fstack-clash-protection -fcf-protection -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS" ) elseif (DEFINED CMAKE_BUILD_TYPE) set(dispatch_extra_args diff --git a/external/jemalloc/CMakeLists.txt b/external/jemalloc/CMakeLists.txt index 70f2f1b..9b87c00 100644 --- a/external/jemalloc/CMakeLists.txt +++ b/external/jemalloc/CMakeLists.txt @@ -39,8 +39,8 @@ ExternalProject_Add(jemalloc CONFIGURE_COMMAND env CC=clang CXX=clang++ - "$>,$>,EXTRA_CFLAGS=-fstack-protector-all -fstack-clash-protection -fcf-protection -DNDEBUG -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS,=>" - "$>,$>,EXTRA_CXXFLAGS=-fstack-protector-all -fstack-clash-protection -fcf-protection -DNDEBUG -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS,=>" + "$>,$>,EXTRA_CFLAGS=-fno-omit-frame-pointer -fstack-protector-all -fstack-clash-protection -fcf-protection -DNDEBUG -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS,=>" + "$>,$>,EXTRA_CXXFLAGS=-fno-omit-frame-pointer -fstack-protector-all -fstack-clash-protection -fcf-protection -DNDEBUG -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS,=>" ./autogen.sh --disable-shared BUILD_COMMAND make $<$>:-j${N}> BUILD_IN_SOURCE 1 diff --git a/options_linux.cmake b/options_linux.cmake index 2d5d65e..f43d7d2 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -80,6 +80,7 @@ endif() if (NOT DESKTOP_APP_USE_PACKAGED OR DESKTOP_APP_SPECIAL_TARGET) target_compile_options_if_exists(common_options INTERFACE + -fno-omit-frame-pointer -fstack-protector-all -fstack-clash-protection -fcf-protection From 7e618c88780c765faf40b0f8eb706593c0c2faaf Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 21 Sep 2023 01:47:59 +0400 Subject: [PATCH 178/215] Adapt to work without optional-gtk Qt patch --- external/qt/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 2b1bd7e..3a8e29d 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -351,6 +351,10 @@ elseif (APPLE) endif() target_link_optional_libraries(external_qt INTERFACE + gtk-3 + gdk-3 + gdk_pixbuf-2.0 + pango-1.0 EGL GL X11-xcb From 785fec293ea26cc693cf2813ca3877fe20cabdec Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 21 Sep 2023 11:14:00 +0400 Subject: [PATCH 179/215] Update fcitx5-qt --- external/CMakeLists.txt | 7 +- external/fcitx5_qt/CMakeLists.txt | 12 +-- external/fcitx_qt5/CMakeLists.txt | 97 -------------------- external/fcitx_qt5/init.cpp | 10 -- external/qt/qt_static_plugins/CMakeLists.txt | 11 +-- 5 files changed, 10 insertions(+), 127 deletions(-) delete mode 100644 external/fcitx_qt5/CMakeLists.txt delete mode 100644 external/fcitx_qt5/init.cpp diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 563732f..2f9165b 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -21,11 +21,8 @@ if (LINUX) add_checked_subdirectory(dispatch) endif() add_checked_subdirectory(expected) -if (LINUX AND TARGET Qt::DBus) - add_checked_subdirectory(fcitx_qt5) - if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION) - add_checked_subdirectory(fcitx5_qt) - endif() +if (LINUX AND TARGET Qt::DBus AND NOT DESKTOP_APP_DISABLE_X11_INTEGRATION) + add_checked_subdirectory(fcitx5_qt) endif() add_checked_subdirectory(ffmpeg) if (LINUX) diff --git a/external/fcitx5_qt/CMakeLists.txt b/external/fcitx5_qt/CMakeLists.txt index bfca166..c8801a5 100644 --- a/external/fcitx5_qt/CMakeLists.txt +++ b/external/fcitx5_qt/CMakeLists.txt @@ -18,23 +18,23 @@ set(fcitx5_qt_loc ${third_party_loc}/fcitx5-qt) set(fcitx5_qt_src ${fcitx5_qt_loc}/qt${QT_VERSION_MAJOR}/platforminputcontext) set_target_properties(external_fcitx5_qt PROPERTIES AUTOMOC ON) -set(FCITX5_QT_EXTRA_PLUGIN_NAME "") +set(FCITX5_QT_EXTRA_PLUGIN_NAME "\"fcitx\",") configure_file("${fcitx5_qt_src}/fcitx5.json.in" "${CMAKE_CURRENT_BINARY_DIR}/fcitx5.json") nice_target_sources(external_fcitx5_qt ${fcitx5_qt_src} PRIVATE + fcitx4watcher.cpp + fcitx4inputcontextproxy.cpp + fcitx4inputcontextproxyimpl.cpp + fcitx4inputmethodproxy.cpp + hybridinputcontext.cpp qfcitxplatforminputcontext.cpp - qfcitxplatforminputcontext.h fcitxcandidatewindow.cpp - fcitxcandidatewindow.h fcitxtheme.cpp - fcitxtheme.h font.cpp - font.h qtkey.cpp main.cpp - main.h ) target_include_directories(external_fcitx5_qt diff --git a/external/fcitx_qt5/CMakeLists.txt b/external/fcitx_qt5/CMakeLists.txt deleted file mode 100644 index 8945c84..0000000 --- a/external/fcitx_qt5/CMakeLists.txt +++ /dev/null @@ -1,97 +0,0 @@ -# This file is part of Desktop App Toolkit, -# a set of libraries for developing nice desktop applications. -# -# For license and copyright information please follow this link: -# https://github.com/desktop-app/legal/blob/master/LEGAL - -if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY) - add_library(external_fcitx_qt5 INTERFACE IMPORTED GLOBAL) - add_library(desktop-app::external_fcitx_qt5 ALIAS external_fcitx_qt5) - return() -endif() - -add_library(external_fcitx_qt5 STATIC) -add_library(desktop-app::external_fcitx_qt5 ALIAS external_fcitx_qt5) -init_target(external_fcitx_qt5 "(external)") - -set(fcitx_qt5_loc ${third_party_loc}/fcitx-qt5) -set(fcitx_qt5_src ${fcitx_qt5_loc}/qt${QT_VERSION_MAJOR}/platforminputcontext) - -set_target_properties(external_fcitx_qt5 PROPERTIES AUTOMOC ON) - -nice_target_sources(external_fcitx_qt5 ${fcitx_qt5_src} -PRIVATE - fcitxinputcontextproxy.cpp - fcitxqtdbustypes.cpp - fcitxwatcher.cpp - qfcitxplatforminputcontext.cpp - main.cpp - qtkey.cpp -) - -set_source_files_properties(${fcitx_qt5_src}/org.fcitx.Fcitx.InputContext.xml PROPERTIES -INCLUDE ${fcitx_qt5_src}/fcitxqtdbustypes.h) -set_source_files_properties(${fcitx_qt5_src}/org.fcitx.Fcitx.InputContext1.xml PROPERTIES -INCLUDE ${fcitx_qt5_src}/fcitxqtdbustypes.h) -set_source_files_properties(${fcitx_qt5_src}/org.fcitx.Fcitx.InputMethod.xml PROPERTIES -INCLUDE ${fcitx_qt5_src}/fcitxqtdbustypes.h) -set_source_files_properties(${fcitx_qt5_src}/org.fcitx.Fcitx.InputMethod1.xml PROPERTIES -INCLUDE ${fcitx_qt5_src}/fcitxqtdbustypes.h) - -qt_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputContext.xml inputcontextproxy) -qt_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputContext1.xml inputcontext1proxy) -qt_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputMethod.xml inputmethodproxy) -qt_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputMethod1.xml inputmethod1proxy) - -target_sources(external_fcitx_qt5 PRIVATE ${fcitx_qt5_adaptors}) - -target_include_directories(external_fcitx_qt5 -PRIVATE - ${fcitx_qt5_src} - "${CMAKE_CURRENT_BINARY_DIR}" -) - -target_compile_definitions(external_fcitx_qt5 -PRIVATE - QT_STATICPLUGIN -) - -target_link_libraries(external_fcitx_qt5 -PRIVATE - desktop-app::external_qt -) - -if (DESKTOP_APP_USE_PACKAGED) - find_package(PkgConfig REQUIRED) - pkg_check_modules(XKBCOMMON REQUIRED IMPORTED_TARGET xkbcommon) - - target_link_libraries(external_fcitx_qt5 - PRIVATE - PkgConfig::XKBCOMMON - ) -else() - target_link_static_libraries(external_fcitx_qt5 - PRIVATE - xkbcommon - ) -endif() - -add_library(external_fcitx_qt5_init OBJECT) -add_library(desktop-app::external_fcitx_qt5_init ALIAS external_fcitx_qt5_init) -init_target(external_fcitx_qt5_init "(external)") - -nice_target_sources(external_fcitx_qt5_init ${CMAKE_CURRENT_SOURCE_DIR} -PRIVATE - init.cpp -) - -target_link_libraries(external_fcitx_qt5_init -PRIVATE - desktop-app::external_qt -) - -target_link_libraries(external_fcitx_qt5 -INTERFACE - external_fcitx_qt5_init - $ -) diff --git a/external/fcitx_qt5/init.cpp b/external/fcitx_qt5/init.cpp deleted file mode 100644 index 86d9dd1..0000000 --- a/external/fcitx_qt5/init.cpp +++ /dev/null @@ -1,10 +0,0 @@ -/* -This file is part of Desktop App Toolkit, -a set of libraries for developing nice desktop applications. - -For license and copyright information please follow this link: -https://github.com/desktop-app/legal/blob/master/LEGAL -*/ -#include - -Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin) diff --git a/external/qt/qt_static_plugins/CMakeLists.txt b/external/qt/qt_static_plugins/CMakeLists.txt index a1dd245..ca56bbf 100644 --- a/external/qt/qt_static_plugins/CMakeLists.txt +++ b/external/qt/qt_static_plugins/CMakeLists.txt @@ -25,18 +25,11 @@ if (LINUX) desktop-app::external_nimf_qt5 ) - if (TARGET Qt::DBus) + if (TARGET Qt::DBus AND NOT DESKTOP_APP_DISABLE_X11_INTEGRATION) target_link_libraries(external_qt_static_plugins PUBLIC - desktop-app::external_fcitx_qt5 + desktop-app::external_fcitx5_qt ) - - if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION) - target_link_libraries(external_qt_static_plugins - PUBLIC - desktop-app::external_fcitx5_qt - ) - endif() endif() if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION) From 8bc8f9580abe99f5d1cc5501703f7760b96d8240 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 21 Sep 2023 11:30:35 +0400 Subject: [PATCH 180/215] Update brotli on Linux --- external/kimageformats/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/external/kimageformats/CMakeLists.txt b/external/kimageformats/CMakeLists.txt index 03e63cd..cbe75f3 100644 --- a/external/kimageformats/CMakeLists.txt +++ b/external/kimageformats/CMakeLists.txt @@ -86,9 +86,9 @@ else() jxl_threads dav1d de265 - brotlidec-static - brotlienc-static - brotlicommon-static + brotlidec + brotlienc + brotlicommon hwy lcms2 ) From 18d4aae269c51d5b24e96957abbdb389a1270122 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 21 Sep 2023 14:52:19 +0400 Subject: [PATCH 181/215] Bump minimum macOS deployment target to 10.13. --- validate_special_target.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validate_special_target.cmake b/validate_special_target.cmake index 50d2bf5..8fa3582 100644 --- a/validate_special_target.cmake +++ b/validate_special_target.cmake @@ -22,7 +22,7 @@ function(report_bad_special_target) endfunction() if (NOT DESKTOP_APP_USE_PACKAGED) - set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Minimum macOS deployment version" FORCE) + set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13 CACHE STRING "Minimum macOS deployment version" FORCE) if (NOT DEFINED CMAKE_OSX_ARCHITECTURES) set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Target macOS architectures" FORCE) endif() From 0ae4e78a12d7fdea687ca52647465b9cf9ef95ee Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 22 Sep 2023 04:18:47 +0400 Subject: [PATCH 182/215] Minimize amount of code to rebuild when switching options --- external/qt/qt_static_plugins/CMakeLists.txt | 7 +++ .../qt_static_plugins/qt_static_plugins.cpp | 4 +- options.cmake | 49 ------------------- win_directx_helper/CMakeLists.txt | 7 +++ win_directx_helper/win_directx_helper.cpp | 4 +- 5 files changed, 18 insertions(+), 53 deletions(-) diff --git a/external/qt/qt_static_plugins/CMakeLists.txt b/external/qt/qt_static_plugins/CMakeLists.txt index ca56bbf..f6d7308 100644 --- a/external/qt/qt_static_plugins/CMakeLists.txt +++ b/external/qt/qt_static_plugins/CMakeLists.txt @@ -19,6 +19,13 @@ PUBLIC desktop-app::external_kimageformats ) +if (DESKTOP_APP_USE_PACKAGED) + target_compile_definitions(external_qt_static_plugins + PRIVATE + QT_STATIC_PLUGINS_USE_PACKAGED + ) +endif() + if (LINUX) target_link_libraries(external_qt_static_plugins PUBLIC diff --git a/external/qt/qt_static_plugins/qt_static_plugins.cpp b/external/qt/qt_static_plugins/qt_static_plugins.cpp index af68849..8e6a311 100644 --- a/external/qt/qt_static_plugins/qt_static_plugins.cpp +++ b/external/qt/qt_static_plugins/qt_static_plugins.cpp @@ -7,10 +7,10 @@ https://github.com/desktop-app/legal/blob/master/LEGAL */ #include -#if !defined DESKTOP_APP_USE_PACKAGED && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && defined Q_OS_WIN +#if !defined QT_STATIC_PLUGINS_USE_PACKAGED && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && defined Q_OS_WIN Q_IMPORT_PLUGIN(QGenericEnginePlugin) Q_IMPORT_PLUGIN(QWebpPlugin) Q_IMPORT_PLUGIN(QJpegPlugin) Q_IMPORT_PLUGIN(QGifPlugin) Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) -#endif // !DESKTOP_APP_USE_PACKAGED && Qt < 6.0.0 && Q_OS_WIN +#endif // !QT_STATIC_PLUGINS_USE_PACKAGED && Qt < 6.0.0 && Q_OS_WIN diff --git a/options.cmake b/options.cmake index 91f5eff..7ad2804 100644 --- a/options.cmake +++ b/options.cmake @@ -16,13 +16,6 @@ INTERFACE QT_DEPRECATED_WARNINGS_SINCE=0x051500 ) -if (DESKTOP_APP_DISABLE_CRASH_REPORTS) - target_compile_definitions(common_options - INTERFACE - DESKTOP_APP_DISABLE_CRASH_REPORTS - ) -endif() - if (DESKTOP_APP_DISABLE_X11_INTEGRATION) target_compile_definitions(common_options INTERFACE @@ -30,48 +23,6 @@ if (DESKTOP_APP_DISABLE_X11_INTEGRATION) ) endif() -if (DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) - target_compile_definitions(common_options - INTERFACE - DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION - ) -endif() - -if (DESKTOP_APP_USE_PACKAGED) - target_compile_definitions(common_options - INTERFACE - DESKTOP_APP_USE_PACKAGED - ) -endif() - -if (DESKTOP_APP_USE_PACKAGED_LAZY) - target_compile_definitions(common_options - INTERFACE - DESKTOP_APP_USE_PACKAGED_LAZY - ) -endif() - -if (DESKTOP_APP_USE_PACKAGED_FONTS) - target_compile_definitions(common_options - INTERFACE - DESKTOP_APP_USE_PACKAGED_FONTS - ) -endif() - -if (DESKTOP_APP_USE_PACKAGED_RLOTTIE) - target_compile_definitions(common_options - INTERFACE - DESKTOP_APP_USE_PACKAGED_RLOTTIE - ) -endif() - -if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "") - target_compile_definitions(common_options - INTERFACE - DESKTOP_APP_SPECIAL_TARGET=${DESKTOP_APP_SPECIAL_TARGET} - ) -endif() - if (WIN32) include(cmake/options_win.cmake) elseif (APPLE) diff --git a/win_directx_helper/CMakeLists.txt b/win_directx_helper/CMakeLists.txt index 889f8a9..a5e766f 100644 --- a/win_directx_helper/CMakeLists.txt +++ b/win_directx_helper/CMakeLists.txt @@ -19,3 +19,10 @@ target_link_libraries(win_directx_helper PUBLIC desktop-app::external_openssl ) + +if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "") + target_compile_definitions(win_directx_helper + PRIVATE + WIN_DIRECTX_HELPER_SPECIAL_TARGET=${DESKTOP_APP_SPECIAL_TARGET} + ) +endif() diff --git a/win_directx_helper/win_directx_helper.cpp b/win_directx_helper/win_directx_helper.cpp index 13a90f0..7550177 100644 --- a/win_directx_helper/win_directx_helper.cpp +++ b/win_directx_helper/win_directx_helper.cpp @@ -173,9 +173,9 @@ bool ResolveD3DCompiler() { if (FileSha256(path) == hash && ResolveD3DCompiler(path)) { return true; } -#elif defined DESKTOP_APP_SPECIAL_TARGET // DESKTOP_APP_D3DCOMPILER_HASH +#elif defined WIN_DIRECTX_HELPER_SPECIAL_TARGET // DESKTOP_APP_D3DCOMPILER_HASH #error "Special target build should have d3dcompiler hash." -#endif // !DESKTOP_APP_D3DCOMPILER_HASH && DESKTOP_APP_SPECIAL_TARGET +#endif // !DESKTOP_APP_D3DCOMPILER_HASH && WIN_DIRECTX_HELPER_SPECIAL_TARGET return ResolveD3DCompiler(L"d3dcompiler_47.dll"); }(); From 0bacdcaaa4ac11348cc5562e94eac1e5bdb58789 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 23 Sep 2023 12:28:15 +0400 Subject: [PATCH 183/215] Fix linking order for plugins using QtDBus --- external/qt/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 3a8e29d..7946db8 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -212,9 +212,11 @@ else() $ ) if (TARGET Qt::DBus) - list(APPEND qt_libs + list(PREPEND qt_libs plugins/platforminputcontexts/${qt_lib_prefix}ibusplatforminputcontextplugin plugins/platformthemes/${qt_lib_prefix}qxdgdesktopportal + ) + list(APPEND qt_libs lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}DBus lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Core ) From aaedaede705ab908b1bbaf026c59b4379b0d1cf8 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 25 Sep 2023 21:02:13 +0400 Subject: [PATCH 184/215] Workaround Xcode 15 linker bugs with -Wl,-ld_classic. --- options_mac.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/options_mac.cmake b/options_mac.cmake index 8279e4a..da1f7c0 100644 --- a/options_mac.cmake +++ b/options_mac.cmake @@ -47,6 +47,11 @@ if (DESKTOP_APP_SPECIAL_TARGET) ) endif() +target_link_options(common_options +INTERFACE + -Wl,-ld_classic +) + target_link_frameworks(common_options INTERFACE Cocoa From 218a34d9b5e3267b86a938b48bd74c045455bd3c Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 27 Sep 2023 05:09:48 +0400 Subject: [PATCH 185/215] Fix build with Qt 6.6 --- external/qt/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 7946db8..89a078f 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -370,5 +370,6 @@ elseif (APPLE) gio-2.0 gobject-2.0 glib-2.0 + rt ) endif() From b1b0e95b091f298c87cb9ec4458f426574221ca4 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 29 Sep 2023 09:03:30 +0400 Subject: [PATCH 186/215] Fix build with older Xcode. --- options_mac.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options_mac.cmake b/options_mac.cmake index da1f7c0..09dea75 100644 --- a/options_mac.cmake +++ b/options_mac.cmake @@ -47,7 +47,7 @@ if (DESKTOP_APP_SPECIAL_TARGET) ) endif() -target_link_options(common_options +target_link_options_if_exists(common_options INTERFACE -Wl,-ld_classic ) From 813aacf791af9bffcf740df2bd776d4b322e31f7 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 4 Oct 2023 15:05:11 +0400 Subject: [PATCH 187/215] Add desktop-app::external_boost_regex. --- external/CMakeLists.txt | 1 + external/boost/CMakeLists.txt | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 external/boost/CMakeLists.txt diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 2f9165b..d9af92a 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -13,6 +13,7 @@ endmacro() add_checked_subdirectory(angle) add_checked_subdirectory(auto_updates) +add_checked_subdirectory(boost) if (add_cld3_library) add_checked_subdirectory(cld3) endif() diff --git a/external/boost/CMakeLists.txt b/external/boost/CMakeLists.txt new file mode 100644 index 0000000..0462285 --- /dev/null +++ b/external/boost/CMakeLists.txt @@ -0,0 +1,19 @@ +# This file is part of Desktop App Toolkit, +# a set of libraries for developing nice desktop applications. +# +# For license and copyright information please follow this link: +# https://github.com/desktop-app/legal/blob/master/LEGAL + +add_library(external_boost_regex INTERFACE IMPORTED GLOBAL) +add_library(desktop-app::external_boost_regex ALIAS external_boost_regex) + +if (DESKTOP_APP_USE_PACKAGED OR LINUX) + find_package(Boost COMPONENTS regex REQUIRED) + target_link_libraries(external_boost_regex INTERFACE Boost::regex) + return() +endif() + +target_include_directories(external_boost_regex SYSTEM +INTERFACE + ${libs_loc}/regex/include +) From 78a86e6feea398ece7b5c89869673b169ade2454 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 6 Oct 2023 00:16:43 +0400 Subject: [PATCH 188/215] Add support for KF6CoreAddons --- external/kcoreaddons/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/external/kcoreaddons/CMakeLists.txt b/external/kcoreaddons/CMakeLists.txt index dda874f..996eac8 100644 --- a/external/kcoreaddons/CMakeLists.txt +++ b/external/kcoreaddons/CMakeLists.txt @@ -4,13 +4,13 @@ # For license and copyright information please follow this link: # https://github.com/desktop-app/legal/blob/master/LEGAL -if (DESKTOP_APP_USE_PACKAGED AND QT_VERSION_MAJOR EQUAL 5) +if (DESKTOP_APP_USE_PACKAGED) add_library(external_kcoreaddons INTERFACE IMPORTED GLOBAL) add_library(desktop-app::external_kcoreaddons ALIAS external_kcoreaddons) - find_package(KF5CoreAddons) - if (KF5CoreAddons_FOUND) - target_link_libraries(external_kcoreaddons INTERFACE KF5::CoreAddons) + find_package(KF${QT_VERSION_MAJOR}CoreAddons) + if (KF${QT_VERSION_MAJOR}CoreAddons_FOUND) + target_link_libraries(external_kcoreaddons INTERFACE KF${QT_VERSION_MAJOR}::CoreAddons) return() endif() endif() From 9237a1457ff9251cc9be58812f1e13210e02738b Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 6 Oct 2023 22:04:36 +0400 Subject: [PATCH 189/215] Set minimal glib version (according to RHEL 8) --- external/glib/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/external/glib/CMakeLists.txt b/external/glib/CMakeLists.txt index 2966200..3c6fe4b 100644 --- a/external/glib/CMakeLists.txt +++ b/external/glib/CMakeLists.txt @@ -25,3 +25,9 @@ target_link_libraries(external_glib INTERFACE PkgConfig::GLIB2 ) + +target_compile_definitions(external_glib +INTERFACE + GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_56 + GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_56 +) From 0df256ce99e1de129a6f7927766f8824b6bb158e Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 7 Oct 2023 00:12:10 +0400 Subject: [PATCH 190/215] Add missing DESKTOP_APP_USE_PACKAGED_LAZY handling to kcoreaddons --- external/kcoreaddons/CMakeLists.txt | 37 ++++++++++++++++++----------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/external/kcoreaddons/CMakeLists.txt b/external/kcoreaddons/CMakeLists.txt index 996eac8..6913f13 100644 --- a/external/kcoreaddons/CMakeLists.txt +++ b/external/kcoreaddons/CMakeLists.txt @@ -4,25 +4,29 @@ # For license and copyright information please follow this link: # https://github.com/desktop-app/legal/blob/master/LEGAL -if (DESKTOP_APP_USE_PACKAGED) - add_library(external_kcoreaddons INTERFACE IMPORTED GLOBAL) - add_library(desktop-app::external_kcoreaddons ALIAS external_kcoreaddons) +add_library(external_kcoreaddons INTERFACE IMPORTED GLOBAL) +add_library(desktop-app::external_kcoreaddons ALIAS external_kcoreaddons) + +if (DESKTOP_APP_USE_PACKAGED) + if (DESKTOP_APP_USE_PACKAGED_LAZY) + find_package(KF${QT_VERSION_MAJOR}CoreAddons QUIET) + else() + find_package(KF${QT_VERSION_MAJOR}CoreAddons) + endif() - find_package(KF${QT_VERSION_MAJOR}CoreAddons) if (KF${QT_VERSION_MAJOR}CoreAddons_FOUND) target_link_libraries(external_kcoreaddons INTERFACE KF${QT_VERSION_MAJOR}::CoreAddons) return() endif() endif() -add_library(external_kcoreaddons STATIC) -add_library(desktop-app::external_kcoreaddons ALIAS external_kcoreaddons) -init_target(external_kcoreaddons "(external)") +add_library(external_kcoreaddons_bundled STATIC) +init_target(external_kcoreaddons_bundled "(external)") set(kcoreaddons_loc ${third_party_loc}/kcoreaddons) set(kcoreaddons_src ${kcoreaddons_loc}/src/lib) -nice_target_sources(external_kcoreaddons ${kcoreaddons_src} +nice_target_sources(external_kcoreaddons_bundled ${kcoreaddons_src} PRIVATE io/kurlmimedata.cpp io/kurlmimedata.h @@ -37,7 +41,7 @@ PRIVATE ) if (NOT LINUX) - remove_target_sources(external_kcoreaddons ${kcoreaddons_src} + remove_target_sources(external_kcoreaddons_bundled ${kcoreaddons_src} util/kshell.cpp util/kshell.h util/kshell_p.h @@ -54,22 +58,22 @@ if (LINUX AND TARGET Qt::DBus) set_source_files_properties(${kcoreaddons_src}/io/org.kde.KIOFuse.VFS.xml PROPERTIES NO_NAMESPACE TRUE) qt_add_dbus_interface(_dbus_SRCS ${kcoreaddons_src}/io/org.kde.KIOFuse.VFS.xml org.kde.KIOFuse.VFS) - target_sources(external_kcoreaddons PRIVATE ${_dbus_SRCS}) + target_sources(external_kcoreaddons_bundled PRIVATE ${_dbus_SRCS}) - target_compile_definitions(external_kcoreaddons + target_compile_definitions(external_kcoreaddons_bundled PRIVATE HAVE_QTDBUS ) endif() -target_compile_definitions(external_kcoreaddons +target_compile_definitions(external_kcoreaddons_bundled PUBLIC KCOREADDONS_EXPORT= PRIVATE ACCOUNTS_SERVICE_ICON_DIR="/var/lib/AccountsService/icons" ) -target_include_directories(external_kcoreaddons SYSTEM +target_include_directories(external_kcoreaddons_bundled SYSTEM PUBLIC ${kcoreaddons_src}/io ${kcoreaddons_src}/util @@ -79,7 +83,12 @@ PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ) -target_link_libraries(external_kcoreaddons +target_link_libraries(external_kcoreaddons_bundled PRIVATE desktop-app::external_qt ) + +target_link_libraries(external_kcoreaddons +INTERFACE + external_kcoreaddons_bundled +) From 21a8d7996d50d973976607360f2f563f38af1c29 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 17 Jun 2023 14:59:18 +0400 Subject: [PATCH 191/215] Enable EGL for Wayland Compositor --- external/qt/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 89a078f..b7885f3 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -245,9 +245,12 @@ else() endif() if (TARGET Qt::WaylandCompositor) list(PREPEND qt_libs + plugins/wayland-graphics-integration-server/${qt_lib_prefix}qt-wayland-compositor-wayland-egl + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}WaylandEglCompositorHwIntegration lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}WaylandCompositor ) list(APPEND qt_libs_list + $ $ ) endif() From fef4eba1b747d3bb8d817386da72992167c277d2 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 26 Oct 2023 13:51:54 +0400 Subject: [PATCH 192/215] Add desktop-app specific definitions for Boost.regex. --- external/boost/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/external/boost/CMakeLists.txt b/external/boost/CMakeLists.txt index 0462285..7a4e811 100644 --- a/external/boost/CMakeLists.txt +++ b/external/boost/CMakeLists.txt @@ -7,6 +7,12 @@ add_library(external_boost_regex INTERFACE IMPORTED GLOBAL) add_library(desktop-app::external_boost_regex ALIAS external_boost_regex) +target_compile_definitions(external_boost_regex +INTERFACE + BOOST_NO_INTRINSIC_WCHAR_T + BOOST_REGEX_NO_W32 +) + if (DESKTOP_APP_USE_PACKAGED OR LINUX) find_package(Boost COMPONENTS regex REQUIRED) target_link_libraries(external_boost_regex INTERFACE Boost::regex) From 60474a576690f63510d87d18ca348d9875c89f08 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sat, 28 Oct 2023 20:27:55 +0400 Subject: [PATCH 193/215] Update Implib.so. --- external/Implib.so | 2 +- options_linux.cmake | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/external/Implib.so b/external/Implib.so index 340e5d3..0ddaa71 160000 --- a/external/Implib.so +++ b/external/Implib.so @@ -1 +1 @@ -Subproject commit 340e5d32a8a3fcc7ac71136abeeb80b4d7dfb9fc +Subproject commit 0ddaa715d2572b100f8248c0fa4450fbf895be14 diff --git a/options_linux.cmake b/options_linux.cmake index f43d7d2..2351d6c 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -89,6 +89,7 @@ if (NOT DESKTOP_APP_USE_PACKAGED OR DESKTOP_APP_SPECIAL_TARGET) INTERFACE -Wl,-z,relro -Wl,-z,now + -Wl,-z,noexecstack -pie ) target_compile_definitions(common_options From 78098ede77a09e41da6233d765d02b43a60e7138 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 3 Nov 2023 07:24:56 +0400 Subject: [PATCH 194/215] Fix target_link_options_if_exists --- target_link_options_if_exists.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target_link_options_if_exists.cmake b/target_link_options_if_exists.cmake index 24a717d..cabd8b3 100644 --- a/target_link_options_if_exists.cmake +++ b/target_link_options_if_exists.cmake @@ -4,7 +4,7 @@ # For license and copyright information please follow this link: # https://github.com/desktop-app/legal/blob/master/LEGAL -include(CheckCXXCompilerFlag) +include(CheckLinkerFlag) function(target_link_options_if_exists target_name) set(writing_now "") @@ -16,7 +16,7 @@ function(target_link_options_if_exists target_name) set(writing_now ${entry}) else() string(MAKE_C_IDENTIFIER ${entry} entry_identifier) - check_cxx_compiler_flag(${entry} DESKTOP_APP_${entry_identifier}_EXISTS) + check_linker_flag(CXX ${entry} DESKTOP_APP_${entry_identifier}_EXISTS) if (DESKTOP_APP_${entry_identifier}_EXISTS) if ("${writing_now}" STREQUAL "PRIVATE") list(APPEND private_options ${entry}) From c373a0a0141bbe146a9507f02b8515183748eb51 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 13 Nov 2023 11:22:58 +0400 Subject: [PATCH 195/215] Make windows.h header lighter. --- options_win.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/options_win.cmake b/options_win.cmake index 8037e8c..9f0a79f 100644 --- a/options_win.cmake +++ b/options_win.cmake @@ -7,9 +7,20 @@ target_compile_definitions(common_options INTERFACE WIN32 + WIN32_LEAN_AND_MEAN _WINDOWS _SCL_SECURE_NO_WARNINGS NOMINMAX + NOSERVICE + NOMCX + NOIME + NOSOUND + NOCOMM + NOKANJI + NORPC + NOPROXYSTUB + NOIMAGE + NOTAPE UNICODE _UNICODE ) From 5abaeaf9222302bc72cce6f45b160f10fb21dd14 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 17 Nov 2023 08:21:20 +0400 Subject: [PATCH 196/215] Fix build with MSVC 17.8.0. --- external/qt/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index b7885f3..ad7316a 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -73,6 +73,11 @@ INTERFACE if (WIN32) set(qt_lib_prefix "") set(qt_lib_suffix $<$:d>.lib) + + target_compile_definitions(external_qt + INTERFACE + _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING + ) else() set(qt_lib_prefix lib) if (APPLE) From c2ef75186a82ab89c6f742f6493def1a0d65ffdf Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 24 Nov 2023 00:56:03 +0400 Subject: [PATCH 197/215] Replace jemalloc with scudo This should provide a wider support for ARM hardware --- CMakeLists.txt | 3 - external/CMakeLists.txt | 6 +- external/jemalloc/CMakeLists.txt | 65 ------------------- external/scudo/CMakeLists.txt | 35 ++++++++++ linux_jemalloc_helper/CMakeLists.txt | 19 ------ .../linux_jemalloc_helper.cpp | 25 ------- options_linux.cmake | 11 ++-- variables.cmake | 2 +- 8 files changed, 44 insertions(+), 122 deletions(-) delete mode 100644 external/jemalloc/CMakeLists.txt create mode 100644 external/scudo/CMakeLists.txt delete mode 100644 linux_jemalloc_helper/CMakeLists.txt delete mode 100644 linux_jemalloc_helper/linux_jemalloc_helper.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index bb8789c..44954c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,9 +5,6 @@ # https://github.com/desktop-app/legal/blob/master/LEGAL add_subdirectory(external) -if (LINUX AND NOT DESKTOP_APP_DISABLE_JEMALLOC) - add_subdirectory(linux_jemalloc_helper) -endif() if (DESKTOP_APP_USE_ALLOCATION_TRACER) add_subdirectory(linux_allocation_tracer) endif() diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index d9af92a..34181cc 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -38,9 +38,6 @@ if (add_hunspell_library) add_checked_subdirectory(hunspell) endif() add_checked_subdirectory(iconv) -if (LINUX AND NOT DESKTOP_APP_DISABLE_JEMALLOC) - add_checked_subdirectory(jemalloc) -endif() add_checked_subdirectory(jpeg) add_checked_subdirectory(kcoreaddons) add_checked_subdirectory(kimageformats) @@ -57,6 +54,9 @@ add_checked_subdirectory(qr_code_generator) add_checked_subdirectory(ranges) add_checked_subdirectory(rlottie) add_checked_subdirectory(rnnoise) +if (LINUX AND NOT DESKTOP_APP_DISABLE_SCUDO) + add_checked_subdirectory(scudo) +endif() add_checked_subdirectory(ton) add_checked_subdirectory(variant) add_checked_subdirectory(vpx) diff --git a/external/jemalloc/CMakeLists.txt b/external/jemalloc/CMakeLists.txt deleted file mode 100644 index 9b87c00..0000000 --- a/external/jemalloc/CMakeLists.txt +++ /dev/null @@ -1,65 +0,0 @@ -# This file is part of Desktop App Toolkit, -# a set of libraries for developing nice desktop applications. -# -# For license and copyright information please follow this link: -# https://github.com/desktop-app/legal/blob/master/LEGAL - -add_library(external_jemalloc INTERFACE IMPORTED GLOBAL) -add_library(desktop-app::external_jemalloc ALIAS external_jemalloc) - -if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") - return() -endif() - -if (DESKTOP_APP_USE_PACKAGED) - find_package(PkgConfig REQUIRED) - pkg_check_modules(JEMALLOC jemalloc) - - if (JEMALLOC_FOUND) - target_include_directories(external_jemalloc SYSTEM - INTERFACE - ${JEMALLOC_INCLUDE_DIRS} - ) - - target_link_libraries(external_jemalloc - INTERFACE - -Wl,--push-state,--no-as-needed,${JEMALLOC_LINK_LIBRARIES},--pop-state - ) - - return() - endif() -endif() - -include(ProcessorCount) -ProcessorCount(N) - -include(ExternalProject) -ExternalProject_Add(jemalloc - URL ${third_party_loc}/jemalloc - CONFIGURE_COMMAND env - CC=clang - CXX=clang++ - "$>,$>,EXTRA_CFLAGS=-fno-omit-frame-pointer -fstack-protector-all -fstack-clash-protection -fcf-protection -DNDEBUG -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS,=>" - "$>,$>,EXTRA_CXXFLAGS=-fno-omit-frame-pointer -fstack-protector-all -fstack-clash-protection -fcf-protection -DNDEBUG -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS,=>" - ./autogen.sh --disable-shared - BUILD_COMMAND make $<$>:-j${N}> - BUILD_IN_SOURCE 1 - STEP_TARGETS build - EXCLUDE_FROM_ALL TRUE - BUILD_BYPRODUCTS /lib/libjemalloc_pic.a -) - -ExternalProject_Get_property(jemalloc SOURCE_DIR) -file(MAKE_DIRECTORY "${SOURCE_DIR}/include") - -target_include_directories(external_jemalloc SYSTEM -INTERFACE - ${SOURCE_DIR}/include -) - -target_link_libraries(external_jemalloc -INTERFACE - -Wl,--push-state,--whole-archive,${SOURCE_DIR}/lib/libjemalloc_pic.a,--pop-state -) - -add_dependencies(external_jemalloc jemalloc-build) diff --git a/external/scudo/CMakeLists.txt b/external/scudo/CMakeLists.txt new file mode 100644 index 0000000..3fc79fb --- /dev/null +++ b/external/scudo/CMakeLists.txt @@ -0,0 +1,35 @@ +# This file is part of Desktop App Toolkit, +# a set of libraries for developing nice desktop applications. +# +# For license and copyright information please follow this link: +# https://github.com/desktop-app/legal/blob/master/LEGAL + +add_library(external_scudo STATIC) +add_library(desktop-app::external_scudo ALIAS external_scudo) +init_target(external_scudo "(external)") + +set(scudo_loc ${third_party_loc}/scudo) + +# https://llvm.org/docs/ScudoHardenedAllocator.html#library +file(GLOB scudo_srcs ${scudo_loc}/*.cpp) +target_sources(external_scudo +PRIVATE + ${scudo_srcs} +) + +target_include_directories(external_scudo SYSTEM +PRIVATE + ${scudo_loc}/include +) + +add_library(external_scudo_options INTERFACE) +target_compile_options(external_scudo_options +INTERFACE + -fno-lto + -Wno-unused-result +) + +target_link_libraries(external_scudo +PRIVATE + external_scudo_options +) diff --git a/linux_jemalloc_helper/CMakeLists.txt b/linux_jemalloc_helper/CMakeLists.txt deleted file mode 100644 index 0466d8a..0000000 --- a/linux_jemalloc_helper/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -# This file is part of Desktop App Toolkit, -# a set of libraries for developing nice desktop applications. -# -# For license and copyright information please follow this link: -# https://github.com/desktop-app/legal/blob/master/LEGAL - -add_library(linux_jemalloc_helper OBJECT) -init_target(linux_jemalloc_helper "(external)") -add_library(desktop-app::linux_jemalloc_helper ALIAS linux_jemalloc_helper) - -nice_target_sources(linux_jemalloc_helper ${CMAKE_CURRENT_SOURCE_DIR} -PRIVATE - linux_jemalloc_helper.cpp -) - -target_link_libraries(linux_jemalloc_helper -PRIVATE - desktop-app::external_jemalloc -) diff --git a/linux_jemalloc_helper/linux_jemalloc_helper.cpp b/linux_jemalloc_helper/linux_jemalloc_helper.cpp deleted file mode 100644 index 76bc863..0000000 --- a/linux_jemalloc_helper/linux_jemalloc_helper.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// This file is part of Desktop App Toolkit, -// a set of libraries for developing nice desktop applications. -// -// For license and copyright information please follow this link: -// https://github.com/desktop-app/legal/blob/master/LEGAL -// -#ifdef __FreeBSD__ -#include -#else // __FreeBSD__ -#include -#endif // !__FreeBSD__ - -namespace { - -class JemallocInitializer { -public: - JemallocInitializer() { - auto backgroundThread = true; - mallctl("background_thread", nullptr, nullptr, &backgroundThread, sizeof(bool)); - } -}; - -static const JemallocInitializer initializer; - -} // namespace diff --git a/options_linux.cmake b/options_linux.cmake index 2351d6c..bd93f79 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -99,12 +99,11 @@ if (NOT DESKTOP_APP_USE_PACKAGED OR DESKTOP_APP_SPECIAL_TARGET) ) endif() -if (NOT DESKTOP_APP_DISABLE_JEMALLOC) - target_link_libraries(common_options - INTERFACE - $ - $ - ) +if (NOT DESKTOP_APP_DISABLE_SCUDO) + target_link_libraries(common_options + INTERFACE + $ + ) endif() if (DESKTOP_APP_USE_ALLOCATION_TRACER) diff --git a/variables.cmake b/variables.cmake index 67af35b..ddc1c58 100644 --- a/variables.cmake +++ b/variables.cmake @@ -31,7 +31,7 @@ option(DESKTOP_APP_USE_HUNSPELL_ONLY "Disable system spellchecker and use bundle cmake_dependent_option(DESKTOP_APP_USE_ENCHANT "Use Enchant instead of bundled Hunspell." OFF LINUX OFF) cmake_dependent_option(DESKTOP_APP_USE_CLD3 "Disable system text language recognition and use bundled cld3 only." OFF APPLE ON) cmake_dependent_option(DESKTOP_APP_NO_PDB "Disable PDB file generation." OFF WIN32 OFF) -cmake_dependent_option(DESKTOP_APP_DISABLE_JEMALLOC "Disable jemalloc, use system malloc." OFF LINUX OFF) +cmake_dependent_option(DESKTOP_APP_DISABLE_SCUDO "Disable scudo, use system malloc." OFF LINUX OFF) if (APPLE AND NOT DEFINED DESKTOP_APP_MAC_ARCH) if (DEFINED CMAKE_OSX_ARCHITECTURES) From 6b5f4bcc432722269627d4292d71229cf05a81ab Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 27 Nov 2023 07:24:22 +0400 Subject: [PATCH 198/215] Support non-VS generator on Windows --- nuget.cmake | 9 ++++++++- run_cmake.py | 12 ++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/nuget.cmake b/nuget.cmake index 8bfac58..8ddce7c 100644 --- a/nuget.cmake +++ b/nuget.cmake @@ -77,7 +77,14 @@ function(nuget_add_winrt target_name) set(gen_dst ${CMAKE_BINARY_DIR}/packages/gen) file(MAKE_DIRECTORY ${gen_dst}/winrt) - set(winrt_sdk_version ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}) + set(winrt_sdk_version) + if (NOT DEFINED CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION) + set(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION) + endif() + # https://gitlab.kitware.com/cmake/cmake/-/blob/89cfb90b9c0893133983b4f25896671c4f07497c/Modules/InstallRequiredSystemLibraries.cmake#L381 + if (";${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION};$ENV{UCRTVersion};$ENV{WindowsSDKVersion};" MATCHES [=[;([0-9.]+)[;\]]=]) + set(winrt_sdk_version ${CMAKE_MATCH_1}) + endif() set(winrt_version_key ${gen_dst}/winrt/version_key) set(winrt_version_test ${winrt_version_key}_test) set(sdk_version_key ${gen_dst}/winrt/sdk_version_key) diff --git a/run_cmake.py b/run_cmake.py index 74f2e1e..97717d9 100644 --- a/run_cmake.py +++ b/run_cmake.py @@ -11,24 +11,24 @@ def run(project, arguments, buildType=''): basePath = scriptPath + '/../out/' + buildType cmake = ['cmake'] - windowsArch = '' + vsArch = '' explicitGenerator = False for arg in arguments: if arg == 'debug': cmake.append('-DCMAKE_BUILD_TYPE=Debug') elif arg == 'x86' or arg == 'x64': - windowsArch = arg + vsArch = arg elif arg != 'force': if arg.startswith('-G'): explicitGenerator = True cmake.append(arg) - if sys.platform == 'win32': - if windowsArch == 'x64': + if sys.platform == 'win32' and not explicitGenerator: + if vsArch == 'x64': cmake.append('-Ax64') else: cmake.append('-AWin32') # default - elif windowsArch != '': - print("[ERROR] x86/x64 switch is supported only on Windows.") + elif vsArch != '': + print("[ERROR] x86/x64 switch is supported only with Visual Studio.") return 1 elif sys.platform == 'darwin': if not explicitGenerator: From 92f27add11ae4280939079249d0f9da933ece6ad Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 29 Nov 2023 20:34:35 +0400 Subject: [PATCH 199/215] Add cppgir ignore files to dependencies --- external/glib/generate_cppgir.cmake | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/external/glib/generate_cppgir.cmake b/external/glib/generate_cppgir.cmake index c9872a6..e1cca4f 100644 --- a/external/glib/generate_cppgir.cmake +++ b/external/glib/generate_cppgir.cmake @@ -5,12 +5,19 @@ # https://github.com/desktop-app/legal/blob/master/LEGAL function(generate_cppgir target_name gir) + set(cppgir_loc ${cmake_helpers_loc}/external/glib/cppgir) + # cppgir generates all the dependent headers everytime, better to have a global folder set(gen_dst ${CMAKE_BINARY_DIR}/gen) file(MAKE_DIRECTORY ${gen_dst}) set(gen_timestamp ${gen_dst}/${target_name}_cppgir.timestamp) + set(ignore_files + ${cppgir_loc}/data/cppgir.ignore + ${cppgir_loc}/data/cppgir_unix.ignore + ) + set(gir_path) if (IS_ABSOLUTE "${gir}") set(gir_path ${gir}) @@ -28,7 +35,7 @@ function(generate_cppgir target_name gir) --expected --optional --ignore - ${cmake_helpers_loc}/external/glib/cppgir/data/cppgir.ignore:${cmake_helpers_loc}/external/glib/cppgir/data/cppgir_unix.ignore + "$" --output ${gen_dst} ${gir} @@ -37,6 +44,7 @@ function(generate_cppgir target_name gir) COMMENT "Generating C++ wrapper for ${gir} (${target_name})" DEPENDS CppGir::cppgir + ${ignore_files} ${gir_path} ) generate_target(${target_name} cppgir ${gen_timestamp} "" ${gen_dst}) From fb4386adc3689dd5337175cbd8eb1c5b6b4ce221 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 26 Dec 2023 04:23:05 +0400 Subject: [PATCH 200/215] Update cppgir --- external/glib/cppgir | 2 +- external/glib/generate_cppgir.cmake | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/external/glib/cppgir b/external/glib/cppgir index 69ef481..b617fa6 160000 --- a/external/glib/cppgir +++ b/external/glib/cppgir @@ -1 +1 @@ -Subproject commit 69ef481cba38e848554cc5403b8d4141d3c51335 +Subproject commit b617fa6131e07594d22ce6ac95892c2e08e4863c diff --git a/external/glib/generate_cppgir.cmake b/external/glib/generate_cppgir.cmake index e1cca4f..c15d3f9 100644 --- a/external/glib/generate_cppgir.cmake +++ b/external/glib/generate_cppgir.cmake @@ -33,7 +33,6 @@ function(generate_cppgir target_name gir) --class --class-full --expected - --optional --ignore "$" --output From aa6d01e1be61fc4a852ebdc3e2473106aade45cf Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 31 Dec 2023 14:09:43 +0400 Subject: [PATCH 201/215] Ensure scudo is whole linked --- options_linux.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/options_linux.cmake b/options_linux.cmake index bd93f79..0349ea9 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -103,6 +103,7 @@ if (NOT DESKTOP_APP_DISABLE_SCUDO) target_link_libraries(common_options INTERFACE $ + -Wl,--push-state,--whole-archive,$,--pop-state ) endif() From 4005d7befb3ffbbbb7851ed767d5b58373958e6d Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 31 Dec 2023 22:37:30 +0400 Subject: [PATCH 202/215] Try to fix circular dependency between external_scudo and common_options --- init_target.cmake | 8 ++++++++ options_linux.cmake | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/init_target.cmake b/init_target.cmake index f022292..549865e 100644 --- a/init_target.cmake +++ b/init_target.cmake @@ -27,6 +27,14 @@ function(init_target target_name) # init_target(my_target [cxx_std_..] folder_na set_property(TARGET ${target_name} APPEND_STRING PROPERTY STATIC_LIBRARY_OPTIONS "$,,/LTCG>") endif() + if (LINUX AND NOT DESKTOP_APP_DISABLE_SCUDO AND NOT target_name STREQUAL external_scudo) + add_dependencies(${target_name} desktop-app::external_scudo) + target_link_options(${target_name} + PRIVATE + -Wl,--push-state,--whole-archive,$,--pop-state + ) + endif() + target_link_libraries(${target_name} PRIVATE desktop-app::common_options) set_target_properties(${target_name} PROPERTIES XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_WEAK YES diff --git a/options_linux.cmake b/options_linux.cmake index 0349ea9..5496622 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -99,14 +99,6 @@ if (NOT DESKTOP_APP_USE_PACKAGED OR DESKTOP_APP_SPECIAL_TARGET) ) endif() -if (NOT DESKTOP_APP_DISABLE_SCUDO) - target_link_libraries(common_options - INTERFACE - $ - -Wl,--push-state,--whole-archive,$,--pop-state - ) -endif() - if (DESKTOP_APP_USE_ALLOCATION_TRACER) target_link_options(common_options INTERFACE From 9620c467404f15a01bb5271af02b2676c2aaf306 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 4 Jan 2024 11:38:53 +0400 Subject: [PATCH 203/215] More cleaning in force-reconfiguration. --- run_cmake.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/run_cmake.py b/run_cmake.py index 97717d9..3826b4a 100644 --- a/run_cmake.py +++ b/run_cmake.py @@ -58,7 +58,8 @@ def run(project, arguments, buildType=''): elif 'force' in arguments: paths = os.listdir(basePath) for path in paths: - if path.lower().startswith('cmake'): + low = path.lower(); + if not low.startswith('debug') and not low.startswith('release'): full = basePath + '/' + path if os.path.isdir(full): shutil.rmtree(full, ignore_errors=False) From e541d6577d542c0e42788341c2ebf0b54e354461 Mon Sep 17 00:00:00 2001 From: Klemens Nanni Date: Thu, 4 Jan 2024 20:44:06 +0100 Subject: [PATCH 204/215] Update cppgir Includes build fix for BSDs. --- external/glib/cppgir | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/glib/cppgir b/external/glib/cppgir index b617fa6..d86b6ab 160000 --- a/external/glib/cppgir +++ b/external/glib/cppgir @@ -1 +1 @@ -Subproject commit b617fa6131e07594d22ce6ac95892c2e08e4863c +Subproject commit d86b6ab9969e453c1e2caa5b77d0d93380c40c59 From e48df0b2ce235cbaa6037c4d76e845543781e79b Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 18 Jan 2024 17:51:14 +0400 Subject: [PATCH 205/215] Remove Xcode 15 workaround, was fixed in 15.1. --- options_mac.cmake | 5 ----- 1 file changed, 5 deletions(-) diff --git a/options_mac.cmake b/options_mac.cmake index 09dea75..8279e4a 100644 --- a/options_mac.cmake +++ b/options_mac.cmake @@ -47,11 +47,6 @@ if (DESKTOP_APP_SPECIAL_TARGET) ) endif() -target_link_options_if_exists(common_options -INTERFACE - -Wl,-ld_classic -) - target_link_frameworks(common_options INTERFACE Cocoa From 82f379f3e5a39f29c2885bed64812a1ca6d9a718 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 19 Jan 2024 21:00:45 +0400 Subject: [PATCH 206/215] Add DESKTOP_APP_ASAN option for MSVC. --- options_win.cmake | 11 +++++++++++ variables.cmake | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/options_win.cmake b/options_win.cmake index 9f0a79f..d84e503 100644 --- a/options_win.cmake +++ b/options_win.cmake @@ -51,6 +51,17 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") $<$:/DEBUG:NONE> ) + if (DESKTOP_APP_ASAN) + target_compile_options(common_options INTERFACE /fsanitize=address) + + # https://developercommunity.visualstudio.com/t/Linker-error-LNK2038-when-using-Parallel/10512721 + target_compile_definitions(common_options + INTERFACE + _DISABLE_VECTOR_ANNOTATION + _DISABLE_STRING_ANNOTATION + ) + endif() + if (build_win64) target_compile_options(common_options INTERFACE diff --git a/variables.cmake b/variables.cmake index ddc1c58..42614fb 100644 --- a/variables.cmake +++ b/variables.cmake @@ -28,6 +28,7 @@ option(DESKTOP_APP_USE_PACKAGED_RLOTTIE "Find rlottie using CMake instead of bun option(DESKTOP_APP_DISABLE_CRASH_REPORTS "Disable crash report generation." ${no_special_target}) option(DESKTOP_APP_DISABLE_AUTOUPDATE "Disable autoupdate." ${disable_autoupdate}) option(DESKTOP_APP_USE_HUNSPELL_ONLY "Disable system spellchecker and use bundled Hunspell only. (For debugging purposes)" OFF) +option(DESKTOP_APP_ASAN "Enable address sanitizer" OFF) cmake_dependent_option(DESKTOP_APP_USE_ENCHANT "Use Enchant instead of bundled Hunspell." OFF LINUX OFF) cmake_dependent_option(DESKTOP_APP_USE_CLD3 "Disable system text language recognition and use bundled cld3 only." OFF APPLE ON) cmake_dependent_option(DESKTOP_APP_NO_PDB "Disable PDB file generation." OFF WIN32 OFF) @@ -88,6 +89,13 @@ else() endif() endif() +#if (DESKTOP_APP_ASAN AND WIN32) +# if (build_win64) +# get_filename_component(libs_loc "../Libraries/asan-win64" REALPATH) +# else() +# get_filename_component(libs_loc "../Libraries/asan" REALPATH) +# endif() +#elseif (build_win64) if (build_win64) get_filename_component(libs_loc "../Libraries/win64" REALPATH) else() From a32690808bd91c15206524eb7fd3a346bf51b149 Mon Sep 17 00:00:00 2001 From: Zephyr Lykos Date: Sun, 21 Jan 2024 21:32:04 +0800 Subject: [PATCH 207/215] Update cppgir to fix nullptr dereference in glib 2.79 https://gitlab.com/mnauw/cppgir/-/issues/67 --- external/glib/cppgir | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/glib/cppgir b/external/glib/cppgir index d86b6ab..748a047 160000 --- a/external/glib/cppgir +++ b/external/glib/cppgir @@ -1 +1 @@ -Subproject commit d86b6ab9969e453c1e2caa5b77d0d93380c40c59 +Subproject commit 748a04795616f792f6fe91edf24620f78a2ef65c From a46279fcfe69ebcc806bb31679ccece5f7c07508 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 14 Feb 2024 08:38:16 +0400 Subject: [PATCH 208/215] Get rid of libproxy --- external/qt/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index ad7316a..b936e9c 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -322,7 +322,6 @@ elseif (APPLE) ) target_link_static_libraries(external_qt INTERFACE - proxy lcms2 xkbcommon xkbcommon-x11 From 6e910dfb4181af80eae767f3ea4611010739f141 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 19 Feb 2024 00:18:22 +0300 Subject: [PATCH 209/215] Added support for AVIF, HEIF and JPEG XL on macOS. --- external/kimageformats/CMakeLists.txt | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/external/kimageformats/CMakeLists.txt b/external/kimageformats/CMakeLists.txt index cbe75f3..3eba594 100644 --- a/external/kimageformats/CMakeLists.txt +++ b/external/kimageformats/CMakeLists.txt @@ -4,7 +4,7 @@ # For license and copyright information please follow this link: # https://github.com/desktop-app/legal/blob/master/LEGAL -if ((DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY) OR APPLE) # should work on macOS, but cmake rules aren't implemented yet +if ((DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY)) # should work on macOS, but cmake rules aren't implemented yet add_library(external_kimageformats INTERFACE IMPORTED GLOBAL) add_library(desktop-app::external_kimageformats ALIAS external_kimageformats) return() @@ -77,6 +77,31 @@ elseif (WIN32) ${libs_loc}/libjxl/third_party/brotli/$,Debug,Release>/brotlienc-static.lib ${libs_loc}/libjxl/third_party/brotli/$,Debug,Release>/brotlicommon-static.lib ) +elseif (APPLE) + target_compile_definitions(external_kimageformats + PRIVATE + JXL_STATIC_DEFINE + JXL_THREADS_STATIC_DEFINE + LIBHEIF_STATIC_BUILD + ) + + target_include_directories(external_kimageformats SYSTEM + PRIVATE + ${libs_loc}/local/include + ) + target_link_libraries(external_kimageformats + PRIVATE + ${libs_loc}/local/lib/libavif.a + ${libs_loc}/local/lib/libheif.a + ${libs_loc}/local/lib/libde265.a + ${libs_loc}/local/lib/libdav1d.a + ${libs_loc}/local/lib/libjxl.a + ${libs_loc}/local/lib/libjxl_threads.a + ${libs_loc}/local/lib/libhwy.a + ${libs_loc}/local/lib/libbrotlidec-static.a + ${libs_loc}/local/lib/libbrotlienc-static.a + ${libs_loc}/local/lib/libbrotlicommon-static.a + ) else() target_link_static_libraries(external_kimageformats PRIVATE From b699c232d57d50070a7b1b861809e206624f48d4 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 7 Mar 2024 00:57:44 +0400 Subject: [PATCH 210/215] Update cppgir --- external/glib/cppgir | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/glib/cppgir b/external/glib/cppgir index 748a047..83d9474 160000 --- a/external/glib/cppgir +++ b/external/glib/cppgir @@ -1 +1 @@ -Subproject commit 748a04795616f792f6fe91edf24620f78a2ef65c +Subproject commit 83d94749d94fdb9b9e97a3e942f73a587a6ef253 From f1628c260b17c55996740fc00b00a7c227b61de2 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 8 Mar 2024 13:24:05 +0400 Subject: [PATCH 211/215] Remove no longer right comment --- external/kimageformats/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/kimageformats/CMakeLists.txt b/external/kimageformats/CMakeLists.txt index 3eba594..f930d62 100644 --- a/external/kimageformats/CMakeLists.txt +++ b/external/kimageformats/CMakeLists.txt @@ -4,7 +4,7 @@ # For license and copyright information please follow this link: # https://github.com/desktop-app/legal/blob/master/LEGAL -if ((DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY)) # should work on macOS, but cmake rules aren't implemented yet +if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY) add_library(external_kimageformats INTERFACE IMPORTED GLOBAL) add_library(desktop-app::external_kimageformats ALIAS external_kimageformats) return() From 5a61112d6d025b56573ad48bcc1331ac65c4a927 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 11 Mar 2024 14:18:57 +0400 Subject: [PATCH 212/215] Fix build on Windows CI --- options_win.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/options_win.cmake b/options_win.cmake index d84e503..442f93b 100644 --- a/options_win.cmake +++ b/options_win.cmake @@ -43,6 +43,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") /wd4244 # '=': conversion from 'size_t' to 'int', possible loss of data. /Zc:wchar_t- # don't tread wchar_t as builtin type /Zi + /INCREMENTAL:NO ) target_link_options(common_options From 5b703df9b8fc5417969fa40ddf12952368ae227b Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 13 Mar 2024 00:44:50 +0400 Subject: [PATCH 213/215] Fix build on Windows CI #2 --- options_win.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options_win.cmake b/options_win.cmake index 442f93b..9abba03 100644 --- a/options_win.cmake +++ b/options_win.cmake @@ -43,13 +43,13 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") /wd4244 # '=': conversion from 'size_t' to 'int', possible loss of data. /Zc:wchar_t- # don't tread wchar_t as builtin type /Zi - /INCREMENTAL:NO ) target_link_options(common_options INTERFACE $,/NODEFAULTLIB:LIBCMT,/DEBUG;/OPT:REF> $<$:/DEBUG:NONE> + /INCREMENTAL:NO ) if (DESKTOP_APP_ASAN) From 89c843ff6a007e08550c3d603d314a4edaae1732 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 13 Mar 2024 12:41:30 +0400 Subject: [PATCH 214/215] Update Qt to 6.7.0 on Linux --- external/qt/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index b936e9c..8a9df97 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -114,6 +114,7 @@ if (TARGET Qt::Quick) list(PREPEND common_qt_libs lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Quick lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Qml + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}QmlBuiltins ) endif() From c82faf706fd10618ad5f97a7972fb09c56843271 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 13 Mar 2024 21:18:49 +0400 Subject: [PATCH 215/215] Remove -static-libgcc to fix the system proxy. --- options_linux.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/options_linux.cmake b/options_linux.cmake index 5496622..b037f67 100644 --- a/options_linux.cmake +++ b/options_linux.cmake @@ -52,7 +52,6 @@ if (NOT DESKTOP_APP_USE_PACKAGED) target_link_options(common_options INTERFACE -static-libstdc++ - -static-libgcc ) elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_link_static_libraries(common_options