2017-09-09 20:20:57 +02:00
|
|
|
# CMake version required. This must be the very first line, because it sets default policies affecting everything else
|
2022-01-18 16:38:13 +01:00
|
|
|
cmake_minimum_required(VERSION 3.18)
|
2017-09-09 20:20:57 +02:00
|
|
|
|
2022-02-14 13:29:56 +01:00
|
|
|
# KDE Gear Version, managed by release script
|
2022-11-05 21:58:16 +01:00
|
|
|
set(RELEASE_SERVICE_VERSION_MAJOR "23")
|
2023-04-12 17:54:36 +02:00
|
|
|
set(RELEASE_SERVICE_VERSION_MINOR "04")
|
2023-06-30 00:03:38 +02:00
|
|
|
set(RELEASE_SERVICE_VERSION_MICRO "3")
|
2022-02-14 13:29:31 +01:00
|
|
|
set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
|
|
|
|
|
2017-09-09 20:20:57 +02:00
|
|
|
# Project name and version
|
2022-02-14 13:29:31 +01:00
|
|
|
project(Falkon VERSION ${RELEASE_SERVICE_VERSION})
|
2017-09-09 20:20:57 +02:00
|
|
|
|
|
|
|
# Find ECM, with nice error handling in case of failure
|
|
|
|
include(FeatureSummary)
|
2022-01-18 16:38:13 +01:00
|
|
|
find_package(ECM 5.78.0 CONFIG)
|
|
|
|
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://invent.kde.org/frameworks/extra-cmake-modules")
|
2017-09-09 20:20:57 +02:00
|
|
|
feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
2022-09-05 18:25:42 +02:00
|
|
|
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
2017-09-09 20:20:57 +02:00
|
|
|
|
|
|
|
# Many includes from ECM, to get all the nice cmake functions and settings
|
|
|
|
include(KDEInstallDirs)
|
|
|
|
include(KDECMakeSettings)
|
|
|
|
include(KDECompilerSettings NO_POLICY_SCOPE)
|
|
|
|
include(ECMInstallIcons)
|
|
|
|
include(ECMSetupVersion)
|
|
|
|
include(ECMAddAppIcon)
|
|
|
|
include(ECMQtDeclareLoggingCategory)
|
2018-02-24 15:19:56 +01:00
|
|
|
include(ECMPoQmTools)
|
2017-09-09 20:20:57 +02:00
|
|
|
|
|
|
|
# Output dirs (like ECM 5.38 does)
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
|
|
|
|
2017-10-27 14:08:49 +02:00
|
|
|
if (UNIX AND NOT APPLE)
|
|
|
|
set(FALKON_INSTALL_PLUGINDIR "${KDE_INSTALL_PLUGINDIR}/falkon")
|
|
|
|
else()
|
|
|
|
set(FALKON_INSTALL_PLUGINDIR "${KDE_INSTALL_PLUGINDIR}")
|
|
|
|
endif()
|
2017-10-27 15:14:31 +02:00
|
|
|
if (IS_ABSOLUTE ${FALKON_INSTALL_PLUGINDIR})
|
2018-02-11 09:03:46 +01:00
|
|
|
set(PLUGIN_PATH "${FALKON_INSTALL_PLUGINDIR}")
|
2017-10-27 15:14:31 +02:00
|
|
|
else()
|
2018-02-11 09:03:46 +01:00
|
|
|
set(PLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/${FALKON_INSTALL_PLUGINDIR}")
|
2017-10-27 15:14:31 +02:00
|
|
|
endif()
|
2018-03-27 10:40:26 +02:00
|
|
|
if (NOT WIN32)
|
|
|
|
set(FALKON_PLUGIN_PATH "${PLUGIN_PATH}" CACHE PATH "Default plugin search path")
|
|
|
|
endif()
|
2017-10-27 14:08:49 +02:00
|
|
|
|
2017-09-09 20:20:57 +02:00
|
|
|
# Defines that are always set
|
2017-09-11 10:05:02 +02:00
|
|
|
add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_USE_QSTRINGBUILDER -DQT_NO_CAST_TO_ASCII)
|
2017-09-09 20:20:57 +02:00
|
|
|
|
|
|
|
# Mandatory: Qt5
|
2022-01-18 16:38:13 +01:00
|
|
|
set(QT_MIN_VERSION "5.15.0")
|
2020-02-29 20:12:34 +01:00
|
|
|
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Core Widgets Network Sql QuickWidgets PrintSupport WebChannel)
|
|
|
|
find_package(Qt5WebEngine ${QT_MIN_VERSION} REQUIRED)
|
|
|
|
find_package(Qt5WebEngineWidgets ${QT_MIN_VERSION} REQUIRED)
|
2018-01-24 16:06:58 +01:00
|
|
|
if (BUILD_TESTING)
|
|
|
|
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Test)
|
|
|
|
endif()
|
2017-09-09 20:20:57 +02:00
|
|
|
if (NOT DISABLE_DBUS)
|
|
|
|
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS DBus)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (UNIX AND NOT APPLE AND NOT NO_X11)
|
2018-01-24 14:25:38 +01:00
|
|
|
add_definitions(-DQZ_WS_X11)
|
2018-02-28 14:32:34 +01:00
|
|
|
find_package(XCB REQUIRED COMPONENTS XCB UTIL)
|
2017-09-09 20:20:57 +02:00
|
|
|
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS X11Extras)
|
|
|
|
endif()
|
|
|
|
if (WIN32)
|
|
|
|
add_definitions(-DW7API)
|
|
|
|
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS WinExtras)
|
2017-10-03 09:33:35 +02:00
|
|
|
|
|
|
|
# taken from https://stackoverflow.com/a/40217291
|
|
|
|
macro(get_WIN32_WINNT version)
|
|
|
|
if (CMAKE_SYSTEM_VERSION)
|
|
|
|
set(ver ${CMAKE_SYSTEM_VERSION})
|
|
|
|
string(REGEX MATCH "^([0-9]+).([0-9])" ver ${ver})
|
|
|
|
string(REGEX MATCH "^([0-9]+)" verMajor ${ver})
|
|
|
|
# Check for Windows 10, b/c we'll need to convert to hex 'A'.
|
|
|
|
if ("${verMajor}" MATCHES "10")
|
|
|
|
set(verMajor "A")
|
|
|
|
string(REGEX REPLACE "^([0-9]+)" ${verMajor} ver ${ver})
|
|
|
|
endif ("${verMajor}" MATCHES "10")
|
|
|
|
# Remove all remaining '.' characters.
|
|
|
|
string(REPLACE "." "" ver ${ver})
|
|
|
|
# Prepend each digit with a zero.
|
|
|
|
string(REGEX REPLACE "([0-9A-Z])" "0\\1" ver ${ver})
|
|
|
|
set(${version} "0x${ver}")
|
|
|
|
endif(CMAKE_SYSTEM_VERSION)
|
|
|
|
endmacro(get_WIN32_WINNT)
|
|
|
|
|
|
|
|
get_WIN32_WINNT(ver)
|
|
|
|
add_definitions(-D_WIN32_WINNT=${ver})
|
2017-09-09 20:20:57 +02:00
|
|
|
endif()
|
|
|
|
|
2018-03-23 11:16:19 +01:00
|
|
|
# Mandatory: OpenSSL
|
|
|
|
find_package(OpenSSL REQUIRED)
|
|
|
|
|
2019-04-18 16:25:27 +02:00
|
|
|
# Mandatory: KF5
|
|
|
|
find_package(KF5 REQUIRED COMPONENTS Archive)
|
|
|
|
|
2018-03-24 08:09:42 +01:00
|
|
|
# KF5I18n: Mandatory with downloaded translations (only for ki18n_install)
|
|
|
|
if (EXISTS "${CMAKE_SOURCE_DIR}/po")
|
|
|
|
find_package(KF5I18n REQUIRED)
|
|
|
|
endif()
|
2018-03-02 16:43:31 +01:00
|
|
|
|
2022-01-11 09:59:11 +01:00
|
|
|
# Optional: GnomeKeyring
|
|
|
|
find_package(PkgConfig)
|
|
|
|
if (PKG_CONFIG_FOUND)
|
|
|
|
option(BUILD_KEYRING "Gnome keyring password plugin" ON)
|
|
|
|
if (BUILD_KEYRING)
|
|
|
|
pkg_check_modules(GNOME_KEYRING IMPORTED_TARGET gnome-keyring-1 )
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2018-03-31 16:43:41 +02:00
|
|
|
# Optional: KWallet, KIO, KCrash, KCoreAddons
|
2022-01-18 16:38:13 +01:00
|
|
|
set(KF5_MIN_VERSION "5.78.0")
|
2017-09-26 15:38:28 +02:00
|
|
|
find_package(KF5Wallet ${KF5_MIN_VERSION} CONFIG)
|
2018-03-31 16:55:50 +02:00
|
|
|
set_package_properties(KF5Wallet PROPERTIES DESCRIPTION "KDE Frameworks Integration plugin" TYPE OPTIONAL)
|
2018-03-16 16:03:33 +01:00
|
|
|
find_package(KF5KIO ${KF5_MIN_VERSION} CONFIG)
|
2018-03-31 16:55:50 +02:00
|
|
|
set_package_properties(KF5KIO PROPERTIES DESCRIPTION "KDE Frameworks Integration plugin" TYPE OPTIONAL)
|
2018-03-31 16:43:41 +02:00
|
|
|
find_package(KF5Crash ${KF5_MIN_VERSION} CONFIG)
|
2018-03-31 16:55:50 +02:00
|
|
|
set_package_properties(KF5Crash PROPERTIES DESCRIPTION "KDE Frameworks Integration plugin" TYPE OPTIONAL)
|
2018-03-31 16:43:41 +02:00
|
|
|
find_package(KF5CoreAddons ${KF5_MIN_VERSION} CONFIG)
|
2018-03-31 16:55:50 +02:00
|
|
|
set_package_properties(KF5CoreAddons PROPERTIES DESCRIPTION "KDE Frameworks Integration plugin" TYPE OPTIONAL)
|
2018-12-02 13:38:23 +01:00
|
|
|
find_package(KF5Purpose ${KF5_MIN_VERSION} CONFIG)
|
|
|
|
set_package_properties(KF5Purpose PROPERTIES DESCRIPTION "KDE Frameworks Integration plugin" TYPE OPTIONAL)
|
|
|
|
if (KF5Wallet_FOUND AND KF5KIO_FOUND AND KF5Crash_FOUND AND KF5CoreAddons_FOUND AND KF5Purpose_FOUND)
|
2018-03-31 16:55:50 +02:00
|
|
|
set(ENABLE_KDE_FRAMEWORKS_INTEGRATION_PLUGIN TRUE)
|
|
|
|
endif()
|
2017-09-26 15:19:55 +02:00
|
|
|
|
2018-02-26 10:37:47 +01:00
|
|
|
# Optional: PySide2
|
|
|
|
find_package(PySide2 "2.0.0")
|
|
|
|
find_package(Shiboken2 "2.0.0")
|
2019-03-25 11:37:38 +01:00
|
|
|
find_package(Python3 COMPONENTS Development)
|
|
|
|
set_package_properties(PySide2 PROPERTIES DESCRIPTION "Python plugins" TYPE OPTIONAL)
|
|
|
|
set_package_properties(Shiboken2 PROPERTIES DESCRIPTION "Python plugins" TYPE OPTIONAL)
|
|
|
|
set_package_properties(Python3 PROPERTIES DESCRIPTION "Python plugins" TYPE OPTIONAL)
|
|
|
|
if (PySide2_FOUND AND Shiboken2_FOUND AND Python3_FOUND)
|
2018-02-26 18:28:58 +01:00
|
|
|
set(ENABLE_PYTHON_PLUGINS TRUE)
|
|
|
|
endif()
|
2018-02-26 10:37:47 +01:00
|
|
|
|
2019-03-20 11:40:11 +01:00
|
|
|
find_package(Intl)
|
2019-03-20 11:53:31 +01:00
|
|
|
if (Intl_FOUND)
|
|
|
|
set(HAVE_LIBINTL TRUE)
|
|
|
|
endif()
|
2018-09-28 21:07:31 +02:00
|
|
|
|
2017-09-09 20:20:57 +02:00
|
|
|
# Git revision
|
|
|
|
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
|
|
|
find_package(Git QUIET)
|
|
|
|
if(GIT_FOUND)
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE GIT_REVISION
|
|
|
|
)
|
|
|
|
string(REGEX REPLACE "\n" "" GIT_REVISION "${GIT_REVISION}")
|
2018-01-24 14:25:38 +01:00
|
|
|
set(FALKON_GIT_REVISION "${GIT_REVISION}")
|
2017-09-09 20:20:57 +02:00
|
|
|
else()
|
|
|
|
message(STATUS "Git revision could not be determined")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2018-01-24 14:25:38 +01:00
|
|
|
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
|
|
|
|
|
2017-09-10 15:17:07 +02:00
|
|
|
# Include dirs used everywhere
|
|
|
|
include_directories(
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/3rdparty
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/adblock
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/app
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/autofill
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/bookmarks
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/cookies
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/downloads
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/history
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/navigation
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/network
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/notifications
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/opensearch
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/other
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/plugins
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/popupwindow
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/preferences
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/session
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/sidebar
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/tabwidget
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/tools
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/webengine
|
|
|
|
${CMAKE_SOURCE_DIR}/src/lib/webtab
|
|
|
|
)
|
|
|
|
|
|
|
|
# Finally, go into the subdirs
|
2017-09-09 20:20:57 +02:00
|
|
|
add_subdirectory(src)
|
2018-01-24 16:06:58 +01:00
|
|
|
|
|
|
|
if (BUILD_TESTING)
|
|
|
|
add_subdirectory(autotests)
|
2018-01-24 16:56:46 +01:00
|
|
|
add_subdirectory(tests/benchmarks)
|
2018-01-24 16:06:58 +01:00
|
|
|
endif()
|
2017-09-09 20:20:57 +02:00
|
|
|
|
2018-03-02 18:43:12 +01:00
|
|
|
# Tell releaseme that po is already taken care of
|
|
|
|
# SKIP_PO_INSTALL
|
|
|
|
|
2017-09-26 15:38:28 +02:00
|
|
|
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
|