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