1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-14 02:52:12 +01:00

Move build config options to config.h

Also remove NO_SYSTEM_DATAPATH and DISABLE_UPDATES_CHECK
This commit is contained in:
David Rosca 2018-01-24 14:25:38 +01:00
parent 2d898e3834
commit 6f20d5e511
23 changed files with 45 additions and 54 deletions

View File

@ -31,41 +31,14 @@ else()
set(FALKON_INSTALL_PLUGINDIR "${KDE_INSTALL_PLUGINDIR}") set(FALKON_INSTALL_PLUGINDIR "${KDE_INSTALL_PLUGINDIR}")
endif() endif()
if (IS_ABSOLUTE ${FALKON_INSTALL_PLUGINDIR}) if (IS_ABSOLUTE ${FALKON_INSTALL_PLUGINDIR})
add_definitions(-DPLUGIN_PATH=\"${FALKON_INSTALL_PLUGINDIR}\") set(FALKON_PLUGIN_PATH "${FALKON_PLUGIN_PATH}")
else() else()
add_definitions(-DPLUGIN_PATH=\"${CMAKE_INSTALL_PREFIX}/${FALKON_INSTALL_PLUGINDIR}\") set(FALKON_PLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/${FALKON_PLUGIN_PATH}")
endif() 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 # Defines that are always set
add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_USE_QSTRINGBUILDER -DQT_NO_CAST_TO_ASCII) 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 # Mandatory: Qt5
set(QT_MIN_VERSION "5.8.0") set(QT_MIN_VERSION "5.8.0")
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Core Widgets Network Sql QuickWidgets PrintSupport WebEngineWidgets WebChannel Test) 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() endif()
if (UNIX AND NOT APPLE AND NOT NO_X11) if (UNIX AND NOT APPLE AND NOT NO_X11)
find_package(X11)
if (X11_FOUND)
add_definitions(-DQZ_WS_X11) add_definitions(-DQZ_WS_X11)
endif()
find_package(XCB COMPONENTS XCB) find_package(XCB COMPONENTS XCB)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS X11Extras) find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS X11Extras)
endif() endif()
@ -132,12 +102,14 @@ if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
OUTPUT_VARIABLE GIT_REVISION OUTPUT_VARIABLE GIT_REVISION
) )
string(REGEX REPLACE "\n" "" GIT_REVISION "${GIT_REVISION}") string(REGEX REPLACE "\n" "" GIT_REVISION "${GIT_REVISION}")
add_definitions(-DGIT_REVISION=\"${GIT_REVISION}\") set(FALKON_GIT_REVISION "${GIT_REVISION}")
else() else()
message(STATUS "Git revision could not be determined") message(STATUS "Git revision could not be determined")
endif() endif()
endif() endif()
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
# Include dirs used everywhere # Include dirs used everywhere
include_directories( include_directories(
${CMAKE_SOURCE_DIR}/src/lib/3rdparty ${CMAKE_SOURCE_DIR}/src/lib/3rdparty

11
config.h.cmake Normal file
View File

@ -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

View File

@ -17,6 +17,7 @@
* ============================================================ */ * ============================================================ */
#include "datapaths.h" #include "datapaths.h"
#include "qztools.h" #include "qztools.h"
#include "../config.h"
#include <QApplication> #include <QApplication>
#include <QDir> #include <QDir>
@ -83,14 +84,9 @@ QString DataPaths::currentProfilePath()
void DataPaths::init() void DataPaths::init()
{ {
#if defined(NO_SYSTEM_DATAPATH)
m_paths[AppData].append(QApplication::applicationDirPath());
#endif
m_paths[AppData].append(QStandardPaths::standardLocations(QStandardPaths::AppDataLocation)); m_paths[AppData].append(QStandardPaths::standardLocations(QStandardPaths::AppDataLocation));
#if defined(PLUGIN_PATH) m_paths[Plugins].append(QStringLiteral(FALKON_PLUGIN_PATH));
m_paths[Plugins].append(QStringLiteral(PLUGIN_PATH));
#endif
for (const QString &location : qAsConst(m_paths[AppData])) { for (const QString &location : qAsConst(m_paths[AppData])) {
initAssetsIn(location); initAssetsIn(location);

View File

@ -47,6 +47,7 @@
#include "scripts.h" #include "scripts.h"
#include "sessionmanager.h" #include "sessionmanager.h"
#include "closedwindowsmanager.h" #include "closedwindowsmanager.h"
#include "../config.h"
#include <QWebEngineSettings> #include <QWebEngineSettings>
#include <QDesktopServices> #include <QDesktopServices>

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */ * ============================================================ */
#include "qzcommon.h" #include "qzcommon.h"
#include "../config.h"
namespace Qz namespace Qz
{ {

View File

@ -164,8 +164,8 @@ QString FalkonSchemeReply::reportbugPage()
bPage.replace(QLatin1String("%INFO_OS%"), QzTools::operatingSystemLong()); bPage.replace(QLatin1String("%INFO_OS%"), QzTools::operatingSystemLong());
bPage.replace(QLatin1String("%INFO_APP%"), bPage.replace(QLatin1String("%INFO_APP%"),
#ifdef GIT_REVISION #ifdef FALKON_GIT_REVISION
QString("%1 (%2)").arg(Qz::VERSION, GIT_REVISION) QString("%1 (%2)").arg(Qz::VERSION, FALKON_GIT_REVISION)
#else #else
Qz::VERSION Qz::VERSION
#endif #endif
@ -215,8 +215,8 @@ QString FalkonSchemeReply::aboutPage()
aPage.replace(QLatin1String("%VERSION-INFO%"), aPage.replace(QLatin1String("%VERSION-INFO%"),
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Version"), QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Version"),
#ifdef GIT_REVISION #ifdef FALKON_GIT_REVISION
QString("%1 (%2)").arg(Qz::VERSION, GIT_REVISION))); QString("%1 (%2)").arg(Qz::VERSION, FALKON_GIT_REVISION)));
#else #else
Qz::VERSION)); Qz::VERSION));
#endif #endif
@ -387,8 +387,8 @@ QString FalkonSchemeReply::configPage()
cPage.replace(QLatin1String("%VERSION-INFO%"), cPage.replace(QLatin1String("%VERSION-INFO%"),
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Application version"), QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Application version"),
#ifdef GIT_REVISION #ifdef FALKON_GIT_REVISION
QString("%1 (%2)").arg(Qz::VERSION, GIT_REVISION) QString("%1 (%2)").arg(Qz::VERSION, FALKON_GIT_REVISION)
#else #else
Qz::VERSION Qz::VERSION
#endif #endif

View File

@ -21,6 +21,7 @@
#include "settings.h" #include "settings.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "browserwindow.h" #include "browserwindow.h"
#include "../config.h"
#include <QFile> #include <QFile>
#include <QDir> #include <QDir>

View File

@ -19,6 +19,7 @@
#define DESKTOPNOTIFICATIONSFACTORY_H #define DESKTOPNOTIFICATIONSFACTORY_H
#include "qzcommon.h" #include "qzcommon.h"
#include "../config.h"
#include <QObject> #include <QObject>
#include <QPoint> #include <QPoint>

View File

@ -57,8 +57,8 @@ void AboutDialog::showAbout()
if (m_aboutHtml.isEmpty()) { if (m_aboutHtml.isEmpty()) {
m_aboutHtml += "<center><div style='margin:20px;'>"; m_aboutHtml += "<center><div style='margin:20px;'>";
m_aboutHtml += tr("<p><b>Application version %1</b><br/>").arg( m_aboutHtml += tr("<p><b>Application version %1</b><br/>").arg(
#ifdef GIT_REVISION #ifdef FALKON_GIT_REVISION
QString("%1 (%2)").arg(Qz::VERSION, GIT_REVISION) QString("%1 (%2)").arg(Qz::VERSION, FALKON_GIT_REVISION)
#else #else
Qz::VERSION Qz::VERSION
#endif #endif

View File

@ -22,6 +22,7 @@
#include "settings.h" #include "settings.h"
#include "datapaths.h" #include "datapaths.h"
#include "adblock/adblockplugin.h" #include "adblock/adblockplugin.h"
#include "../config.h"
#include <iostream> #include <iostream>
#include <QPluginLoader> #include <QPluginLoader>
@ -88,11 +89,7 @@ void Plugins::loadSettings()
settings.endGroup(); settings.endGroup();
// Plugins are saved with relative path in portable mode // Plugins are saved with relative path in portable mode
#ifdef NO_SYSTEM_DATAPATH
if (true) {
#else
if (mApp->isPortable()) { if (mApp->isPortable()) {
#endif
QDir dir(DataPaths::path(DataPaths::Plugins)); QDir dir(DataPaths::path(DataPaths::Plugins));
for (int i = 0; i < m_allowedPlugins.count(); ++i) for (int i = 0; i < m_allowedPlugins.count(); ++i)
m_allowedPlugins[i] = dir.absoluteFilePath(QFileInfo(m_allowedPlugins[i]).fileName()); m_allowedPlugins[i] = dir.absoluteFilePath(QFileInfo(m_allowedPlugins[i]).fileName());
@ -156,9 +153,7 @@ void Plugins::loadAvailablePlugins()
QStringList dirs = DataPaths::allPaths(DataPaths::Plugins); QStringList dirs = DataPaths::allPaths(DataPaths::Plugins);
// Portable build: Load only plugins from DATADIR/plugins/ directory. // Portable build: Load only plugins from DATADIR/plugins/ directory.
#ifndef NO_SYSTEM_DATAPATH
if (mApp->isPortable()) if (mApp->isPortable())
#endif
dirs = QStringList(DataPaths::path(DataPaths::Plugins)); dirs = QStringList(DataPaths::path(DataPaths::Plugins));
foreach (const QString &dir, dirs) { foreach (const QString &dir, dirs) {

View File

@ -24,6 +24,7 @@
#include "qztools.h" #include "qztools.h"
#include "settings.h" #include "settings.h"
#include "iconprovider.h" #include "iconprovider.h"
#include "../config.h"
#include <QInputDialog> #include <QInputDialog>
#include <QMessageBox> #include <QMessageBox>

View File

@ -47,6 +47,7 @@
#include "html5permissions/html5permissionsdialog.h" #include "html5permissions/html5permissionsdialog.h"
#include "searchenginesdialog.h" #include "searchenginesdialog.h"
#include "webscrollbarmanager.h" #include "webscrollbarmanager.h"
#include "../config.h"
#include <QSettings> #include <QSettings>
#include <QInputDialog> #include <QInputDialog>

View File

@ -21,6 +21,7 @@
#include "browserwindow.h" #include "browserwindow.h"
#include "pluginproxy.h" #include "pluginproxy.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "../config.h"
#include <QTranslator> #include <QTranslator>

View File

@ -25,6 +25,7 @@
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "fcm_notification.h" #include "fcm_notification.h"
#include "datapaths.h" #include "datapaths.h"
#include "../config.h"
#include <QStatusBar> #include <QStatusBar>
#include <QTimer> #include <QTimer>

View File

@ -19,6 +19,7 @@
#include "gnomekeyringpasswordbackend.h" #include "gnomekeyringpasswordbackend.h"
#include "pluginproxy.h" #include "pluginproxy.h"
#include "browserwindow.h" #include "browserwindow.h"
#include "../config.h"
#include <QTranslator> #include <QTranslator>

View File

@ -25,6 +25,7 @@
#include "tabwidget.h" #include "tabwidget.h"
#include "webtab.h" #include "webtab.h"
#include "tabbedwebview.h" #include "tabbedwebview.h"
#include "../config.h"
#include <QTranslator> #include <QTranslator>

View File

@ -23,6 +23,7 @@
#include "pluginproxy.h" #include "pluginproxy.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "enhancedmenu.h" #include "enhancedmenu.h"
#include "../config.h"
#include <QMenu> #include <QMenu>
#include <QTranslator> #include <QTranslator>

View File

@ -19,6 +19,7 @@
#include "kwalletpasswordbackend.h" #include "kwalletpasswordbackend.h"
#include "pluginproxy.h" #include "pluginproxy.h"
#include "browserwindow.h" #include "browserwindow.h"
#include "../config.h"
#include <QTranslator> #include <QTranslator>

View File

@ -20,6 +20,7 @@
#include "mousegestures.h" #include "mousegestures.h"
#include "mainapplication.h" #include "mainapplication.h"
#include "browserwindow.h" #include "browserwindow.h"
#include "../config.h"
#include <QTranslator> #include <QTranslator>

View File

@ -23,6 +23,7 @@
#include "pluginproxy.h" #include "pluginproxy.h"
#include "browserwindow.h" #include "browserwindow.h"
#include "webview.h" #include "webview.h"
#include "../config.h"
#include <QTranslator> #include <QTranslator>

View File

@ -20,6 +20,7 @@
#include "sbi_settingsdialog.h" #include "sbi_settingsdialog.h"
#include "pluginproxy.h" #include "pluginproxy.h"
#include "browserwindow.h" #include "browserwindow.h"
#include "../config.h"
#include <QTranslator> #include <QTranslator>

View File

@ -25,6 +25,7 @@
#include "tabwidget.h" #include "tabwidget.h"
#include "tabbar.h" #include "tabbar.h"
#include "tabmanagersettings.h" #include "tabmanagersettings.h"
#include "../config.h"
#include <QInputDialog> #include <QInputDialog>
#include <QTranslator> #include <QTranslator>

View File

@ -23,6 +23,7 @@
#include "mainapplication.h" #include "mainapplication.h"
#include "sidebar.h" #include "sidebar.h"
#include "webhittestresult.h" #include "webhittestresult.h"
#include "../config.h"
#include <QMenu> #include <QMenu>
#include <QTranslator> #include <QTranslator>