CMakeLists.txt 4.3 KB
Newer Older
1
2
3
# SPDX-FileCopyrightText: 2018 Volker Krause <vkrause@kde.org>
# SPDX-License-Identifier: BSD-3-Clause

4
cmake_minimum_required(VERSION 3.0)
5
6

# KDE Application Version, managed by release script
7
set (RELEASE_SERVICE_VERSION_MAJOR "21")
8
set (RELEASE_SERVICE_VERSION_MINOR "07")
9
set (RELEASE_SERVICE_VERSION_MICRO "70")
10
11
set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
project(itinerary VERSION ${RELEASE_SERVICE_VERSION})
12

13
14
15
16
17
set(KF5_MIN_VERSION 5.64)
if (ANDROID)
    set(KF5_MIN_VERSION 5.76) # for FindGradle
endif()
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
18
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}/cmake)
19
20
21
if (POLICY CMP0071)
    cmake_policy(SET CMP0071 NEW)
endif()
22

23
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
24
25
include(ECMAddTests)
include(ECMGenerateHeaders)
26
include(ECMInstallIcons)
27
28
29
30
31
32
33
include(ECMQtDeclareLoggingCategory)
include(ECMSetupVersion)
include(FeatureSummary)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(GenerateExportHeader)

34
set(CMAKE_CXX_STANDARD 17)
35
36
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
37

38
ecm_setup_version(PROJECT VARIABLE_PREFIX ITINERARY VERSION_HEADER itinerary_version.h)
39
40
41
42
43
44
45
46
47
48
49
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
    find_package(Git)
    set_package_properties(Git PROPERTIES TYPE OPTIONAL PURPOSE "Determine exact build version.")
    if (GIT_FOUND)
        execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE _git_rev)
        string(REGEX REPLACE "\n" "" _git_rev "${_git_rev}")
        set(ITINERARY_DETAILED_VERSION_STRING "${ITINERARY_VERSION} (${_git_rev})")
    else ()
        set(ITINERARY_DETAILED_VERSION_STRING "${ITINERARY_VERSION}")
    endif()
endif()
50

51
set(QT_MIN_VERSION 5.15)
52
if (ANDROID)
53
    set(QT_MIN_VERSION 5.15.1) # for content: support
54
55
endif()

56
# build-time dependencies
57
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Test Quick Positioning Location QuickControls2)
Volker Krause's avatar
Volker Krause committed
58
find_package(Qt5 CONFIG QUIET OPTIONAL_COMPONENTS QuickCompiler)
59
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS I18n CoreAddons Contacts Notifications)
60
find_package(KF5 ${KF5_MIN_VERSION} OPTIONAL_COMPONENTS Holidays NetworkManagerQt)
Volker Krause's avatar
Volker Krause committed
61
find_package(KPimPkPass CONFIG REQUIRED)
62
find_package(KPimItinerary 5.17.41 CONFIG REQUIRED)
63
find_package(KPublicTransport CONFIG REQUIRED)
Volker Krause's avatar
Volker Krause committed
64
find_package(KOSMIndoorMap CONFIG REQUIRED)
65
find_package(SharedMimeInfo 1.0 REQUIRED)
66
67
find_package(ZLIB REQUIRED)
set_package_properties("ZLIB" PROPERTIES PURPOSE "Needed for retrieving weather forecast data.")
68
set_package_properties(KF5Solid PROPERTIES TYPE OPTIONAL TYPE RUNTIME PURPOSE "Used for controlling the screen brightness.")
69

70
include(ECMQMLModules)
71
72
ecm_find_qmlmodule(QtLocation 5.11)
ecm_find_qmlmodule(QtPositioning 5.11)
73
ecm_find_qmlmodule(org.kde.prison 1.0)
74
ecm_find_qmlmodule(org.kde.kosmindoormap 1.0)
75
ecm_find_qmlmodule(org.kde.kopeninghours 1.0)
76
77
78
if (NOT ANDROID)
    ecm_find_qmlmodule(Qt.labs.platform 1.0)
endif()
79

80
81
# runtime dependencies are build-time dependencies on Android
if (ANDROID)
Volker Krause's avatar
Volker Krause committed
82
    find_package(Qt5 REQUIRED COMPONENTS AndroidExtras Svg)
Nicolas Fella's avatar
Nicolas Fella committed
83
    find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Archive Kirigami2 Prison)
Volker Krause's avatar
Volker Krause committed
84
85
86
    if (NOT DEFINED BREEZEICONS_DIR AND EXISTS ${CMAKE_SOURCE_DIR}/../breeze-icons)
        set(BREEZEICONS_DIR ${CMAKE_SOURCE_DIR}/../breeze-icons)
    endif()
87
    find_package(OpenSSL REQUIRED)
88
    find_package(Gradle REQUIRED)
89
else()
Volker Krause's avatar
Volker Krause committed
90
    find_package(Qt5 REQUIRED COMPONENTS Widgets DBus)
Nicolas Fella's avatar
Nicolas Fella committed
91
    find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS DBusAddons)
Volker Krause's avatar
Volker Krause committed
92
    find_package(KF5 ${KF5_MIN_VERSION} COMPONENTS Solid Crash)
93
94
endif()

95
96
97
add_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_URL_CAST_FROM_STRING)
add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
add_definitions(-DQT_USE_QSTRINGBUILDER)
98
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00)
99
100
101
if (ANDROID)
    set(CMAKE_MODULE_EXE_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined ${CMAKE_EXE_LINKER_FLAGS}")
endif()
102

103
104
add_subdirectory(src)
add_subdirectory(autotests)
105
add_subdirectory(tests)
106

107
108
109
if (NOT ANDROID)
    install(FILES org_kde_itinerary.categories DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR})
endif()
110
ki18n_install(po)
111
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)