CMakeLists.txt 3.53 KB
Newer Older
Boudhayan Gupta's avatar
Boudhayan Gupta committed
1 2

# KDE Application Version, managed by release script
3
set(RELEASE_SERVICE_VERSION_MAJOR "20")
4
set(RELEASE_SERVICE_VERSION_MINOR "12")
5
set(RELEASE_SERVICE_VERSION_MICRO "3")
6 7
set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
set(SPECTACLE_VERSION ${RELEASE_SERVICE_VERSION})
Boudhayan Gupta's avatar
Initial  
Boudhayan Gupta committed
8 9
# minimum requirements

10
cmake_minimum_required (VERSION 3.5 FATAL_ERROR)
11 12
# Spectacle project
project(Spectacle VERSION ${SPECTACLE_VERSION})
Boudhayan Gupta's avatar
Boudhayan Gupta committed
13

Yuri Chornoivan's avatar
Yuri Chornoivan committed
14
set(QT_MIN_VERSION     "5.10.0")
15
set(KF5_MIN_VERSION    "5.73.0")
Boudhayan Gupta's avatar
Initial  
Boudhayan Gupta committed
16

17
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
Boudhayan Gupta's avatar
Initial  
Boudhayan Gupta committed
18 19 20 21 22 23 24
set(
    CMAKE_MODULE_PATH
        ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules
        ${CMAKE_MODULE_PATH}
        ${ECM_MODULE_PATH}
)

Boudhayan Gupta's avatar
Boudhayan Gupta committed
25
# require c++14
26

27
set(CMAKE_CXX_STANDARD 14)
28 29 30
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Boudhayan Gupta's avatar
Initial  
Boudhayan Gupta committed
31 32 33 34
# set up kf5

include(KDEInstallDirs)
include(KDECMakeSettings)
35
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
Boudhayan Gupta's avatar
Initial  
Boudhayan Gupta committed
36 37 38
include(ECMInstallIcons)
include(ECMSetupVersion)
include(FeatureSummary)
39
include(ECMQtDeclareLoggingCategory)
40
include(ECMAddTests)
Nate Graham's avatar
Nate Graham committed
41
include(ECMQueryQmake)
Boudhayan Gupta's avatar
Initial  
Boudhayan Gupta committed
42

43
add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_CAST_FROM_ASCII -DQT_NO_FOREACH)
44

45

Boudhayan Gupta's avatar
Initial  
Boudhayan Gupta committed
46 47 48 49 50
find_package(
    Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED
        Core
        Widgets
        DBus
Boudhayan Gupta's avatar
Boudhayan Gupta committed
51
        PrintSupport
52
        Svg
53
        Test
Boudhayan Gupta's avatar
Initial  
Boudhayan Gupta committed
54 55 56 57 58
)

find_package(
    KF5 ${KF5_MIN_VERSION} REQUIRED
        CoreAddons
59 60
        WidgetsAddons
        DBusAddons
61
        Notifications
Boudhayan Gupta's avatar
Initial  
Boudhayan Gupta committed
62 63 64 65
        Config
        I18n
        KIO
        WindowSystem
Boudhayan Gupta's avatar
Boudhayan Gupta committed
66
        DocTools
67
        NewStuff
David Redondo's avatar
David Redondo committed
68 69
        GlobalAccel
        XmlGui
70
        Wayland
Boudhayan Gupta's avatar
Initial  
Boudhayan Gupta committed
71 72 73 74
)

# optional components

75 76 77 78 79
find_package(KF5Kipi)
if (KF5Kipi_FOUND)
    set(KIPI_FOUND 1)
endif ()

80 81
find_package(KF5Purpose)
if (KF5Purpose_FOUND)
82 83 84
    set(PURPOSE_FOUND 1)
endif()

85
find_package(XCB COMPONENTS XFIXES IMAGE UTIL CURSOR)
86
set(XCB_COMPONENTS_ERRORS FALSE)
87
if (XCB_FOUND)
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
	find_package(Qt5X11Extras ${QT_MIN_VERSION} REQUIRED)
endif()
set(XCB_COMPONENTS_FOUND TRUE)
if(NOT XCB_XFIXES_FOUND)
	set(XCB_COMPONENTS_ERRORS "${XCB_COMPONENTS_ERRORS} XCB-XFIXES ")
	set(XCB_COMPONENTS_FOUND FALSE)
endif()
if(NOT XCB_IMAGE_FOUND)
	set(XCB_COMPONENTS_ERRORS "${XCB_COMPONENTS_ERRORS} XCB-IMAGE ")
	set(XCB_COMPONENTS_FOUND FALSE)
endif()
if(NOT XCB_UTIL_FOUND)
	set(XCB_COMPONENTS_ERRORS "${XCB_COMPONENTS_ERRORS} XCB-UTIL ")
	set(XCB_COMPONENTS_FOUND FALSE)
endif()
if(NOT XCB_CURSOR_FOUND)
	set(XCB_COMPONENTS_ERRORS "${XCB_COMPONENTS_ERRORS} XCB-CURSOR ")
	set(XCB_COMPONENTS_FOUND FALSE)
106
endif()
Boudhayan Gupta's avatar
Initial  
Boudhayan Gupta committed
107

108 109 110
find_package(kImageAnnotator)

if(kImageAnnotator_FOUND)
111
    find_package(X11 REQUIRED)
112
    find_package(kColorPicker REQUIRED)
113 114 115
    set(KIMAGEANNOTATOR_FOUND 1)
endif()

116
# fail build if none of the platform backends can be found
117
if (NOT XCB_FOUND OR NOT XCB_COMPONENTS_FOUND)
Yuri Chornoivan's avatar
Yuri Chornoivan committed
118
    message(FATAL_ERROR "No suitable backend platform was found. Currently supported platforms are: XCB Components Required: ${XCB_COMPONENTS_ERRORS}")
119 120
endif()

Nate Graham's avatar
Nate Graham committed
121 122 123
# locate qdbus in the Qt path because not every distro makes a symlink at /usr/bin/qdbus
query_qmake(QtBinariesDir QT_INSTALL_BINS)

Boudhayan Gupta's avatar
Initial  
Boudhayan Gupta committed
124 125 126
# hand off to subdirectories

add_subdirectory(src)
127
add_subdirectory(dbus)
128
add_subdirectory(desktop)
Boudhayan Gupta's avatar
Boudhayan Gupta committed
129
add_subdirectory(icons)
Boudhayan Gupta's avatar
Boudhayan Gupta committed
130
add_subdirectory(doc)
Boudhayan Gupta's avatar
Boudhayan Gupta committed
131
add_subdirectory(tests)
Boudhayan Gupta's avatar
Initial  
Boudhayan Gupta committed
132

133 134 135 136 137
if (${ECM_VERSION} STRGREATER "5.58.0")
    install(FILES spectacle.categories  DESTINATION  ${KDE_INSTALL_LOGGINGCATEGORIESDIR})
else()
    install(FILES spectacle.categories  DESTINATION ${KDE_INSTALL_CONFDIR})
endif()
Boudhayan Gupta's avatar
Initial  
Boudhayan Gupta committed
138 139 140
# summaries

feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)