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(KF_VERSION "5.116.0") # handled by release scripts 0004 project(KWayland VERSION ${KF_VERSION}) 0005 0006 # ECM setup 0007 include(FeatureSummary) 0008 find_package(ECM 5.115.0 NO_MODULE) 0009 set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules") 0010 feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) 0011 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/Modules) 0012 0013 include(KDEInstallDirs) 0014 include(KDECMakeSettings) 0015 include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) 0016 0017 include(KDEGitCommitHooks) 0018 include(ECMGenerateExportHeader) 0019 include(ECMSetupVersion) 0020 include(ECMGenerateHeaders) 0021 include(ECMGeneratePkgConfigFile) 0022 include(ECMQtDeclareLoggingCategory) 0023 include(ECMDeprecationSettings) 0024 include(ECMPoQmTools) 0025 include(ECMAddQch) 0026 include(CMakeFindFrameworks) 0027 include(CMakePackageConfigHelpers) 0028 include(CheckIncludeFile) 0029 0030 set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control how much of deprecated API is built [default=0].") 0031 0032 option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF) 0033 add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)") 0034 0035 ecm_setup_version(PROJECT VARIABLE_PREFIX KWAYLAND 0036 VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kwayland_version.h" 0037 PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5WaylandConfigVersion.cmake" 0038 SOVERSION 5) 0039 0040 # Dependencies 0041 set(REQUIRED_QT_VERSION 5.15.2) 0042 find_package(Qt${QT_MAJOR_VERSION}Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS Private) 0043 find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} CONFIG REQUIRED Concurrent) 0044 find_package(Qt${QT_MAJOR_VERSION}WaylandClient ${REQUIRED_QT_VERSION} CONFIG REQUIRED NO_MODULE COMPONENTS Private) 0045 0046 # With Qt6 use qt_generate_wayland_protocol_client_sources instead of 0047 # ecm_add_qtwayland_client_protocol (from ECM's QtWaylandScanner) 0048 if (QT_MAJOR_VERSION STREQUAL "5") 0049 find_package(QtWaylandScanner REQUIRED) 0050 find_package(Qt5XkbCommonSupport REQUIRED) # Needed by Qt5::WaylandClientPrivate 0051 find_package(PkgConfig REQUIRED) 0052 pkg_check_modules(XKBCommon REQUIRED IMPORTED_TARGET xkbcommon) 0053 endif() 0054 0055 find_package(Wayland 1.15 COMPONENTS Client Server) 0056 set_package_properties(Wayland PROPERTIES 0057 TYPE REQUIRED 0058 ) 0059 0060 find_package(WaylandScanner) 0061 0062 find_package(WaylandProtocols 1.15) 0063 set_package_properties(WaylandProtocols PROPERTIES TYPE REQUIRED) 0064 0065 find_package(EGL) 0066 set_package_properties(EGL PROPERTIES TYPE REQUIRED) 0067 0068 find_package(PlasmaWaylandProtocols 1.9.0 CONFIG) 0069 set_package_properties(PlasmaWaylandProtocols PROPERTIES TYPE REQUIRED) 0070 0071 # adjusting CMAKE_C_FLAGS to get wayland protocols to compile 0072 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu90") 0073 0074 ecm_set_disabled_deprecation_versions( 0075 QT 5.15.2 0076 ) 0077 0078 check_cxx_source_compiles(" 0079 #include <fcntl.h> 0080 #include <sys/mman.h> 0081 #include <unistd.h> 0082 0083 int main() { 0084 const int size = 10; 0085 int fd = memfd_create(\"test\", MFD_CLOEXEC | MFD_ALLOW_SEALING); 0086 ftruncate(fd, size); 0087 fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL); 0088 mmap(nullptr, size, PROT_WRITE, MAP_SHARED, fd, 0); 0089 return 0; 0090 }" HAVE_MEMFD) 0091 0092 # Subdirectories 0093 ecm_install_po_files_as_qm(po) 0094 0095 add_subdirectory(src) 0096 0097 if (BUILD_TESTING) 0098 add_subdirectory(autotests) 0099 add_subdirectory(tests) 0100 endif() 0101 0102 # create a Config.cmake and a ConfigVersion.cmake file and install them 0103 set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5Wayland") 0104 0105 if (BUILD_QCH) 0106 ecm_install_qch_export( 0107 TARGETS KF5Wayland_QCH 0108 FILE KF5WaylandQchTargets.cmake 0109 DESTINATION "${CMAKECONFIG_INSTALL_DIR}" 0110 COMPONENT Devel 0111 ) 0112 set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KF5WaylandQchTargets.cmake\")") 0113 endif() 0114 0115 configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KF5WaylandConfig.cmake.in" 0116 "${CMAKE_CURRENT_BINARY_DIR}/KF5WaylandConfig.cmake" 0117 INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} 0118 ) 0119 0120 install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KF5WaylandConfig.cmake" 0121 "${CMAKE_CURRENT_BINARY_DIR}/KF5WaylandConfigVersion.cmake" 0122 DESTINATION "${CMAKECONFIG_INSTALL_DIR}" 0123 COMPONENT Devel ) 0124 0125 install(EXPORT KF5WaylandTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5WaylandTargets.cmake NAMESPACE KF5:: ) 0126 0127 0128 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kwayland_version.h 0129 DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/KWayland COMPONENT Devel) 0130 0131 if (NOT WIN32) 0132 ecm_generate_pkgconfig_file(BASE_NAME KF5WaylandClient 0133 INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF}/KWayland 0134 DEPS Qt${QT_MAJOR_VERSION}Gui 0135 INSTALL) 0136 endif() 0137 0138 feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) 0139 0140 kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)