CMakeLists.txt 3.82 KB
Newer Older
1
cmake_minimum_required(VERSION 3.5)
2
set(PROJECT_VERSION "5.19.90")
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
3
set(PROJECT_VERSION_MAJOR 5)
Martin Flöser's avatar
Martin Flöser committed
4

5
set(QT_MIN_VERSION "5.15.0")
6
set(KF5_MIN_VERSION "5.74")
7
set(WAYLAND_MIN_VERSION "1.15")
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
8
9

project(KWaylandServer VERSION ${PROJECT_VERSION})
Martin Flöser's avatar
Martin Flöser committed
10

Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
11
12
13
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

Martin Flöser's avatar
Martin Flöser committed
14
# ECM setup
15
include(FeatureSummary)
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
16
find_package(ECM ${KF5_MIN_VERSION} NO_MODULE REQUIRED)
17
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
Martin Flöser's avatar
Martin Flöser committed
18

Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
19
20
21
include(CheckIncludeFile)
include(CMakeFindFrameworks)
include(CMakePackageConfigHelpers)
Martin Flöser's avatar
Martin Flöser committed
22
include(FeatureSummary)
23
include(ECMGenerateExportHeader)
Martin Flöser's avatar
Martin Flöser committed
24
25
include(ECMSetupVersion)
include(ECMGenerateHeaders)
26
include(ECMQtDeclareLoggingCategory)
Martin Flöser's avatar
Martin Flöser committed
27
include(ECMPoQmTools)
28
include(ECMAddQch)
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
29
30
31
include(KDEInstallDirs)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(KDECMakeSettings)
Martin Flöser's avatar
Martin Flöser committed
32

33
34
option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF)
add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)")
Martin Flöser's avatar
Martin Flöser committed
35

Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
36
37
38
ecm_setup_version(PROJECT VARIABLE_PREFIX KWAYLANDSERVER
                        VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kwaylandserver_version.h"
                        PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KWaylandServerConfigVersion.cmake"
Martin Flöser's avatar
Martin Flöser committed
39
40
41
                        SOVERSION 5)

# Dependencies
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
42
43
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Concurrent Gui WaylandClient)
find_package(KF5Wayland ${KF5_MIN_VERSION} CONFIG REQUIRED)
44
find_package(PlasmaWaylandProtocols CONFIG REQUIRED)
45
46

find_package(QtWaylandScanner REQUIRED)
Martin Flöser's avatar
Martin Flöser committed
47

48
find_package(Wayland ${WAYLAND_MIN_VERSION} COMPONENTS Client Server)
Martin Flöser's avatar
Martin Flöser committed
49
50
51
52
set_package_properties(Wayland PROPERTIES
                       TYPE REQUIRED
                      )

53
find_package(WaylandScanner)
Martin Flöser's avatar
Martin Flöser committed
54

55
find_package(WaylandProtocols 1.18)
Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
56
57
set_package_properties(WaylandProtocols PROPERTIES TYPE REQUIRED)

58
59
60
find_package(EGL)
set_package_properties(EGL PROPERTIES TYPE REQUIRED)

61
check_include_file("linux/input.h" HAVE_LINUX_INPUT_H)
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
62
configure_file(config-kwaylandserver.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kwaylandserver.h)
63
include_directories(${CMAKE_CURRENT_BINARY_DIR})
Martin Flöser's avatar
Martin Flöser committed
64
65
66
67

# adjusting CMAKE_C_FLAGS to get wayland protocols to compile
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu90")

68
add_definitions(-DQT_NO_FOREACH)
69
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050d00)
Martin Flöser's avatar
Martin Flöser committed
70
71
72
73
# Subdirectories
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po")
    ecm_install_po_files_as_qm(po)
endif()
74

Martin Flöser's avatar
Martin Flöser committed
75
add_subdirectory(src)
Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
76
77
78
79
80

if (BUILD_TESTING)
    add_subdirectory(autotests)
    add_subdirectory(tests)
endif()
Martin Flöser's avatar
Martin Flöser committed
81
82

# create a Config.cmake and a ConfigVersion.cmake file and install them
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
83
set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KWaylandServer")
Martin Flöser's avatar
Martin Flöser committed
84

85
86
if (BUILD_QCH)
    ecm_install_qch_export(
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
87
88
        TARGETS KWaylandServer_QCH
        FILE KWaylandServerQchTargets.cmake
89
90
91
        DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
        COMPONENT Devel
    )
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
92
    set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KWaylandServerQchTargets.cmake\")")
93
94
endif()

Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
95
96
configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KWaylandServerConfig.cmake.in"
                              "${CMAKE_CURRENT_BINARY_DIR}/KWaylandServerConfig.cmake"
Martin Flöser's avatar
Martin Flöser committed
97
98
99
                              INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
                              )

Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
100
101
install(FILES  "${CMAKE_CURRENT_BINARY_DIR}/KWaylandServerConfig.cmake"
               "${CMAKE_CURRENT_BINARY_DIR}/KWaylandServerConfigVersion.cmake"
Martin Flöser's avatar
Martin Flöser committed
102
103
104
        DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
        COMPONENT Devel )

Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
105
install(EXPORT KWaylandServerTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KWaylandServerTargets.cmake NAMESPACE Plasma:: )
Martin Flöser's avatar
Martin Flöser committed
106
107


Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
108
109
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kwaylandserver_version.h
        DESTINATION ${KDE_INSTALL_INCLUDEDIR} COMPONENT Devel )
Martin Flöser's avatar
Martin Flöser committed
110
111

feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)