1
0
Fork 0

Build bundled kcoreaddons

This commit is contained in:
Ilya Fedin 2022-09-21 10:27:14 +04:00 committed by John Preston
parent f49e254d8c
commit 84f43a8252
4 changed files with 77 additions and 80 deletions

View file

@ -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 <QLoggingCategory>\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
)

View file

@ -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

View file

@ -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 <QtCore/QMimeData>
namespace KUrlMimeData {
enum DecodeOptions {
PreferLocalUrls,
PreferKdeUrls,
};
inline bool exportUrlsToPortal(QMimeData *mimeData) {
return false;
}
inline auto urlsFromMimeData(const QMimeData *mimeData, ...) {
return mimeData->urls();
}
} // namespace KUrlMimeData

View file

@ -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)