Warning, /frameworks/kirigami/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 cmake_minimum_required(VERSION 3.16) 0002 0003 set(KF_VERSION "6.0.0") # handled by release scripts 0004 set(KF_DEP_VERSION "5.249.0") # handled by release scripts 0005 0006 project(kirigami2 VERSION ${KF_VERSION}) 0007 0008 set(REQUIRED_QT_VERSION 6.5.0) 0009 0010 ################# Disallow in-source build ################# 0011 0012 if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") 0013 message(FATAL_ERROR "kirigami requires an out of source build. Please create a separate build directory and run 'cmake path_to_kirigami [options]' there.") 0014 endif() 0015 0016 option(BUILD_SHARED_LIBS "Build a shared module" ON) 0017 option(DESKTOP_ENABLED "Build and install The Desktop style" ON) 0018 option(BUILD_EXAMPLES "Build and install examples" OFF) 0019 option(DISABLE_DBUS "Build without D-Bus support" OFF) 0020 option(UBUNTU_TOUCH "Build for Ubuntu Touch" OFF) 0021 if(DEFINED STATIC_LIBRARY) 0022 message(FATAL_ERROR "Use the BUILD_SHARED_LIBS=OFF option to build a static library, STATIC_LIBRARY is no longer a supported option") 0023 endif() 0024 find_package(ECM 5.249.0 NO_MODULE) 0025 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH}) 0026 0027 if (NOT ${BUILD_SHARED_LIBS}) 0028 # Examples are not supported when building a static library, so force them 0029 # to OFF. 0030 set(BUILD_EXAMPLES OFF) 0031 endif() 0032 0033 # Make CPack available to easy generate binary packages 0034 include(CPack) 0035 include(FeatureSummary) 0036 include(KDEInstallDirs) 0037 find_package(Qt6 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Gui Svg QuickControls2 Concurrent ShaderTools) 0038 if (BUILD_TESTING) 0039 find_package(Qt6QuickTest ${REQUIRED_QT_VERSION} CONFIG QUIET) 0040 endif() 0041 get_target_property(QtGui_Enabled_Features Qt6::Gui QT_ENABLED_PUBLIC_FEATURES) 0042 if(QtGui_Enabled_Features MATCHES "opengl") 0043 set(HAVE_QTGUI_OPENGL 1) 0044 else() 0045 set(HAVE_QTGUI_OPENGL 0) 0046 endif() 0047 add_feature_info(QtGuiOpenGL HAVE_QTGUI_OPENGL "QtGui built with support for OpenGL") 0048 set(CMAKE_AUTOMOC ON) 0049 set(AUTOMOC_MOC_OPTIONS -Muri=org.kde.kirigami) 0050 set(CMAKE_INCLUDE_CURRENT_DIR ON) 0051 0052 if(NOT BUILD_SHARED_LIBS) 0053 add_definitions(-DKIRIGAMI_BUILD_TYPE_STATIC) 0054 add_definitions(-DQT_PLUGIN) 0055 add_definitions(-DQT_STATICPLUGIN=1) 0056 endif() 0057 0058 ################# set KDE specific information ################# 0059 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked 0060 set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules") 0061 0062 include(ECMGenerateExportHeader) 0063 include(ECMSetupVersion) 0064 include(ECMGenerateHeaders) 0065 include(CMakePackageConfigHelpers) 0066 include(ECMPoQmTools) 0067 include(ECMFindQmlModule) 0068 include(KDEInstallDirs) 0069 include(KDECMakeSettings) 0070 include(KDEGitCommitHooks) 0071 include(ECMQtDeclareLoggingCategory) 0072 include(ECMAddQch) 0073 include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) 0074 include(KDEPackageAppTemplates) 0075 include(ECMQmlModule) 0076 include(ECMDeprecationSettings) 0077 0078 set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF6Kirigami") 0079 0080 option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF) 0081 add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)") 0082 0083 configure_package_config_file( 0084 "KF6KirigamiConfig.cmake.in" 0085 "KF6KirigamiConfig.cmake" 0086 INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} 0087 PATH_VARS CMAKE_INSTALL_PREFIX 0088 ) 0089 0090 ecm_setup_version(PROJECT 0091 VARIABLE_PREFIX KIRIGAMI 0092 VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kirigami_version.h" 0093 PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF6KirigamiConfigVersion.cmake" 0094 SOVERSION 6 0095 ) 0096 0097 ecm_setup_version(PROJECT 0098 VARIABLE_PREFIX KIRIGAMI 0099 PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF6Kirigami2ConfigVersion.cmake" 0100 SOVERSION 6 0101 ) 0102 0103 install(FILES 0104 "${CMAKE_CURRENT_BINARY_DIR}/KF6KirigamiConfig.cmake" 0105 "${CMAKE_CURRENT_BINARY_DIR}/KF6KirigamiConfigVersion.cmake" 0106 "${CMAKE_CURRENT_SOURCE_DIR}/KF6KirigamiMacros.cmake" 0107 DESTINATION "${CMAKECONFIG_INSTALL_DIR}" 0108 COMPONENT Devel 0109 ) 0110 0111 configure_package_config_file( 0112 "KF6Kirigami2Config.cmake.in" 0113 "KF6Kirigami2Config.cmake" 0114 INSTALL_DESTINATION "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF6Kirigami2" 0115 PATH_VARS CMAKE_INSTALL_PREFIX 0116 ) 0117 0118 install( 0119 FILES ${CMAKE_CURRENT_BINARY_DIR}/KF6Kirigami2Config.cmake 0120 "${CMAKE_CURRENT_BINARY_DIR}/KF6Kirigami2ConfigVersion.cmake" 0121 DESTINATION ${KDE_INSTALL_CMAKEPACKAGEDIR}/KF6Kirigami2 0122 COMPONENT Devel 0123 ) 0124 0125 #use dbus on linux, bsd etc, but not android and apple stuff 0126 if (UNIX AND NOT ANDROID AND NOT(APPLE) AND NOT(DISABLE_DBUS)) 0127 find_package(Qt6DBus) 0128 add_definitions(-DKIRIGAMI_ENABLE_DBUS) 0129 endif() 0130 0131 find_package(OpenMP) 0132 set_package_properties(OpenMP 0133 PROPERTIES DESCRIPTION "Multi-platform shared-memory parallel programming in C/C++ and Fortran" 0134 TYPE OPTIONAL 0135 PURPOSE "Accelerates palette generation in Kirigami.ImageColors" 0136 ) 0137 if(OpenMP_CXX_FOUND) 0138 set(HAVE_OpenMP TRUE) 0139 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 0140 endif() 0141 0142 include_directories("${CMAKE_CURRENT_BINARY_DIR}") 0143 configure_file(config-OpenMP.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-OpenMP.h) 0144 0145 if (UBUNTU_TOUCH) 0146 add_definitions(-DUBUNTU_TOUCH) 0147 endif() 0148 0149 ecm_set_disabled_deprecation_versions( 0150 QT 5.15.2 0151 KF 5.95 0152 ) 0153 0154 if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") 0155 # link time optimization has been observed to break colors. Force-disable it. 0156 # Before undoing this make double sure the lockscreen 0157 # and logout screen are correctly colored in light/dark mode! 0158 add_compile_options("-fno-lto") 0159 endif() 0160 0161 add_subdirectory(src) 0162 if (NOT ANDROID) 0163 add_subdirectory(templates) 0164 endif() 0165 0166 if (BUILD_EXAMPLES) 0167 add_subdirectory(examples) 0168 endif() 0169 0170 if (BUILD_TESTING) 0171 add_subdirectory(autotests) 0172 endif() 0173 0174 ecm_install_po_files_as_qm(poqm) 0175 0176 include(ECMFeatureSummary) 0177 ecm_feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) 0178 0179 kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)