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

0001 cmake_minimum_required(VERSION 3.16)
0002 
0003 project(plasma-browser-integration)
0004 set(PROJECT_VERSION "6.0.0")
0005 set(PROJECT_VERSION_MAJOR 6)
0006 
0007 set(PROJECT_DEP_VERSION "5.93.0")
0008 set(QT_MIN_VERSION "6.6.0")
0009 set(KF6_MIN_VERSION "5.240.0")
0010 
0011 set(CMAKE_CXX_STANDARD 20)
0012 set(CMAKE_CXX_STANDARD_REQUIRED ON)
0013 
0014 find_package(ECM ${KF6_MIN_VERSION} REQUIRED NO_MODULE)
0015 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} )
0016 
0017 include(KDEInstallDirs)
0018 include(KDECMakeSettings)
0019 include(KDECompilerSettings NO_POLICY_SCOPE)
0020 include(FeatureSummary)
0021 include(KDEClangFormat)
0022 include(KDEGitCommitHooks)
0023 include(ECMDeprecationSettings)
0024 
0025 find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
0026 Gui
0027 DBus
0028 Widgets
0029 )
0030 
0031 find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS
0032     KIO
0033     I18n
0034     CoreAddons
0035     Config
0036     Crash
0037     DBusAddons
0038     Notifications
0039     Runner
0040     Purpose
0041     FileMetaData
0042     JobWidgets
0043     Service
0044     StatusNotifierItem
0045 )
0046 
0047 find_package(PlasmaActivities ${PROJECT_DEP_VERSION} CONFIG REQUIRED)
0048 find_package(LibTaskManager ${PROJECT_DEP_VERSION} CONFIG REQUIRED)
0049 
0050 add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
0051 ecm_set_disabled_deprecation_versions(QT 5.15.2
0052     KF 5.101
0053 )
0054 
0055 # Options
0056 option(INSTALL_CHROME_MANIFEST "Whether to install a configuration file that makes Chrome automatically download the extension from the store" FALSE)
0057 add_feature_info(INSTALL_CHROME_MANIFEST ${INSTALL_CHROME_MANIFEST} "Install extension from Chrome store automatically")
0058 
0059 # in ubuntu and derivatives, this should be installed in the chromium-browser/extensions,
0060 # but since this is distribution specific path, let's use what upstream uses
0061 # ideally ubuntu and derivatives should patch this in their packaging
0062 set(CHROMIUM_EXTENSIONS_DIR "chromium" CACHE STRING "Directory name to install Chromium extensions into")
0063 add_feature_info(CHROMIUM_EXTENSIONS_DIR On "Directory name to install Chromium extensions into is '${CHROMIUM_EXTENSIONS_DIR}'")
0064 
0065 option(COPY_MESSAGING_HOST_FILE_HOME "Copy the native messaging hosts json file to user home dir" FALSE)
0066 add_feature_info(COPY_MESSAGING_HOST_FILE_HOME ${COPY_MESSAGING_HOST_FILE_HOME} "Enable this option to copy the native messaging hosts json file to home dir if you install plasma-browser-integration to custom prefix (non-/usr)")
0067 
0068 set(MOZILLA_DIR "${CMAKE_INSTALL_PREFIX}/lib/mozilla" CACHE STRING "Mozilla directory")
0069 add_feature_info(MOZILLA_DIR On "Mozilla directory is '${MOZILLA_DIR}'")
0070 
0071 add_subdirectory(host)
0072 add_subdirectory(reminder)
0073 
0074 if(NOT DEFINED CHROME_EXTENSION_ID)
0075     # The extension ID is based on the key used to sign the extension
0076     # see https://stackoverflow.com/questions/23873623/obtaining-chrome-extension-id-for-development
0077     set(CHROME_EXTENSION_ID "cimiefiiaegbelhefglklhhakcgmhkai")
0078 endif()
0079 
0080 if(NOT DEFINED EDGE_EXTENSION_ID)
0081     set(EDGE_EXTENSION_ID "dnnckbejblnejeabhcmhklcaljjpdjeh")
0082 endif()
0083 
0084 # TODO configure manifest.json
0085 
0086 configure_file(org.kde.plasma.chrome_integration.json.in org.kde.plasma.chrome_integration.json @ONLY)
0087 configure_file(org.kde.plasma.firefox_integration.json.in org.kde.plasma.firefox_integration.json @ONLY)
0088 
0089 # #chromium
0090 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasma.chrome_integration.json DESTINATION ${KDE_INSTALL_FULL_SYSCONFDIR}/chromium/native-messaging-hosts/ RENAME org.kde.plasma.browser_integration.json)
0091 # #google-chrome
0092 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasma.chrome_integration.json DESTINATION ${KDE_INSTALL_FULL_SYSCONFDIR}/opt/chrome/native-messaging-hosts/ RENAME org.kde.plasma.browser_integration.json)
0093 # Microsoft Edge
0094 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasma.chrome_integration.json DESTINATION ${KDE_INSTALL_FULL_SYSCONFDIR}/opt/edge/native-messaging-hosts/ RENAME org.kde.plasma.browser_integration.json)
0095 # firefox
0096 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasma.firefox_integration.json DESTINATION ${MOZILLA_DIR}/native-messaging-hosts/ RENAME org.kde.plasma.browser_integration.json)
0097 
0098 if (COPY_MESSAGING_HOST_FILE_HOME)
0099     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasma.firefox_integration.json DESTINATION $ENV{HOME}/.mozilla/native-messaging-hosts/ RENAME org.kde.plasma.browser_integration.json)
0100     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasma.chrome_integration.json DESTINATION $ENV{HOME}/.config/chromium/NativeMessagingHosts/ RENAME org.kde.plasma.browser_integration.json)
0101     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasma.chrome_integration.json DESTINATION $ENV{HOME}/.config/google-chrome/NativeMessagingHosts/ RENAME org.kde.plasma.browser_integration.json)
0102     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.plasma.chrome_integration.json DESTINATION $ENV{HOME}/.config/microsoft-edge/NativeMessagingHosts/ RENAME org.kde.plasma.browser_integration.json)
0103 endif()
0104 
0105 if (INSTALL_CHROME_MANIFEST) # Install a policy to have browsers automatically add the extension
0106     # google-chrome
0107     install(FILES chrome_install_from_store_policy DESTINATION ${KDE_INSTALL_DATADIR}/google-chrome/extensions RENAME ${CHROME_EXTENSION_ID}.json)
0108     # chromium
0109     install(FILES chrome_install_from_store_policy DESTINATION ${KDE_INSTALL_DATADIR}/${CHROMIUM_EXTENSIONS_DIR}/extensions RENAME ${CHROME_EXTENSION_ID}.json)
0110 endif()
0111 
0112 # TODO firefox
0113 
0114 # add clang-format target for all our real source files
0115 file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
0116 kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
0117 kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
0118 
0119 ki18n_install(po)
0120 
0121 feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)