CMakeLists.txt 5.08 KB
Newer Older
1
2
cmake_minimum_required(VERSION 3.0)

3
# KDE Release Service Version, managed by release script
4
set (RELEASE_SERVICE_VERSION_MAJOR "21")
5
set (RELEASE_SERVICE_VERSION_MINOR "07")
6
set (RELEASE_SERVICE_VERSION_MICRO "80")
7
8
9
set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")

project(kdeconnect VERSION ${RELEASE_SERVICE_VERSION})
Laurent Montel's avatar
Laurent Montel committed
10
set(CMAKE_C_STANDARD 99)
11
12
set(CMAKE_CXX_STANDARD 17)

13
if (SAILFISHOS)
14
    set(KF5_MIN_VERSION "5.36.0")
15
16
    set(QT_MIN_VERSION "5.6.0")
else()
17
    set(KF5_MIN_VERSION "5.71.0")
18
19
    set(QT_MIN_VERSION "5.10.0")
endif()
20
set(QCA_MIN_VERSION "2.1.0")
21

Nicolas Fella's avatar
Nicolas Fella committed
22
23
24
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)

25
26
27
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

Nicolas Fella's avatar
Nicolas Fella committed
28
29
30
31
32
33
include(KDEInstallDirs)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(KDECMakeSettings)
include(ECMAddTests)
include(ECMSetupVersion)
include(ECMInstallIcons)
34
include(ECMQtDeclareLoggingCategory)
Nicolas Fella's avatar
Nicolas Fella committed
35
36
include(FeatureSummary)
include(GenerateExportHeader)
37
include(ECMGenerateQmlTypes)
38
39
40
if (NOT SAILFISHOS)
    include(ECMQMLModules)
endif()
Albert Vaca Cintora's avatar
Albert Vaca Cintora committed
41

Nicolas Fella's avatar
Nicolas Fella committed
42
43
include(KDEConnectMacros.cmake)

44
ecm_setup_version(${RELEASE_SERVICE_VERSION}
Nicolas Fella's avatar
Nicolas Fella committed
45
46
47
    VARIABLE_PREFIX KDECONNECT
    VERSION_HEADER ${CMAKE_CURRENT_BINARY_DIR}/kdeconnect-version.h
)
48

49
50
51
52
# Make the version header available by linking against kdeconnectversion
add_library(kdeconnectversion INTERFACE)
target_include_directories(kdeconnectversion INTERFACE ${CMAKE_CURRENT_BINARY_DIR})

53
if (SAILFISHOS)
54
    set(KF5_REQUIRED_COMPONENTS I18n CoreAddons Config)
55
    set(KF5_OPTIONAL_COMPONENTS)
56

57
58
    set(Qca_LIBRARY CONAN_PKG::Qca-qt5)

59
60
    add_definitions(-DSAILFISHOS)
else()
61
62
63
    find_package(Qca-qt5 ${QCA_MIN_VERSION} REQUIRED)
    set(Qca_LIBRARY qca-qt5)

64
    set(KF5_REQUIRED_COMPONENTS I18n ConfigWidgets DBusAddons IconThemes Notifications KIO KCMUtils Service Solid Kirigami2 People)
Albert Vaca Cintora's avatar
Albert Vaca Cintora committed
65
    set(KF5_OPTIONAL_COMPONENTS DocTools)
Nicolas Fella's avatar
Nicolas Fella committed
66
67

    set_package_properties(KF5Kirigami2 PROPERTIES
Nicolas Fella's avatar
Nicolas Fella committed
68
69
70
71
        DESCRIPTION "QtQuick plugins to build user interfaces based on KDE UX guidelines"
        PURPOSE "Required for KDE Connect's QML-based GUI applications"
        URL "https://www.kde.org/products/kirigami/"
        TYPE RUNTIME
Nicolas Fella's avatar
Nicolas Fella committed
72
73
    )

Weixuan Xiao's avatar
Weixuan Xiao committed
74
    if(UNIX AND NOT APPLE)
Nicolas Fella's avatar
Nicolas Fella committed
75
        find_package(KF5PulseAudioQt)
76
    endif()
Nicolas Fella's avatar
Nicolas Fella committed
77
78
79
80

    find_package(KF5PeopleVCard)
    set_package_properties(KF5PeopleVCard PROPERTIES
        PURPOSE "Read vcards from the file system"
81
        URL "https://invent.kde.org/pim/kpeoplevcard"
Nicolas Fella's avatar
Nicolas Fella committed
82
83
84
        TYPE RUNTIME
    )

85
    add_definitions(-DHAVE_KIO)
Nicolas Fella's avatar
Nicolas Fella committed
86

87
    #ecm_find_qmlmodule(org.kde.people 1.0) FIXME This results in KPeople code being called which triggers DBus calls which breaks the Windows CI
88
    ecm_find_qmlmodule(QtQuick.Particles 2.0)
Nicolas Fella's avatar
Nicolas Fella committed
89

90
endif()
Albert Vaca Cintora's avatar
Albert Vaca Cintora committed
91

92
93
add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_KEYWORDS -DQT_NO_CAST_FROM_ASCII)

94
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS DBus Quick QuickControls2 Network Multimedia)
95
96
97
if (UNIX AND NOT APPLE)
    find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS X11Extras)
endif()
98
99
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS ${KF5_REQUIRED_COMPONENTS})
if (KF5_OPTIONAL_COMPONENTS)
100
    find_package(KF5 ${KF5_MIN_VERSION} COMPONENTS ${KF5_OPTIONAL_COMPONENTS})
101
endif()
102

103
if (WIN32)
104
105
106
107
108
    get_filename_component(WINDOWS_KITS_DIR
        "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" ABSOLUTE)
    file(READ "${WINDOWS_KITS_DIR}/SDKManifest.xml" SDK_MANIFEST)
    string(REGEX MATCH "PlatformIdentity[^\n]*" PLATFORM_IDENTITY "${SDK_MANIFEST}" )
    string(REGEX MATCH "[0-9][0-9][0-9][0-9][0-9]" WIN_SDK_VERSION "${PLATFORM_IDENTITY}" )
109
110
111
    add_compile_definitions(WIN_SDK_VERSION=${WIN_SDK_VERSION})
endif()

Matthijs Tijink's avatar
Matthijs Tijink committed
112
if (NOT ZSH_AUTOCOMPLETE_DIR)
Heiko Becker's avatar
Heiko Becker committed
113
set(ZSH_AUTOCOMPLETE_DIR "${KDE_INSTALL_DATADIR}/zsh/site-functions")
Matthijs Tijink's avatar
Matthijs Tijink committed
114
115
endif()

Weixuan Xiao's avatar
Weixuan Xiao committed
116
117
118
119
option(PRIVATE_DBUS_ENABLED "Use private dbus session for kdeconnect" OFF)
if(PRIVATE_DBUS_ENABLED OR APPLE)
    add_compile_definitions(USE_PRIVATE_DBUS)
endif()
120

Nicolas Fella's avatar
Nicolas Fella committed
121
add_subdirectory(core)
122
123
add_subdirectory(plugins)
add_subdirectory(interfaces)
124
125

if (NOT SAILFISHOS)
126
127
128
129

    find_package(KF5QQC2DesktopStyle ${KF5_MIN_VERSION} REQUIRED)
    set_package_properties(KF5QQC2DesktopStyle PROPERTIES TYPE RUNTIME)

130
    add_subdirectory(icons)
131
132
133
134
    add_subdirectory(data)
    add_subdirectory(cli)
    add_subdirectory(declarativeplugin)

Nicolas Fella's avatar
Nicolas Fella committed
135
136
137
    add_subdirectory(kcm)
    add_subdirectory(kcmplugin)
    add_subdirectory(daemon)
Nicolas Fella's avatar
Nicolas Fella committed
138
    add_subdirectory(app)
139
140
141
    add_subdirectory(indicator)
    add_subdirectory(urlhandler)
    add_subdirectory(nautilus-extension)
142
    add_subdirectory(fileitemactionplugin)
Nicolas Fella's avatar
Nicolas Fella committed
143
    add_subdirectory(smsapp)
144
145
    add_subdirectory(settings)

Nicolas Fella's avatar
Nicolas Fella committed
146
147
148
149
    if(NOT WIN32)
        add_subdirectory(kio)
        add_subdirectory(plasmoid)
    endif()
150
endif()
151

152
153
154
if(KF5DocTools_FOUND)
    add_subdirectory(doc)
endif()
Nicolas Fella's avatar
Nicolas Fella committed
155

156
157
if(BUILD_TESTING)
    add_subdirectory(tests)
158
endif()
159

160
161
ecm_qt_install_logging_categories(EXPORT kdeconnect-kde FILE kdeconnect-kde.categories SORT DESTINATION "${KDE_INSTALL_LOGGINGCATEGORIESDIR}")

162
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)