Warning, /plasma/kwayland/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 cmake_minimum_required(VERSION 3.16)
0002 
0003 set(PROJECT_VERSION "6.0.80")
0004 project(kwayland VERSION ${PROJECT_VERSION})
0005 
0006 set(QT_MIN_VERSION "6.6.0")
0007 set(KF6_MIN_VERSION "5.240.0")
0008 
0009 set(CMAKE_CXX_STANDARD 20)
0010 set(CMAKE_CXX_STANDARD_REQUIRED ON)
0011 
0012 find_package(ECM ${KF6_MIN_VERSION} REQUIRED NO_MODULE)
0013 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
0014 
0015 include(FeatureSummary)
0016 include(KDEInstallDirs)
0017 include(KDECMakeSettings)
0018 include(KDECompilerSettings NO_POLICY_SCOPE)
0019 
0020 include(KDEGitCommitHooks)
0021 include(ECMGenerateExportHeader)
0022 include(ECMSetupVersion)
0023 include(ECMGenerateHeaders)
0024 include(ECMGeneratePkgConfigFile)
0025 include(ECMQtDeclareLoggingCategory)
0026 include(ECMDeprecationSettings)
0027 include(ECMPoQmTools)
0028 include(ECMAddQch)
0029 include(CMakeFindFrameworks)
0030 include(CMakePackageConfigHelpers)
0031 include(CheckIncludeFile)
0032 
0033 set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control how much of deprecated API is built [default=0].")
0034 
0035 option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF)
0036 add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)")
0037 
0038 set(kwayland_version_header "${CMAKE_CURRENT_BINARY_DIR}/src/client/kwayland_version.h")
0039 ecm_setup_version(PROJECT VARIABLE_PREFIX KWAYLAND
0040                         VERSION_HEADER "${kwayland_version_header}"
0041                         PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KWaylandConfigVersion.cmake"
0042                         SOVERSION 6)
0043 
0044 # Dependencies
0045 find_package(Qt6Gui ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Private)
0046 find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED Concurrent)
0047 find_package(Qt6WaylandClient ${QT_MIN_VERSION} CONFIG REQUIRED NO_MODULE COMPONENTS Private)
0048 
0049 find_package(Wayland 1.15 COMPONENTS Client)
0050 set_package_properties(Wayland PROPERTIES
0051                        TYPE REQUIRED
0052                       )
0053 
0054 find_package(WaylandScanner)
0055 
0056 find_package(WaylandProtocols 1.15)
0057 set_package_properties(WaylandProtocols PROPERTIES TYPE REQUIRED)
0058 
0059 find_package(EGL)
0060 set_package_properties(EGL PROPERTIES TYPE REQUIRED)
0061 
0062 find_package(PlasmaWaylandProtocols 1.9.0 CONFIG)
0063 set_package_properties(PlasmaWaylandProtocols PROPERTIES TYPE REQUIRED)
0064 
0065 # adjusting CMAKE_C_FLAGS to get wayland protocols to compile
0066 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu90")
0067 
0068 ecm_set_disabled_deprecation_versions(
0069     QT 6.4.0
0070 )
0071 
0072 check_cxx_source_compiles("
0073 #include <fcntl.h>
0074 #include <sys/mman.h>
0075 #include <unistd.h>
0076 
0077 int main() {
0078     const int size = 10;
0079     int fd = memfd_create(\"test\", MFD_CLOEXEC | MFD_ALLOW_SEALING);
0080     ftruncate(fd, size);
0081     fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL);
0082     mmap(nullptr, size, PROT_WRITE, MAP_SHARED, fd, 0);
0083     return 0;
0084 }" HAVE_MEMFD)
0085 
0086 # Subdirectories
0087 ecm_install_po_files_as_qm(po)
0088 
0089 add_subdirectory(src)
0090 
0091 if (BUILD_TESTING)
0092     add_subdirectory(tests)
0093 endif()
0094 
0095 # create a Config.cmake and a ConfigVersion.cmake file and install them
0096 set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KWayland")
0097 
0098 if (BUILD_QCH)
0099     ecm_install_qch_export(
0100         TARGETS KWayland_QCH
0101         FILE KWaylandQchTargets.cmake
0102         DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0103         COMPONENT Devel
0104     )
0105     set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KWaylandQchTargets.cmake\")")
0106 endif()
0107 
0108 configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KWaylandConfig.cmake.in"
0109                               "${CMAKE_CURRENT_BINARY_DIR}/KWaylandConfig.cmake"
0110                               INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
0111                               )
0112 
0113 install(FILES  "${CMAKE_CURRENT_BINARY_DIR}/KWaylandConfig.cmake"
0114                "${CMAKE_CURRENT_BINARY_DIR}/KWaylandConfigVersion.cmake"
0115         DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0116         COMPONENT Devel )
0117 
0118 install(EXPORT KWaylandTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KWaylandTargets.cmake NAMESPACE Plasma::)
0119 
0120 
0121 install(FILES ${kwayland_version_header}
0122         DESTINATION ${KDE_INSTALL_INCLUDEDIR}/KWayland COMPONENT Devel)
0123 
0124 if (NOT WIN32)
0125     ecm_generate_pkgconfig_file(BASE_NAME KWaylandClient
0126       INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR}/KWayland
0127       DEPS Qt6Gui
0128     INSTALL)
0129 endif()
0130 
0131 include(ECMFeatureSummary)
0132 ecm_feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
0133 
0134 kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)