diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e1cee5f8..fceb4a105 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,41 +31,14 @@ else() set(FALKON_INSTALL_PLUGINDIR "${KDE_INSTALL_PLUGINDIR}") endif() if (IS_ABSOLUTE ${FALKON_INSTALL_PLUGINDIR}) - add_definitions(-DPLUGIN_PATH=\"${FALKON_INSTALL_PLUGINDIR}\") + set(FALKON_PLUGIN_PATH "${FALKON_PLUGIN_PATH}") else() - add_definitions(-DPLUGIN_PATH=\"${CMAKE_INSTALL_PREFIX}/${FALKON_INSTALL_PLUGINDIR}\") + set(FALKON_PLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/${FALKON_PLUGIN_PATH}") endif() -# Version (TODO: move to a generated header once qmake support is dropped, to avoid full recompilations when changing this -add_definitions(-DFALKON_VERSION=\"${PROJECT_VERSION}\") - # Defines that are always set add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_USE_QSTRINGBUILDER -DQT_NO_CAST_TO_ASCII) -# Configurable options (TODO: move all defines to a generated header) -option(NO_SYSTEM_DATAPATH "TODO" OFF) -if (NO_SYSTEM_DATAPATH) - add_definitions(-DNO_SYSTEM_DATAPATH) -endif() -option(NO_X11 "TODO" OFF) -if (NO_X11) - add_definitions(-DNO_X11) -endif() -option(PORTABLE_BUILD "TODO" OFF) -if (PORTABLE_BUILD) - add_definitions(-DPORTABLE_BUILD) -endif() -option(DISABLE_DBUS "TODO" OFF) -if (DISABLE_DBUS) - add_definitions(-DDISABLE_DBUS) -endif() -option(DISABLE_UPDATES_CHECK "TODO" OFF) -if (DISABLE_UPDATES_CHECK) - add_definitions(-DDISABLE_UPDATES_CHECK) -endif() -# Note: the old qmake option DEBUG_BUILD is now -DCMAKE_BUILD_TYPE=Debug, and FALKON_PREFIX is now -DCMAKE_INSTALL_PREFIX -# SHARE_FOLDER is now auto-detected. - # Mandatory: Qt5 set(QT_MIN_VERSION "5.8.0") find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Core Widgets Network Sql QuickWidgets PrintSupport WebEngineWidgets WebChannel Test) @@ -74,10 +47,7 @@ if (NOT DISABLE_DBUS) endif() if (UNIX AND NOT APPLE AND NOT NO_X11) - find_package(X11) - if (X11_FOUND) - add_definitions(-DQZ_WS_X11) - endif() + add_definitions(-DQZ_WS_X11) find_package(XCB COMPONENTS XCB) find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS X11Extras) endif() @@ -132,12 +102,14 @@ if (EXISTS "${CMAKE_SOURCE_DIR}/.git") OUTPUT_VARIABLE GIT_REVISION ) string(REGEX REPLACE "\n" "" GIT_REVISION "${GIT_REVISION}") - add_definitions(-DGIT_REVISION=\"${GIT_REVISION}\") + set(FALKON_GIT_REVISION "${GIT_REVISION}") else() message(STATUS "Git revision could not be determined") endif() endif() +configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/src/config.h) + # Include dirs used everywhere include_directories( ${CMAKE_SOURCE_DIR}/src/lib/3rdparty diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 000000000..e6c10450d --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,11 @@ +/* config.h. Generated by cmake from config.h.cmake */ + +#define FALKON_VERSION "${PROJECT_VERSION}" +#define FALKON_PLUGIN_PATH "${FALKON_PLUGIN_PATH}" +#cmakedefine FALKON_GIT_REVISION "${FALKON_GIT_REVISION}" + +/* Enable portable build */ +#cmakedefine PORTABLE_BUILD + +/* Disable DBus support */ +#cmakedefine DISABLE_DBUS diff --git a/src/lib/app/datapaths.cpp b/src/lib/app/datapaths.cpp index 91a02e8a5..79b914307 100644 --- a/src/lib/app/datapaths.cpp +++ b/src/lib/app/datapaths.cpp @@ -17,6 +17,7 @@ * ============================================================ */ #include "datapaths.h" #include "qztools.h" +#include "../config.h" #include #include @@ -83,14 +84,9 @@ QString DataPaths::currentProfilePath() void DataPaths::init() { -#if defined(NO_SYSTEM_DATAPATH) - m_paths[AppData].append(QApplication::applicationDirPath()); -#endif m_paths[AppData].append(QStandardPaths::standardLocations(QStandardPaths::AppDataLocation)); -#if defined(PLUGIN_PATH) - m_paths[Plugins].append(QStringLiteral(PLUGIN_PATH)); -#endif + m_paths[Plugins].append(QStringLiteral(FALKON_PLUGIN_PATH)); for (const QString &location : qAsConst(m_paths[AppData])) { initAssetsIn(location); diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index 4f153849d..bcb4155c3 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -47,6 +47,7 @@ #include "scripts.h" #include "sessionmanager.h" #include "closedwindowsmanager.h" +#include "../config.h" #include #include diff --git a/src/lib/app/qzcommon.cpp b/src/lib/app/qzcommon.cpp index 9a42adda6..75e3ef76c 100644 --- a/src/lib/app/qzcommon.cpp +++ b/src/lib/app/qzcommon.cpp @@ -16,6 +16,7 @@ * along with this program. If not, see . * ============================================================ */ #include "qzcommon.h" +#include "../config.h" namespace Qz { diff --git a/src/lib/network/schemehandlers/falkonschemehandler.cpp b/src/lib/network/schemehandlers/falkonschemehandler.cpp index b7011ddba..fc4ff6551 100644 --- a/src/lib/network/schemehandlers/falkonschemehandler.cpp +++ b/src/lib/network/schemehandlers/falkonschemehandler.cpp @@ -164,8 +164,8 @@ QString FalkonSchemeReply::reportbugPage() bPage.replace(QLatin1String("%INFO_OS%"), QzTools::operatingSystemLong()); bPage.replace(QLatin1String("%INFO_APP%"), -#ifdef GIT_REVISION - QString("%1 (%2)").arg(Qz::VERSION, GIT_REVISION) +#ifdef FALKON_GIT_REVISION + QString("%1 (%2)").arg(Qz::VERSION, FALKON_GIT_REVISION) #else Qz::VERSION #endif @@ -215,8 +215,8 @@ QString FalkonSchemeReply::aboutPage() aPage.replace(QLatin1String("%VERSION-INFO%"), QString("
%1
%2
").arg(tr("Version"), -#ifdef GIT_REVISION - QString("%1 (%2)").arg(Qz::VERSION, GIT_REVISION))); +#ifdef FALKON_GIT_REVISION + QString("%1 (%2)").arg(Qz::VERSION, FALKON_GIT_REVISION))); #else Qz::VERSION)); #endif @@ -387,8 +387,8 @@ QString FalkonSchemeReply::configPage() cPage.replace(QLatin1String("%VERSION-INFO%"), QString("
%1
%2
").arg(tr("Application version"), -#ifdef GIT_REVISION - QString("%1 (%2)").arg(Qz::VERSION, GIT_REVISION) +#ifdef FALKON_GIT_REVISION + QString("%1 (%2)").arg(Qz::VERSION, FALKON_GIT_REVISION) #else Qz::VERSION #endif diff --git a/src/lib/notifications/desktopnotificationsfactory.cpp b/src/lib/notifications/desktopnotificationsfactory.cpp index 46166d994..3fd72f7db 100644 --- a/src/lib/notifications/desktopnotificationsfactory.cpp +++ b/src/lib/notifications/desktopnotificationsfactory.cpp @@ -21,6 +21,7 @@ #include "settings.h" #include "mainapplication.h" #include "browserwindow.h" +#include "../config.h" #include #include diff --git a/src/lib/notifications/desktopnotificationsfactory.h b/src/lib/notifications/desktopnotificationsfactory.h index cc32299a9..fbe28e8d9 100644 --- a/src/lib/notifications/desktopnotificationsfactory.h +++ b/src/lib/notifications/desktopnotificationsfactory.h @@ -19,6 +19,7 @@ #define DESKTOPNOTIFICATIONSFACTORY_H #include "qzcommon.h" +#include "../config.h" #include #include diff --git a/src/lib/other/aboutdialog.cpp b/src/lib/other/aboutdialog.cpp index e4379bdd6..f577ce388 100644 --- a/src/lib/other/aboutdialog.cpp +++ b/src/lib/other/aboutdialog.cpp @@ -57,8 +57,8 @@ void AboutDialog::showAbout() if (m_aboutHtml.isEmpty()) { m_aboutHtml += "
"; m_aboutHtml += tr("

Application version %1
").arg( -#ifdef GIT_REVISION - QString("%1 (%2)").arg(Qz::VERSION, GIT_REVISION) +#ifdef FALKON_GIT_REVISION + QString("%1 (%2)").arg(Qz::VERSION, FALKON_GIT_REVISION) #else Qz::VERSION #endif diff --git a/src/lib/plugins/plugins.cpp b/src/lib/plugins/plugins.cpp index 335e41491..1eb8a61cb 100644 --- a/src/lib/plugins/plugins.cpp +++ b/src/lib/plugins/plugins.cpp @@ -22,6 +22,7 @@ #include "settings.h" #include "datapaths.h" #include "adblock/adblockplugin.h" +#include "../config.h" #include #include @@ -88,11 +89,7 @@ void Plugins::loadSettings() settings.endGroup(); // Plugins are saved with relative path in portable mode -#ifdef NO_SYSTEM_DATAPATH - if (true) { -#else if (mApp->isPortable()) { -#endif QDir dir(DataPaths::path(DataPaths::Plugins)); for (int i = 0; i < m_allowedPlugins.count(); ++i) m_allowedPlugins[i] = dir.absoluteFilePath(QFileInfo(m_allowedPlugins[i]).fileName()); @@ -156,9 +153,7 @@ void Plugins::loadAvailablePlugins() QStringList dirs = DataPaths::allPaths(DataPaths::Plugins); // Portable build: Load only plugins from DATADIR/plugins/ directory. -#ifndef NO_SYSTEM_DATAPATH if (mApp->isPortable()) -#endif dirs = QStringList(DataPaths::path(DataPaths::Plugins)); foreach (const QString &dir, dirs) { diff --git a/src/lib/preferences/pluginsmanager.cpp b/src/lib/preferences/pluginsmanager.cpp index b03c0a710..cb633483a 100644 --- a/src/lib/preferences/pluginsmanager.cpp +++ b/src/lib/preferences/pluginsmanager.cpp @@ -24,6 +24,7 @@ #include "qztools.h" #include "settings.h" #include "iconprovider.h" +#include "../config.h" #include #include diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp index bf8f58e1f..2ec0734f6 100644 --- a/src/lib/preferences/preferences.cpp +++ b/src/lib/preferences/preferences.cpp @@ -47,6 +47,7 @@ #include "html5permissions/html5permissionsdialog.h" #include "searchenginesdialog.h" #include "webscrollbarmanager.h" +#include "../config.h" #include #include diff --git a/src/plugins/AutoScroll/autoscrollplugin.cpp b/src/plugins/AutoScroll/autoscrollplugin.cpp index 21ad167e7..ea783c8bf 100644 --- a/src/plugins/AutoScroll/autoscrollplugin.cpp +++ b/src/plugins/AutoScroll/autoscrollplugin.cpp @@ -21,6 +21,7 @@ #include "browserwindow.h" #include "pluginproxy.h" #include "mainapplication.h" +#include "../config.h" #include diff --git a/src/plugins/FlashCookieManager/fcm_plugin.cpp b/src/plugins/FlashCookieManager/fcm_plugin.cpp index 34a88f449..f586c90cc 100644 --- a/src/plugins/FlashCookieManager/fcm_plugin.cpp +++ b/src/plugins/FlashCookieManager/fcm_plugin.cpp @@ -25,6 +25,7 @@ #include "tabbedwebview.h" #include "fcm_notification.h" #include "datapaths.h" +#include "../config.h" #include #include diff --git a/src/plugins/GnomeKeyringPasswords/gnomekeyringplugin.cpp b/src/plugins/GnomeKeyringPasswords/gnomekeyringplugin.cpp index 74c0845c2..a975f090a 100644 --- a/src/plugins/GnomeKeyringPasswords/gnomekeyringplugin.cpp +++ b/src/plugins/GnomeKeyringPasswords/gnomekeyringplugin.cpp @@ -19,6 +19,7 @@ #include "gnomekeyringpasswordbackend.h" #include "pluginproxy.h" #include "browserwindow.h" +#include "../config.h" #include diff --git a/src/plugins/GreaseMonkey/gm_plugin.cpp b/src/plugins/GreaseMonkey/gm_plugin.cpp index d1027de78..a88372306 100644 --- a/src/plugins/GreaseMonkey/gm_plugin.cpp +++ b/src/plugins/GreaseMonkey/gm_plugin.cpp @@ -25,6 +25,7 @@ #include "tabwidget.h" #include "webtab.h" #include "tabbedwebview.h" +#include "../config.h" #include diff --git a/src/plugins/ImageFinder/imagefinderplugin.cpp b/src/plugins/ImageFinder/imagefinderplugin.cpp index 86d3dc4d9..454135c9e 100644 --- a/src/plugins/ImageFinder/imagefinderplugin.cpp +++ b/src/plugins/ImageFinder/imagefinderplugin.cpp @@ -23,6 +23,7 @@ #include "pluginproxy.h" #include "mainapplication.h" #include "enhancedmenu.h" +#include "../config.h" #include #include diff --git a/src/plugins/KWalletPasswords/kwalletplugin.cpp b/src/plugins/KWalletPasswords/kwalletplugin.cpp index 1d2149fe2..36314a7c3 100644 --- a/src/plugins/KWalletPasswords/kwalletplugin.cpp +++ b/src/plugins/KWalletPasswords/kwalletplugin.cpp @@ -19,6 +19,7 @@ #include "kwalletpasswordbackend.h" #include "pluginproxy.h" #include "browserwindow.h" +#include "../config.h" #include diff --git a/src/plugins/MouseGestures/mousegesturesplugin.cpp b/src/plugins/MouseGestures/mousegesturesplugin.cpp index a9a49af01..b2f9f0783 100644 --- a/src/plugins/MouseGestures/mousegesturesplugin.cpp +++ b/src/plugins/MouseGestures/mousegesturesplugin.cpp @@ -20,6 +20,7 @@ #include "mousegestures.h" #include "mainapplication.h" #include "browserwindow.h" +#include "../config.h" #include diff --git a/src/plugins/PIM/PIM_plugin.cpp b/src/plugins/PIM/PIM_plugin.cpp index e3fb4638e..051e3b837 100644 --- a/src/plugins/PIM/PIM_plugin.cpp +++ b/src/plugins/PIM/PIM_plugin.cpp @@ -23,6 +23,7 @@ #include "pluginproxy.h" #include "browserwindow.h" #include "webview.h" +#include "../config.h" #include diff --git a/src/plugins/StatusBarIcons/statusbariconsplugin.cpp b/src/plugins/StatusBarIcons/statusbariconsplugin.cpp index 336182e46..9cec59778 100644 --- a/src/plugins/StatusBarIcons/statusbariconsplugin.cpp +++ b/src/plugins/StatusBarIcons/statusbariconsplugin.cpp @@ -20,6 +20,7 @@ #include "sbi_settingsdialog.h" #include "pluginproxy.h" #include "browserwindow.h" +#include "../config.h" #include diff --git a/src/plugins/TabManager/tabmanagerplugin.cpp b/src/plugins/TabManager/tabmanagerplugin.cpp index 655741b08..895999ec7 100644 --- a/src/plugins/TabManager/tabmanagerplugin.cpp +++ b/src/plugins/TabManager/tabmanagerplugin.cpp @@ -25,6 +25,7 @@ #include "tabwidget.h" #include "tabbar.h" #include "tabmanagersettings.h" +#include "../config.h" #include #include diff --git a/src/plugins/TestPlugin/testplugin.cpp b/src/plugins/TestPlugin/testplugin.cpp index ee856ca6d..8e8224f9d 100644 --- a/src/plugins/TestPlugin/testplugin.cpp +++ b/src/plugins/TestPlugin/testplugin.cpp @@ -23,6 +23,7 @@ #include "mainapplication.h" #include "sidebar.h" #include "webhittestresult.h" +#include "../config.h" #include #include