CMakeLists.txt 2.42 KB
Newer Older
1
cmake_minimum_required(VERSION 3.8)
Carl Schwan's avatar
Carl Schwan committed
2

Carl Schwan's avatar
Carl Schwan committed
3
4
# KDE Application Version, managed by release script
set (RELEASE_SERVICE_VERSION_MAJOR "21")
5
set (RELEASE_SERVICE_VERSION_MINOR "11")
Carl Schwan's avatar
Carl Schwan committed
6
7
8
9
set (RELEASE_SERVICE_VERSION_MICRO "70")
set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")

project(kontrast VERSION ${RELEASE_SERVICE_VERSION})
Carl Schwan's avatar
Carl Schwan committed
10

11
12
13
set(QT_MIN_VERSION "5.14.0")
set(KF5_MIN_VERSION "5.70.0")

Carl Schwan's avatar
Carl Schwan committed
14
15
16
include(FeatureSummary)

################# set KDE specific information #################
17
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
Carl Schwan's avatar
Carl Schwan committed
18
19
20
21
22
23
24
25
26
27

# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})

include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMSetupVersion)
include(ECMGenerateHeaders)
include(ECMPoQmTools)
28
include(KDEClangFormat)
Nicolas Fella's avatar
Nicolas Fella committed
29
include(KDEGitCommitHooks)
Carl Schwan's avatar
Carl Schwan committed
30

Carl Schwan's avatar
Carl Schwan committed
31
32
33
ecm_setup_version(${PROJECT_VERSION}
    VARIABLE_PREFIX KONTRAST
    SOVERSION ${PROJECT_VERSION_MAJOR}
Carl Schwan's avatar
Carl Schwan committed
34
    VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/src/config-kontrast.h"
Carl Schwan's avatar
Carl Schwan committed
35
36
)

Carl Schwan's avatar
Carl Schwan committed
37
################# Find dependencies #################
38
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Core Gui Qml QuickControls2 Svg Sql DBus)
Nicolas Fella's avatar
Nicolas Fella committed
39
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Kirigami2 I18n CoreAddons)
Carl Schwan's avatar
Carl Schwan committed
40
41

################# build and install #################
42
43
44
45
46
add_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_URL_CAST_FROM_STRING)
add_definitions(-DQT_USE_QSTRINGBUILDER)
add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050d00)

47
48
add_subdirectory(src)

Carl Schwan's avatar
Carl Schwan committed
49
50
install(PROGRAMS org.kde.kontrast.desktop DESTINATION ${KDE_INSTALL_APPDIR})
install(FILES org.kde.kontrast.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
Carl Schwan's avatar
Carl Schwan committed
51
install(FILES org.kde.kontrast.svg DESTINATION ${KDE_INSTALL_FULL_ICONDIR}/hicolor/scalable/apps)
Carl Schwan's avatar
Carl Schwan committed
52
53

feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
54

Carl Schwan's avatar
Carl Schwan committed
55
56
57
58
59
60
61
62
63
64
65
66
67
if(ANDROID)
    kirigami_package_breeze_icons(ICONS
        go-home
        favorite
        help-symbolic
        help-about-symbolic
        applications-graphics
        color-picker
        reverse
        randomize
    )
endif()

68
69
70
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES src/*.cpp src/*.h)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
        
Nicolas Fella's avatar
Nicolas Fella committed
71
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)