1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +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}")
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

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 "qztools.h"
#include "../config.h"
#include <QApplication>
#include <QDir>
@ -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);

View File

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

View File

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

View File

@ -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("<dt>%1</dt><dd>%2<dd>").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("<dt>%1</dt><dd>%2<dd>").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

View File

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

View File

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

View File

@ -57,8 +57,8 @@ void AboutDialog::showAbout()
if (m_aboutHtml.isEmpty()) {
m_aboutHtml += "<center><div style='margin:20px;'>";
m_aboutHtml += tr("<p><b>Application version %1</b><br/>").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

View File

@ -22,6 +22,7 @@
#include "settings.h"
#include "datapaths.h"
#include "adblock/adblockplugin.h"
#include "../config.h"
#include <iostream>
#include <QPluginLoader>
@ -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) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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