1
0
Fork 0

Updated cmake sources to TDesktop version 3.2.5

This commit is contained in:
Eric Kotato 2021-12-04 16:29:09 +03:00
commit e2f26c05de
32 changed files with 667 additions and 130 deletions

View file

@ -5,9 +5,12 @@
# https://github.com/desktop-app/legal/blob/master/LEGAL # https://github.com/desktop-app/legal/blob/master/LEGAL
add_subdirectory(external) add_subdirectory(external)
if (LINUX AND NOT DESKTOP_APP_USE_PACKAGED)
add_subdirectory(linux_xcb_helper)
endif()
if (LINUX if (LINUX
AND NOT DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED
AND Qt5WaylandClient_FOUND) AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
add_subdirectory(linux_wayland_helper) add_subdirectory(linux_wayland_helper)
endif() endif()
if (LINUX AND NOT DESKTOP_APP_USE_PACKAGED) if (LINUX AND NOT DESKTOP_APP_USE_PACKAGED)

View file

@ -21,7 +21,7 @@ add_checked_subdirectory(expected)
if (LINUX AND NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) if (LINUX AND NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION)
add_checked_subdirectory(fcitx_qt5) add_checked_subdirectory(fcitx_qt5)
if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION) if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
add_checked_subdirectory(fcitx5_qt5) add_checked_subdirectory(fcitx5_qt)
endif() endif()
endif() endif()
add_checked_subdirectory(ffmpeg) add_checked_subdirectory(ffmpeg)

View file

@ -10,15 +10,14 @@ add_library(desktop-app::external_crashpad ALIAS external_crashpad)
target_include_directories(external_crashpad SYSTEM target_include_directories(external_crashpad SYSTEM
INTERFACE INTERFACE
${libs_loc}/crashpad ${libs_loc}/crashpad
${libs_loc}/crashpad/third_party/mini_chromium/mini_chromium ${libs_loc}/crashpad/gen
${libs_loc}/crashpad/third_party/mini_chromium
) )
set(crashpad_lib_loc ${libs_loc}/crashpad/out/$<IF:$<CONFIG:Debug>,Debug,Release>) set(crashpad_lib_loc ${libs_loc}/crashpad/out/$<IF:$<CONFIG:Debug>,Debug,Release>)
target_link_libraries(external_crashpad target_link_libraries(external_crashpad
INTERFACE INTERFACE
${crashpad_lib_loc}/libbase.a
${crashpad_lib_loc}/libcrashpad_client.a ${crashpad_lib_loc}/libcrashpad_client.a
${crashpad_lib_loc}/libcrashpad_util.a
bsm bsm
) )

View file

@ -7,7 +7,7 @@
add_library(external_dbusmenu_qt INTERFACE IMPORTED GLOBAL) add_library(external_dbusmenu_qt INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_dbusmenu_qt ALIAS external_dbusmenu_qt) add_library(desktop-app::external_dbusmenu_qt ALIAS external_dbusmenu_qt)
if (DESKTOP_APP_USE_PACKAGED) if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_QT6)
if (DESKTOP_APP_USE_PACKAGED_LAZY) if (DESKTOP_APP_USE_PACKAGED_LAZY)
find_package(dbusmenu-qt5 QUIET) find_package(dbusmenu-qt5 QUIET)
else() else()
@ -48,11 +48,19 @@ if (NOT dbusmenu-qt5_FOUND)
utils.cpp utils.cpp
) )
qt5_add_dbus_adaptor(dbusmenu_adaptor if (DESKTOP_APP_QT6)
${dbusmenu_qt_loc}/com.canonical.dbusmenu.xml qt6_add_dbus_adaptor(dbusmenu_adaptor
${dbusmenu_qt_loc}/dbusmenuexporterdbus_p.h ${dbusmenu_qt_loc}/com.canonical.dbusmenu.xml
DBusMenuExporterDBus ${dbusmenu_qt_loc}/dbusmenuexporterdbus_p.h
) DBusMenuExporterDBus
)
else()
qt5_add_dbus_adaptor(dbusmenu_adaptor
${dbusmenu_qt_loc}/com.canonical.dbusmenu.xml
${dbusmenu_qt_loc}/dbusmenuexporterdbus_p.h
DBusMenuExporterDBus
)
endif()
target_sources(external_dbusmenu_qt_bundled PRIVATE ${dbusmenu_adaptor}) target_sources(external_dbusmenu_qt_bundled PRIVATE ${dbusmenu_adaptor})

View file

@ -5,22 +5,27 @@
# https://github.com/desktop-app/legal/blob/master/LEGAL # https://github.com/desktop-app/legal/blob/master/LEGAL
if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY) if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY)
add_library(external_fcitx5_qt5 INTERFACE IMPORTED GLOBAL) add_library(external_fcitx5_qt INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_fcitx5_qt5 ALIAS external_fcitx5_qt5) add_library(desktop-app::external_fcitx5_qt ALIAS external_fcitx5_qt)
else() else()
add_library(external_fcitx5_qt5 STATIC) add_library(external_fcitx5_qt STATIC)
add_library(desktop-app::external_fcitx5_qt5 ALIAS external_fcitx5_qt5) add_library(desktop-app::external_fcitx5_qt ALIAS external_fcitx5_qt)
init_target(external_fcitx5_qt5 "(external)") init_target(external_fcitx5_qt "(external)")
set(fcitx5_qt_loc ${third_party_loc}/fcitx5-qt) set(fcitx5_qt_loc ${third_party_loc}/fcitx5-qt)
set(fcitx5_qt5_src ${fcitx5_qt_loc}/qt5/platforminputcontext)
set_target_properties(external_fcitx5_qt5 PROPERTIES AUTOMOC ON) 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_target_properties(external_fcitx5_qt PROPERTIES AUTOMOC ON)
set(FCITX5_QT_EXTRA_PLUGIN_NAME "") set(FCITX5_QT_EXTRA_PLUGIN_NAME "")
configure_file("${fcitx5_qt5_src}/fcitx5.json.in" "${CMAKE_CURRENT_BINARY_DIR}/fcitx5.json")
nice_target_sources(external_fcitx5_qt5 ${fcitx5_qt5_src} configure_file("${fcitx5_qt_src}/fcitx5.json.in" "${CMAKE_CURRENT_BINARY_DIR}/fcitx5.json")
nice_target_sources(external_fcitx5_qt ${fcitx5_qt_src}
PRIVATE PRIVATE
qfcitxplatforminputcontext.cpp qfcitxplatforminputcontext.cpp
qfcitxplatforminputcontext.h qfcitxplatforminputcontext.h
@ -35,22 +40,22 @@ else()
main.h main.h
) )
target_include_directories(external_fcitx5_qt5 target_include_directories(external_fcitx5_qt
PRIVATE PRIVATE
${fcitx5_qt5_src} ${fcitx5_qt_src}
${fcitx5_qt_loc}/common ${fcitx5_qt_loc}/common
) )
target_compile_definitions(external_fcitx5_qt5 target_compile_definitions(external_fcitx5_qt
PRIVATE PRIVATE
QT_STATICPLUGIN QT_STATICPLUGIN
FCITX_PLUGIN_DATA_FILE_PATH="${CMAKE_CURRENT_BINARY_DIR}/fcitx5.json" FCITX_PLUGIN_DATA_FILE_PATH="${CMAKE_CURRENT_BINARY_DIR}/fcitx5.json"
) )
add_subdirectory(fcitx5_qt5_dbusaddons) add_subdirectory(fcitx5_qt_dbusaddons)
target_link_libraries(external_fcitx5_qt5 target_link_libraries(external_fcitx5_qt
PRIVATE PRIVATE
desktop-app::external_fcitx5_qt5_dbusaddons desktop-app::external_fcitx5_qt_dbusaddons
desktop-app::external_qt desktop-app::external_qt
desktop-app::external_xcb desktop-app::external_xcb
) )
@ -59,7 +64,7 @@ else()
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
pkg_check_modules(XKBCOMMON REQUIRED IMPORTED_TARGET xkbcommon) pkg_check_modules(XKBCOMMON REQUIRED IMPORTED_TARGET xkbcommon)
target_link_libraries(external_fcitx5_qt5 target_link_libraries(external_fcitx5_qt
PRIVATE PRIVATE
PkgConfig::XKBCOMMON PkgConfig::XKBCOMMON
) )
@ -67,12 +72,12 @@ else()
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
pkg_check_modules(XKBCOMMON REQUIRED xkbcommon) pkg_check_modules(XKBCOMMON REQUIRED xkbcommon)
target_include_directories(external_fcitx5_qt5 SYSTEM target_include_directories(external_fcitx5_qt SYSTEM
PUBLIC PUBLIC
${XKBCOMMON_INCLUDE_DIRS} ${XKBCOMMON_INCLUDE_DIRS}
) )
target_link_static_libraries(external_fcitx5_qt5 target_link_static_libraries(external_fcitx5_qt
PRIVATE PRIVATE
xkbcommon xkbcommon
) )

View file

@ -0,0 +1,65 @@
# 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_fcitx5_qt_dbusaddons INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_fcitx5_qt_dbusaddons ALIAS external_fcitx5_qt_dbusaddons)
else()
add_library(external_fcitx5_qt_dbusaddons STATIC)
add_library(desktop-app::external_fcitx5_qt_dbusaddons ALIAS external_fcitx5_qt_dbusaddons)
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_target_properties(external_fcitx5_qt_dbusaddons PROPERTIES AUTOMOC ON)
nice_target_sources(external_fcitx5_qt_dbusaddons ${fcitx5_qt_dbusaddons_src}
PRIVATE
fcitxqtwatcher.cpp
fcitxqtwatcher.h
fcitxqtdbustypes.cpp
fcitxqtdbustypes.h
fcitxqtinputcontextproxy.cpp
fcitxqtinputcontextproxy.h
fcitxqtinputcontextproxyimpl.cpp
fcitxqtinputmethodproxy.cpp
fcitxqtinputmethodproxy.h
fcitxqtcontrollerproxy.cpp
fcitxqtcontrollerproxy.h
)
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()
target_include_directories(external_fcitx5_qt_dbusaddons
PUBLIC
${fcitx5_qt_dbusaddons_src}
"${CMAKE_CURRENT_BINARY_DIR}"
)
if (NOT DESKTOP_APP_QT6)
target_compile_definitions(external_fcitx5_qt_dbusaddons
PRIVATE
FCITX5QT5DBUSADDONS_STATIC_DEFINE
)
endif()
target_link_libraries(external_fcitx5_qt_dbusaddons
PRIVATE
desktop-app::external_qt
)
endif()

View file

@ -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
if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY)
add_library(external_fcitx5_qt5_dbusaddons INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_fcitx5_qt5_dbusaddons ALIAS external_fcitx5_qt5_dbusaddons)
else()
add_library(external_fcitx5_qt5_dbusaddons STATIC)
add_library(desktop-app::external_fcitx5_qt5_dbusaddons ALIAS external_fcitx5_qt5_dbusaddons)
init_target(external_fcitx5_qt5_dbusaddons "(external)")
set(fcitx5_qt_loc ${third_party_loc}/fcitx5-qt)
set(fcitx5_qt5_dbusaddons_src ${fcitx5_qt_loc}/qt5/dbusaddons)
set_target_properties(external_fcitx5_qt5_dbusaddons PROPERTIES AUTOMOC ON)
nice_target_sources(external_fcitx5_qt5_dbusaddons ${fcitx5_qt5_dbusaddons_src}
PRIVATE
fcitxqtwatcher.cpp
fcitxqtwatcher.h
fcitxqtdbustypes.cpp
fcitxqtdbustypes.h
fcitxqtinputcontextproxy.cpp
fcitxqtinputcontextproxy.h
fcitxqtinputcontextproxyimpl.cpp
fcitxqtinputmethodproxy.cpp
fcitxqtinputmethodproxy.h
fcitxqtcontrollerproxy.cpp
fcitxqtcontrollerproxy.h
)
include(GenerateExportHeader)
generate_export_header(external_fcitx5_qt5_dbusaddons BASE_NAME Fcitx5Qt5DBusAddons)
target_include_directories(external_fcitx5_qt5_dbusaddons
PUBLIC
${fcitx5_qt5_dbusaddons_src}
"${CMAKE_CURRENT_BINARY_DIR}"
)
target_compile_definitions(external_fcitx5_qt5_dbusaddons
PRIVATE
FCITX5QT5DBUSADDONS_STATIC_DEFINE
)
target_link_libraries(external_fcitx5_qt5_dbusaddons
PRIVATE
desktop-app::external_qt
)
endif()

View file

@ -13,7 +13,12 @@ else()
init_target(external_fcitx_qt5 "(external)") init_target(external_fcitx_qt5 "(external)")
set(fcitx_qt5_loc ${third_party_loc}/fcitx-qt5) set(fcitx_qt5_loc ${third_party_loc}/fcitx-qt5)
set(fcitx_qt5_src ${fcitx_qt5_loc}/platforminputcontext)
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_target_properties(external_fcitx_qt5 PROPERTIES AUTOMOC ON) set_target_properties(external_fcitx_qt5 PROPERTIES AUTOMOC ON)
@ -36,10 +41,17 @@ else()
set_source_files_properties(${fcitx_qt5_src}/org.fcitx.Fcitx.InputMethod1.xml PROPERTIES set_source_files_properties(${fcitx_qt5_src}/org.fcitx.Fcitx.InputMethod1.xml PROPERTIES
INCLUDE ${fcitx_qt5_src}/fcitxqtdbustypes.h) INCLUDE ${fcitx_qt5_src}/fcitxqtdbustypes.h)
qt5_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputContext.xml inputcontextproxy) if (DESKTOP_APP_QT6)
qt5_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.InputContext.xml inputcontextproxy)
qt5_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.InputContext1.xml inputcontext1proxy)
qt5_add_dbus_interface(fcitx_qt5_adaptors ${fcitx_qt5_src}/org.fcitx.Fcitx.InputMethod1.xml inputmethod1proxy) 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()
target_sources(external_fcitx_qt5 PRIVATE ${fcitx_qt5_adaptors}) target_sources(external_fcitx_qt5 PRIVATE ${fcitx_qt5_adaptors})

View file

@ -33,7 +33,7 @@ if (NOT JEMALLOC_FOUND)
include(ExternalProject) include(ExternalProject)
ExternalProject_Add(jemalloc ExternalProject_Add(jemalloc
SOURCE_DIR ${jemalloc_loc} SOURCE_DIR ${jemalloc_loc}
CONFIGURE_COMMAND cd "${jemalloc_loc}" && CC=clang CXX=clang++ EXTRA_CFLAGS=-fPIE EXTRA_CXXFLAGS=-fPIE ./autogen.sh CONFIGURE_COMMAND cd "${jemalloc_loc}" && export EXTRA_CFLAGS=-fstack-protector-all\ -fPIC\ -D_FORTIFY_SOURCE=2 && export EXTRA_CXXFLAGS=-fstack-protector-all\ -fPIC\ -D_FORTIFY_SOURCE=2 && CC=clang CXX=clang++ ./autogen.sh
INSTALL_COMMAND : INSTALL_COMMAND :
BUILD_IN_SOURCE 1 BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${jemalloc_loc}/lib/libjemalloc.a BUILD_BYPRODUCTS ${jemalloc_loc}/lib/libjemalloc.a

View file

@ -25,11 +25,17 @@ else()
/usr/local/include/KF5/KWayland/Client /usr/local/include/KF5/KWayland/Client
) )
if (DESKTOP_APP_QT6)
set(qtconcurrent_loc ${qt_loc}/lib/libQt6Concurrent.a)
else()
set(qtconcurrent_loc ${qt_loc}/lib/libQt5Concurrent.a)
endif()
target_link_libraries(external_kwayland target_link_libraries(external_kwayland
INTERFACE INTERFACE
desktop-app::linux_wayland_helper desktop-app::linux_wayland_helper
$<TARGET_FILE:desktop-app::linux_wayland_helper> $<TARGET_FILE:desktop-app::linux_wayland_helper>
${qt_loc}/lib/libQt5Concurrent.a ${qtconcurrent_loc}
desktop-app::external_qt desktop-app::external_qt
) )
endif() endif()

View file

@ -4,11 +4,15 @@
# For license and copyright information please follow this link: # For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL # 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(external_qt INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_qt ALIAS external_qt) add_library(desktop-app::external_qt ALIAS external_qt)
add_subdirectory(qt_static_plugins)
if (DESKTOP_APP_USE_PACKAGED) if (DESKTOP_APP_USE_PACKAGED)
target_link_libraries(external_qt target_link_libraries(external_qt
INTERFACE INTERFACE
@ -38,7 +42,7 @@ if (DESKTOP_APP_USE_PACKAGED)
) )
endif() endif()
if (Qt5WaylandClient_FOUND) if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
target_link_libraries(external_qt INTERFACE Qt5::WaylandClient) target_link_libraries(external_qt INTERFACE Qt5::WaylandClient)
target_include_directories(external_qt SYSTEM target_include_directories(external_qt SYSTEM
@ -76,7 +80,7 @@ else()
) )
endif() endif()
if (Qt5WaylandClient_FOUND) if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
target_include_directories(external_qt SYSTEM target_include_directories(external_qt SYSTEM
INTERFACE INTERFACE
${qt_loc}/include/QtWaylandClient ${qt_loc}/include/QtWaylandClient
@ -111,7 +115,7 @@ else()
) )
endif() endif()
if (Qt5WaylandClient_FOUND) if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
target_compile_definitions(external_qt target_compile_definitions(external_qt
INTERFACE INTERFACE
QT_WAYLANDCLIENT_LIB QT_WAYLANDCLIENT_LIB
@ -202,13 +206,12 @@ else()
endif() endif()
set(qt_libs_waylandclient) set(qt_libs_waylandclient)
set(qt_libs_waylandclient_plugins) set(qt_libs_waylandclient_plugins)
if (Qt5WaylandClient_FOUND) if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
set(qt_libs_waylandclient lib/${qt_lib_prefix}Qt5WaylandClient) set(qt_libs_waylandclient lib/${qt_lib_prefix}Qt5WaylandClient)
set(qt_libs_waylandclient_plugins set(qt_libs_waylandclient_plugins
plugins/platforms/${qt_lib_prefix}qwayland-generic plugins/platforms/${qt_lib_prefix}qwayland-generic
plugins/platforms/${qt_lib_prefix}qwayland-egl plugins/platforms/${qt_lib_prefix}qwayland-egl
plugins/wayland-graphics-integration-client/${qt_lib_prefix}qt-plugin-wayland-egl plugins/wayland-graphics-integration-client/${qt_lib_prefix}qt-plugin-wayland-egl
plugins/wayland-shell-integration/${qt_lib_prefix}wl-shell
plugins/wayland-decoration-client/${qt_lib_prefix}bradient plugins/wayland-decoration-client/${qt_lib_prefix}bradient
) )
endif() endif()
@ -278,7 +281,7 @@ else()
xcb-keysyms xcb-keysyms
z z
) )
if (Qt5WaylandClient_FOUND) if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
target_link_libraries(external_qt target_link_libraries(external_qt
INTERFACE INTERFACE
desktop-app::linux_wayland_helper desktop-app::linux_wayland_helper
@ -287,6 +290,8 @@ else()
endif() endif()
target_link_libraries(external_qt target_link_libraries(external_qt
INTERFACE INTERFACE
desktop-app::linux_xcb_helper
$<TARGET_FILE:desktop-app::linux_xcb_helper>
desktop-app::linux_gtk_helper desktop-app::linux_gtk_helper
$<TARGET_FILE:desktop-app::linux_gtk_helper> $<TARGET_FILE:desktop-app::linux_gtk_helper>
desktop-app::linux_glib_helper desktop-app::linux_glib_helper

View file

@ -5,7 +5,11 @@
# https://github.com/desktop-app/legal/blob/master/LEGAL # https://github.com/desktop-app/legal/blob/master/LEGAL
if (NOT DESKTOP_APP_USE_PACKAGED) if (NOT DESKTOP_APP_USE_PACKAGED)
set(qt_version 5.15.2) if (DESKTOP_APP_QT6)
set(qt_version 6.2.0)
else()
set(qt_version 5.15.2)
endif()
if (WIN32) if (WIN32)
set(qt_loc ${libs_loc}/Qt-${qt_version}) set(qt_loc ${libs_loc}/Qt-${qt_version})
@ -15,22 +19,37 @@ if (NOT DESKTOP_APP_USE_PACKAGED)
set(qt_loc /usr/local/desktop-app/Qt-${qt_version}) set(qt_loc /usr/local/desktop-app/Qt-${qt_version})
endif() endif()
set(Qt5_DIR ${qt_loc}/lib/cmake/Qt5) set(CMAKE_PREFIX_PATH ${qt_loc})
endif() endif()
find_package(Qt5 COMPONENTS Core Gui Widgets Network Svg REQUIRED) if (DESKTOP_APP_QT6)
find_package(Qt5Gui COMPONENTS QWebpPlugin REQUIRED) find_package(Qt6 COMPONENTS Core Core5Compat Gui OpenGL Widgets OpenGLWidgets Network Svg REQUIRED)
else()
find_package(Qt5 COMPONENTS Core Gui Widgets Network Svg REQUIRED)
endif()
if (LINUX) if (LINUX)
if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
find_package(Qt5 COMPONENTS WaylandClient REQUIRED) if (DESKTOP_APP_QT6)
find_package(Qt5 OPTIONAL_COMPONENTS XkbCommonSupport QUIET) find_package(Qt6 COMPONENTS WaylandClient REQUIRED)
else()
find_package(Qt5 COMPONENTS WaylandClient REQUIRED)
find_package(Qt5 OPTIONAL_COMPONENTS XkbCommonSupport QUIET)
endif()
endif() endif()
if (DESKTOP_APP_DISABLE_DBUS_INTEGRATION) if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION)
find_package(Qt5 OPTIONAL_COMPONENTS DBus QUIET) if (DESKTOP_APP_QT6)
else() find_package(Qt6 COMPONENTS DBus REQUIRED)
find_package(Qt5 COMPONENTS DBus REQUIRED) else()
find_package(Qt5 COMPONENTS DBus REQUIRED)
endif()
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()
endif() endif()
endif() endif()

283
external/qt/qt6/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,283 @@
# 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::Core5Compat
Qt6::Gui
Qt6::OpenGL
Qt6::Widgets
Qt6::OpenGLWidgets
Qt6::Network
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)
endif()
if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
target_link_libraries(external_qt INTERFACE Qt6::WaylandClient)
target_include_directories(external_qt SYSTEM
INTERFACE
${Qt6WaylandClient_PRIVATE_INCLUDE_DIRS}
)
endif()
else()
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/QtWaylandClient/${qt_version}
${qt_loc}/include/QtWaylandClient/${qt_version}/QtWaylandClient
)
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
)
endif()
if (WIN32)
set(qt_lib_prefix "")
set(qt_lib_suffix $<$<CONFIG:Debug>:d>.lib)
else()
set(qt_lib_prefix lib)
if (APPLE)
set(qt_lib_suffix $<$<CONFIG:Debug>:_debug>.a)
else()
set(qt_lib_suffix .a)
endif()
endif()
if (LINUX)
set(qt_lib_objects objects-RelWithDebInfo)
else()
set(qt_lib_objects objects-$<IF:$<CONFIG:Debug>,Debug,RelWithDebInfo>)
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)
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)
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
"${qt_loc}/lib/${qt_lib_objects}/QCocoaIntegrationPlugin_resources_1/.rcc/qrc_qcocoaresources.cpp.o"
)
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
)
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-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
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
${qt_libs_waylandclient}
${common_qt_libs}
${qt_libs_dbus}
)
foreach (lib ${qt_libs})
list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}")
endforeach()
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
INTERFACE
${qt_libs_list}
$<TARGET_FILE:desktop-app::external_openssl_ssl>
$<TARGET_FILE:desktop-app::external_openssl_crypto>
desktop-app::external_jpeg
desktop-app::external_zlib
)
if (LINUX)
target_include_directories(external_qt SYSTEM
INTERFACE
${qt_loc}/mkspecs/linux-g++
)
target_link_static_libraries(external_qt
INTERFACE
proxy
epoxy
xkbcommon
xkbcommon-x11
xcb-glx
xcb-xkb
xcb-randr
xcb-icccm
xcb-shm
xcb-render
xcb-image
xcb-xfixes
xcb-xinput
xcb-shape
xcb-sync
xcb-util
xcb-render-util
xcb-keysyms
z
)
if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
target_link_libraries(external_qt
INTERFACE
desktop-app::linux_wayland_helper
$<TARGET_FILE:desktop-app::linux_wayland_helper>
)
endif()
target_link_libraries(external_qt
INTERFACE
desktop-app::linux_xcb_helper
$<TARGET_FILE:desktop-app::linux_xcb_helper>
desktop-app::linux_gtk_helper
$<TARGET_FILE:desktop-app::linux_gtk_helper>
desktop-app::linux_glib_helper
$<TARGET_FILE:desktop-app::linux_glib_helper>
fontconfig
freetype
xcb
X11
X11-xcb
${CMAKE_DL_LIBS}
pthread
)
endif()
endif()

View file

@ -33,7 +33,7 @@ if (LINUX)
if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION) if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
target_link_libraries(external_qt_static_plugins target_link_libraries(external_qt_static_plugins
PUBLIC PUBLIC
desktop-app::external_fcitx5_qt5 desktop-app::external_fcitx5_qt
) )
endif() endif()
endif() endif()

View file

@ -8,13 +8,22 @@ https://github.com/desktop-app/legal/blob/master/LEGAL
#include <QtCore/QtPlugin> #include <QtCore/QtPlugin>
#ifndef DESKTOP_APP_USE_PACKAGED #ifndef DESKTOP_APP_USE_PACKAGED
Q_IMPORT_PLUGIN(QGenericEnginePlugin) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
Q_IMPORT_PLUGIN(QWebpPlugin)
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 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
Q_IMPORT_PLUGIN(QGenericEnginePlugin)
#endif // Qt < 6.0.0
Q_IMPORT_PLUGIN(QWebpPlugin)
Q_IMPORT_PLUGIN(QJpegPlugin) Q_IMPORT_PLUGIN(QJpegPlugin)
Q_IMPORT_PLUGIN(QGifPlugin) Q_IMPORT_PLUGIN(QGifPlugin)
#endif // Qt 5.8.0
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
@ -27,15 +36,16 @@ Q_IMPORT_PLUGIN(QXcbGlxIntegrationPlugin)
Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin) Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin)
Q_IMPORT_PLUGIN(QSvgIconPlugin) Q_IMPORT_PLUGIN(QSvgIconPlugin)
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
Q_IMPORT_PLUGIN(QConnmanEnginePlugin) Q_IMPORT_PLUGIN(QConnmanEnginePlugin)
Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin) Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin)
#endif // Qt < 6.0.0
Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin) Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin)
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#ifndef DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION #ifndef DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
Q_IMPORT_PLUGIN(QWaylandIntegrationPlugin) Q_IMPORT_PLUGIN(QWaylandIntegrationPlugin)
Q_IMPORT_PLUGIN(QWaylandEglPlatformIntegrationPlugin) Q_IMPORT_PLUGIN(QWaylandEglPlatformIntegrationPlugin)
Q_IMPORT_PLUGIN(QWaylandEglClientBufferPlugin) Q_IMPORT_PLUGIN(QWaylandEglClientBufferPlugin)
Q_IMPORT_PLUGIN(QWaylandWlShellIntegrationPlugin)
Q_IMPORT_PLUGIN(QWaylandBradientDecorationPlugin) Q_IMPORT_PLUGIN(QWaylandBradientDecorationPlugin)
#endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION #endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
Q_IMPORT_PLUGIN(QGtk3ThemePlugin) Q_IMPORT_PLUGIN(QGtk3ThemePlugin)

View file

@ -119,6 +119,7 @@ else()
PRIVATE PRIVATE
_USE_MATH_DEFINES _USE_MATH_DEFINES
"RAPIDJSON_ASSERT=(void)" "RAPIDJSON_ASSERT=(void)"
LOTTIE_DISABLE_ARM_NEON
) )
target_include_directories(external_rlottie_bundled target_include_directories(external_rlottie_bundled

View file

@ -18,11 +18,19 @@ PRIVATE
statusnotifieritem.h statusnotifieritem.h
) )
qt5_add_dbus_adaptor(sni_adaptor if (DESKTOP_APP_QT6)
${statusnotifieritem_loc}/org.kde.StatusNotifierItem.xml qt6_add_dbus_adaptor(sni_adaptor
${statusnotifieritem_loc}/statusnotifieritem.h ${statusnotifieritem_loc}/org.kde.StatusNotifierItem.xml
StatusNotifierItem ${statusnotifieritem_loc}/statusnotifieritem.h
) StatusNotifierItem
)
else()
qt5_add_dbus_adaptor(sni_adaptor
${statusnotifieritem_loc}/org.kde.StatusNotifierItem.xml
${statusnotifieritem_loc}/statusnotifieritem.h
StatusNotifierItem
)
endif()
set_target_properties(external_statusnotifieritem PROPERTIES AUTOMOC ON) set_target_properties(external_statusnotifieritem PROPERTIES AUTOMOC ON)

View file

@ -53,3 +53,11 @@ function(init_target target_name) # init_target(my_target folder_name)
) )
endif() endif()
endfunction() 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}"
)
endfunction()

View file

@ -5,6 +5,7 @@
# https://github.com/desktop-app/legal/blob/master/LEGAL # https://github.com/desktop-app/legal/blob/master/LEGAL
add_library(linux_glib_helper STATIC) add_library(linux_glib_helper STATIC)
init_target(linux_glib_helper "(external)")
add_library(desktop-app::linux_glib_helper ALIAS linux_glib_helper) add_library(desktop-app::linux_glib_helper ALIAS linux_glib_helper)
nice_target_sources(linux_glib_helper ${CMAKE_CURRENT_SOURCE_DIR} nice_target_sources(linux_glib_helper ${CMAKE_CURRENT_SOURCE_DIR}

View file

@ -29,6 +29,7 @@ guint (*g_log_set_handler)(
GMainContext* (*g_main_context_default)(void); GMainContext* (*g_main_context_default)(void);
gboolean (*g_main_context_iteration)(GMainContext* context, gboolean may_block); gboolean (*g_main_context_iteration)(GMainContext* context, gboolean may_block);
GMainContext* (*g_main_context_new)(void); GMainContext* (*g_main_context_new)(void);
// TODO: Remove when Qt 5 support will be dropped
gboolean (*g_main_context_pending)(GMainContext* context); gboolean (*g_main_context_pending)(GMainContext* context);
void (*g_main_context_pop_thread_default)(GMainContext* context); void (*g_main_context_pop_thread_default)(GMainContext* context);
void (*g_main_context_push_thread_default)(GMainContext* context); void (*g_main_context_push_thread_default)(GMainContext* context);
@ -46,6 +47,7 @@ void (*g_source_destroy)(GSource* source);
GSource* (*g_source_new)(GSourceFuncs* source_funcs, guint struct_size); GSource* (*g_source_new)(GSourceFuncs* source_funcs, guint struct_size);
void (*g_source_remove_poll)(GSource* source, GPollFD* fd); void (*g_source_remove_poll)(GSource* source, GPollFD* fd);
void (*g_source_set_can_recurse)(GSource* source, gboolean can_recurse); void (*g_source_set_can_recurse)(GSource* source, gboolean can_recurse);
void (*g_source_set_name)(GSource* source, const char* name);
void (*g_source_unref)(GSource* source); void (*g_source_unref)(GSource* source);
int (*g_strcmp0)(const char* str1, const char* str2); int (*g_strcmp0)(const char* str1, const char* str2);
@ -140,6 +142,7 @@ bool Resolve() {
&& LOAD_SYMBOL(lib, g_source_new) && LOAD_SYMBOL(lib, g_source_new)
&& LOAD_SYMBOL(lib, g_source_remove_poll) && LOAD_SYMBOL(lib, g_source_remove_poll)
&& LOAD_SYMBOL(lib, g_source_set_can_recurse) && LOAD_SYMBOL(lib, g_source_set_can_recurse)
&& LOAD_SYMBOL(lib, g_source_set_name)
&& LOAD_SYMBOL(lib, g_source_unref) && LOAD_SYMBOL(lib, g_source_unref)
&& LOAD_SYMBOL(lib, g_strcmp0) && LOAD_SYMBOL(lib, g_strcmp0)
&& LoadLibrary(lib, "libgobject-2.0.so.0") && LoadLibrary(lib, "libgobject-2.0.so.0")
@ -283,6 +286,11 @@ void g_source_set_can_recurse(GSource* source, gboolean can_recurse) {
GlibHelper::g_source_set_can_recurse(source, can_recurse); GlibHelper::g_source_set_can_recurse(source, can_recurse);
} }
void g_source_set_name(GSource* source, const char* name) {
GlibHelper::Resolve();
GlibHelper::g_source_set_name(source, name);
}
void g_source_unref(GSource* source) { void g_source_unref(GSource* source) {
GlibHelper::Resolve(); GlibHelper::Resolve();
GlibHelper::g_source_unref(source); GlibHelper::g_source_unref(source);

View file

@ -5,6 +5,7 @@
# https://github.com/desktop-app/legal/blob/master/LEGAL # https://github.com/desktop-app/legal/blob/master/LEGAL
add_library(linux_gtk_helper STATIC) add_library(linux_gtk_helper STATIC)
init_target(linux_gtk_helper "(external)")
add_library(desktop-app::linux_gtk_helper ALIAS linux_gtk_helper) add_library(desktop-app::linux_gtk_helper ALIAS linux_gtk_helper)
nice_target_sources(linux_gtk_helper ${CMAKE_CURRENT_SOURCE_DIR} nice_target_sources(linux_gtk_helper ${CMAKE_CURRENT_SOURCE_DIR}

View file

@ -5,6 +5,7 @@
# https://github.com/desktop-app/legal/blob/master/LEGAL # https://github.com/desktop-app/legal/blob/master/LEGAL
add_library(linux_wayland_helper STATIC) add_library(linux_wayland_helper STATIC)
init_target(linux_wayland_helper "(external)")
add_library(desktop-app::linux_wayland_helper ALIAS linux_wayland_helper) add_library(desktop-app::linux_wayland_helper ALIAS linux_wayland_helper)
nice_target_sources(linux_wayland_helper ${CMAKE_CURRENT_SOURCE_DIR} nice_target_sources(linux_wayland_helper ${CMAKE_CURRENT_SOURCE_DIR}

View file

@ -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(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
)
target_link_libraries(linux_xcb_helper
PUBLIC
${CMAKE_DL_LIBS}
)

View file

@ -0,0 +1,53 @@
// 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 <dlfcn.h>
#include <stdlib.h>
#include <xcb/xcb.h>
#include <xcb/xcbext.h>
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<unsigned int(*)(
xcb_connection_t*,
int,
struct iovec*,
const xcb_protocol_request_t*,
unsigned int,
int*)>(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<void(*)(xcb_connection_t*, int)>(
dlsym(RTLD_NEXT, "xcb_send_fd"));
if (dlerror()) {
abort();
}
const auto send_request = reinterpret_cast<unsigned int(*)(
xcb_connection_t*,
int,
struct iovec*,
const xcb_protocol_request_t*)>(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);
}

View file

@ -12,6 +12,7 @@ INTERFACE
$<$<CONFIG:Debug>:_DEBUG> $<$<CONFIG:Debug>:_DEBUG>
QT_NO_KEYWORDS QT_NO_KEYWORDS
QT_NO_CAST_FROM_BYTEARRAY QT_NO_CAST_FROM_BYTEARRAY
QT_IMPLICIT_QCHAR_CONSTRUCTION
) )
if (DESKTOP_APP_DISABLE_CRASH_REPORTS) if (DESKTOP_APP_DISABLE_CRASH_REPORTS)
@ -56,13 +57,6 @@ if (DESKTOP_APP_USE_PACKAGED_LAZY)
) )
endif() endif()
if (DESKTOP_APP_DISABLE_WEBKITGTK)
target_compile_definitions(common_options
INTERFACE
DESKTOP_APP_DISABLE_WEBKITGTK
)
endif()
if (DESKTOP_APP_USE_PACKAGED_FONTS) if (DESKTOP_APP_USE_PACKAGED_FONTS)
target_compile_definitions(common_options target_compile_definitions(common_options
INTERFACE INTERFACE

View file

@ -6,6 +6,8 @@
target_compile_options(common_options target_compile_options(common_options
INTERFACE INTERFACE
-fstack-protector-all
-fstack-clash-protection
-fPIC -fPIC
$<IF:$<CONFIG:Debug>,,-fno-strict-aliasing> $<IF:$<CONFIG:Debug>,,-fno-strict-aliasing>
-pipe -pipe
@ -17,6 +19,11 @@ INTERFACE
-Wno-sign-compare -Wno-sign-compare
) )
target_compile_definitions(common_options
INTERFACE
$<IF:$<CONFIG:Debug>,,_FORTIFY_SOURCE=2>
)
target_link_options(common_options target_link_options(common_options
INTERFACE INTERFACE
-Wl,--as-needed -Wl,--as-needed
@ -29,6 +36,14 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
) )
endif() 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) if (DESKTOP_APP_SPECIAL_TARGET)
target_compile_options(common_options target_compile_options(common_options
INTERFACE INTERFACE
@ -96,6 +111,9 @@ if (NOT DESKTOP_APP_USE_PACKAGED)
-pthread -pthread
-rdynamic -rdynamic
-fwhole-program -fwhole-program
-Wl,-z,relro
-Wl,-z,now
# -pie # https://gitlab.gnome.org/GNOME/nautilus/-/issues/1601
) )
endif() endif()

View file

@ -47,6 +47,11 @@ if (DESKTOP_APP_SPECIAL_TARGET)
) )
endif() endif()
target_link_options(common_options
INTERFACE
-Wl,-no_compact_unwind
)
target_link_frameworks(common_options target_link_frameworks(common_options
INTERFACE INTERFACE
Cocoa Cocoa

View file

@ -101,8 +101,10 @@ INTERFACE
Userenv Userenv
Version Version
Dwmapi Dwmapi
UxTheme
Wtsapi32 Wtsapi32
Crypt32 Crypt32
Propsys
) )
if (build_winstore) if (build_winstore)

View file

@ -45,7 +45,7 @@ def run(project, arguments, buildType=''):
cmake.append('-DDESKTOP_APP_SPECIAL_TARGET=' + target) cmake.append('-DDESKTOP_APP_SPECIAL_TARGET=' + target)
cmake.extend(['-Werror=dev', '-Werror=deprecated', '--warn-uninitialized', '..' if not buildType else '../..']) cmake.extend(['-Werror=dev', '-Werror=deprecated', '--warn-uninitialized', '..' if not buildType else '../..'])
command = ' '.join(cmake) command = '"' + '" "'.join(cmake) + '"'
if not os.path.exists(basePath): if not os.path.exists(basePath):
os.makedirs(basePath) os.makedirs(basePath)

49
target_prepare_qrc.cmake Normal file
View file

@ -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
function(target_add_resource target_name)
set(list ${ARGV})
list(REMOVE_AT list 0)
target_sources(${target_name} PRIVATE ${list})
get_target_property(existing_resources ${target_name} RESOURCE)
if (NOT "${existing_resources}" STREQUAL "existing_resources-NOTFOUND")
foreach(existing ${existing_resources})
list(APPEND list ${existing})
endforeach()
endif()
set_target_properties(${target_name} PROPERTIES RESOURCE "${list}")
endfunction()
function(target_prepare_qrc target_name)
if (NOT APPLE)
set_target_properties(${target_name} PROPERTIES AUTORCC ON)
else()
set(rcc_flags --binary "$<TARGET_PROPERTY:${target_name},AUTORCC_OPTIONS>")
set(qrc_files_all "$<FILTER:$<TARGET_PROPERTY:${target_name},SOURCES>,INCLUDE,\\.qrc$>")
if (WIN32)
set(qrc_files "$<FILTER:${qrc_files_all},EXCLUDE,(mac|darwin|osx|linux|posix)\\.>")
elseif (APPLE)
set(qrc_files "$<FILTER:${qrc_files_all},EXCLUDE,(win|linux)\\.>")
elseif (LINUX)
set(qrc_files "$<FILTER:${qrc_files_all},EXCLUDE,(win|mac|darwin|osx)\\.>")
endif()
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_EXPAND_LISTS VERBATIM
)
target_add_resource(${target_name} ${rcc_path})
endif()
endfunction()

View file

@ -6,16 +6,23 @@
set(DESKTOP_APP_SPECIAL_TARGET "" CACHE STRING "Use special platform target, like 'macstore' for Mac App Store.") set(DESKTOP_APP_SPECIAL_TARGET "" CACHE STRING "Use special platform target, like 'macstore' for Mac App Store.")
set(default_to_qt6 1)
if (WIN32)
set(default_to_qt6 0)
endif()
option(DESKTOP_APP_QT6 "Build with Qt 6" ${default_to_qt6})
function(report_bad_special_target) function(report_bad_special_target)
if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "") if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "")
message(FATAL_ERROR "Bad special target '${DESKTOP_APP_SPECIAL_TARGET}'") message(FATAL_ERROR "Bad special target '${DESKTOP_APP_SPECIAL_TARGET}'")
endif() endif()
endfunction() endfunction()
if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "osx") set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Minimum macOS deployment version" FORCE)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Minimum OS X deployment version" FORCE) if (DESKTOP_APP_QT6)
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Target macOS architectures" FORCE)
else() else()
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10 CACHE STRING "Minimum OS X deployment version" FORCE) set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Target macOS architectures" FORCE)
endif() endif()
if (WIN32) if (WIN32)

View file

@ -26,12 +26,12 @@ option(DESKTOP_APP_USE_PACKAGED "Find libraries using CMake instead of exact pat
option(DESKTOP_APP_USE_PACKAGED_LAZY "Bundle recommended Qt plugins for self-contained packages. (Linux only)" OFF) option(DESKTOP_APP_USE_PACKAGED_LAZY "Bundle recommended Qt plugins for self-contained packages. (Linux only)" OFF)
option(DESKTOP_APP_USE_PACKAGED_FFMPEG_STATIC "Link ffmpeg statically in packaged mode." OFF) option(DESKTOP_APP_USE_PACKAGED_FFMPEG_STATIC "Link ffmpeg statically in packaged mode." OFF)
option(DESKTOP_APP_DISABLE_SPELLCHECK "Disable spellcheck library." OFF) option(DESKTOP_APP_DISABLE_SPELLCHECK "Disable spellcheck library." OFF)
option(DESKTOP_APP_DISABLE_WEBKITGTK "Disable WebKitGTK library (Linux only)." OFF)
option(DESKTOP_APP_DISABLE_CRASH_REPORTS "Disable crash report generation." ${no_special_target}) 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_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_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_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_NO_PDB "Disable PDB file generation. (Windows only)" OFF)
set(DESKTOP_APP_MAC_ARCH "x86_64;arm64" CACHE STRING "Target macOS arch. (macOS only)")
set(dont_bundle_fonts 0) set(dont_bundle_fonts 0)
if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY) if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY)