1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

First steps towards a cmake buildsystem, currently only builds src/lib.

USE_DATADIR no longer exists, QStandardPaths::standardLocations is used
unless NO_SYSTEM_DATAPATH is set.
This commit is contained in:
David Faure 2017-09-09 20:20:57 +02:00
parent ca377a0d65
commit d69e5458f9
7 changed files with 457 additions and 13 deletions

117
CMakeLists.txt Normal file
View File

@ -0,0 +1,117 @@
# CMake version required. This must be the very first line, because it sets default policies affecting everything else
cmake_minimum_required(VERSION 3.1)
# Project name and version
project(Falkon VERSION 2.1.99)
# Find ECM, with nice error handling in case of failure
include(FeatureSummary)
find_package(ECM 5.27.0 CONFIG)
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/frameworks/extra-cmake-modules")
feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# 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)
# 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")
# 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)
# 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(KDE_INTEGRATION "TODO" OFF)
if (KDE_INTEGRATION)
add_definitions(-DKDE_INTEGRATION)
endif()
option(GNOME_INTEGRATION "TODO" OFF)
if (GNOME_INTEGRATION)
add_definitions(-DGNOME_INTEGRATION)
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(NONBLOCK_JS_DIALOGS "TODO" OFF)
if (NONBLOCK_JS_DIALOGS)
add_definitions(-DNONBLOCK_JS_DIALOGS)
endif()
option(USE_LIBPATH "TODO" "") # REMOVE?
if (USE_LIBPATH)
add_definitions(-DUSE_LIBPATH=\"${USE_LIBPATH}\")
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, so is USE_LIBPATH.
# 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)
if (NOT DISABLE_DBUS)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS DBus)
endif()
# Optional: KF5
set(KF5_MIN_VERSION "5.27.0")
find_package(KF5 ${KF5_MIN_VERSION} COMPONENTS Wallet)
if (UNIX AND NOT APPLE AND NOT NO_X11)
find_package(X11)
if (X11_FOUND)
add_definitions(-DQZ_WS_X11)
endif()
find_package(XCB COMPONENTS XCB)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS X11Extras)
endif()
if (WIN32)
add_definitions(-DW7API)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS WinExtras)
# TODO set var for LIBS += User32.lib Ole32.lib Shell32.lib ShlWapi.lib Gdi32.lib ComCtl32.lib ?
endif()
# 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}")
add_definitions(-DGIT_REVISION=\"${GIT_REVISION}\")
else()
message(STATUS "Git revision could not be determined")
endif()
endif()
# Finally, go into the src subdir
add_subdirectory(src)

3
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,3 @@
add_subdirectory(lib)
# TODO add_subdirectory(main)
# TODO add_subdirectory(plugins)

View File

@ -44,6 +44,8 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef QTSINGLEAPPLICATION_H
#define QTSINGLEAPPLICATION_H
#include <QApplication> #include <QApplication>
@ -100,3 +102,5 @@ private:
QtLocalPeer* peer; QtLocalPeer* peer;
QWidget* actWin; QWidget* actWin;
}; };
#endif

319
src/lib/CMakeLists.txt Normal file
View File

@ -0,0 +1,319 @@
add_definitions(-DFALKON_SHAREDLIBRARY)
set(CMAKE_CXX_STANDARD 14) # Enable C++14, with cmake >= 3.1
set(CMAKE_CXX_EXTENSIONS OFF) # Don't enable gcc-specific extensions
if (WIN32)
add_definitions(-DQT_QTSINGLEAPPLICATION_EXPORT=)
endif()
set(SRCS
3rdparty/qtsingleapplication/qtsingleapplication.cpp
3rdparty/qtsingleapplication/qtlocalpeer.cpp
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/qtsingleapplication)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(SRCS ${SRCS} ${CMAKE_SOURCE_DIR}/tests/modeltest/modeltest.cpp)
include_directories(${CMAKE_SOURCE_DIR}/tests/modeltest)
endif()
include_directories(
3rdparty
adblock
app
autofill
bookmarks
cookies
downloads
history
navigation
network
notifications
opensearch
other
plugins
popupwindow
preferences
session
sidebar
tabwidget
tools
webengine
webtab
)
set(SRCS ${SRCS}
3rdparty/fancytabwidget.cpp
3rdparty/lineedit.cpp
3rdparty/processinfo.cpp
3rdparty/squeezelabelv1.cpp
3rdparty/squeezelabelv2.cpp
3rdparty/stylehelper.cpp
adblock/adblockaddsubscriptiondialog.cpp
adblock/adblockurlinterceptor.cpp
adblock/adblockdialog.cpp
adblock/adblockicon.cpp
adblock/adblockmanager.cpp
adblock/adblockmatcher.cpp
adblock/adblockrule.cpp
adblock/adblocksearchtree.cpp
adblock/adblocksubscription.cpp
adblock/adblocktreewidget.cpp
app/autosaver.cpp
app/browserwindow.cpp
app/commandlineoptions.cpp
app/datapaths.cpp
app/mainapplication.cpp
app/mainmenu.cpp
app/profilemanager.cpp
app/proxystyle.cpp
app/qzcommon.cpp
app/settings.cpp
autofill/autofill.cpp
autofill/autofillicon.cpp
autofill/autofillnotification.cpp
autofill/autofillwidget.cpp
autofill/passwordbackends/databaseencryptedpasswordbackend.cpp
autofill/passwordbackends/databasepasswordbackend.cpp
autofill/passwordbackends/passwordbackend.cpp
autofill/passwordmanager.cpp
bookmarks/bookmarkitem.cpp
bookmarks/bookmarks.cpp
bookmarks/bookmarksexport/bookmarksexportdialog.cpp
bookmarks/bookmarksexport/bookmarksexporter.cpp
bookmarks/bookmarksexport/htmlexporter.cpp
bookmarks/bookmarksicon.cpp
bookmarks/bookmarksimport/bookmarksimportdialog.cpp
bookmarks/bookmarksimport/bookmarksimporter.cpp
bookmarks/bookmarksimport/firefoximporter.cpp
bookmarks/bookmarksimport/htmlimporter.cpp
bookmarks/bookmarksimport/chromeimporter.cpp
bookmarks/bookmarksimport/ieimporter.cpp
bookmarks/bookmarksimport/operaimporter.cpp
bookmarks/bookmarksitemdelegate.cpp
bookmarks/bookmarksmanager.cpp
bookmarks/bookmarksmenu.cpp
bookmarks/bookmarksmodel.cpp
bookmarks/bookmarkstoolbarbutton.cpp
bookmarks/bookmarkstoolbar.cpp
bookmarks/bookmarkstools.cpp
bookmarks/bookmarkstreeview.cpp
bookmarks/bookmarkswidget.cpp
cookies/cookiejar.cpp
cookies/cookiemanager.cpp
downloads/downloaditem.cpp
downloads/downloadmanager.cpp
downloads/downloadoptionsdialog.cpp
history/history.cpp
history/historyitem.cpp
history/historymanager.cpp
history/historymenu.cpp
history/historymodel.cpp
history/historytreeview.cpp
navigation/completer/locationcompleter.cpp
navigation/completer/locationcompleterdelegate.cpp
navigation/completer/locationcompletermodel.cpp
navigation/completer/locationcompleterrefreshjob.cpp
navigation/completer/locationcompleterview.cpp
navigation/downicon.cpp
navigation/goicon.cpp
navigation/locationbar.cpp
navigation/locationbarpopup.cpp
navigation/navigationbar.cpp
navigation/navigationcontainer.cpp
navigation/reloadstopbutton.cpp
navigation/siteicon.cpp
navigation/websearchbar.cpp
network/networkmanager.cpp
network/networkproxyfactory.cpp
network/networkurlinterceptor.cpp
network/schemehandlers/falkonschemehandler.cpp
network/sslerrordialog.cpp
notifications/desktopnotification.cpp
notifications/desktopnotificationsfactory.cpp
opensearch/editsearchengine.cpp
opensearch/opensearchengine.cpp
opensearch/opensearchenginedelegate.cpp
opensearch/opensearchreader.cpp
opensearch/searchenginesdialog.cpp
opensearch/searchenginesmanager.cpp
other/aboutdialog.cpp
other/browsinglibrary.cpp
other/clearprivatedata.cpp
other/checkboxdialog.cpp
other/iconchooser.cpp
other/licenseviewer.cpp
other/qzsettings.cpp
other/siteinfo.cpp
other/siteinfowidget.cpp
other/statusbarmessage.cpp
other/updater.cpp
other/useragentmanager.cpp
plugins/pluginproxy.cpp
plugins/plugins.cpp
plugins/speeddial.cpp
popupwindow/popuplocationbar.cpp
popupwindow/popupstatusbarmessage.cpp
popupwindow/popupwebview.cpp
popupwindow/popupwindow.cpp
preferences/acceptlanguage.cpp
preferences/autofillmanager.cpp
preferences/jsoptions.cpp
preferences/pluginlistdelegate.cpp
preferences/pluginsmanager.cpp
preferences/preferences.cpp
preferences/thememanager.cpp
preferences/useragentdialog.cpp
session/recoveryjsobject.cpp
session/restoremanager.cpp
session/sessionmanager.cpp
session/sessionmanagerdialog.cpp
sidebar/bookmarkssidebar.cpp
sidebar/historysidebar.cpp
sidebar/sidebar.cpp
tabwidget/combotabbar.cpp
tabwidget/tabbar.cpp
tabwidget/tabicon.cpp
tabwidget/tabstackedwidget.cpp
tabwidget/tabwidget.cpp
tools/aesinterface.cpp
tools/animatedwidget.cpp
tools/buttonbox.cpp
tools/buttonwithmenu.cpp
tools/certificateinfowidget.cpp
tools/clickablelabel.cpp
tools/closedtabsmanager.cpp
tools/colors.cpp
tools/delayedfilewatcher.cpp
tools/docktitlebarwidget.cpp
tools/emptynetworkreply.cpp
tools/enhancedmenu.cpp
tools/focusselectlineedit.cpp
tools/frame.cpp
tools/headerview.cpp
tools/horizontallistwidget.cpp
tools/html5permissions/html5permissionsdialog.cpp
tools/html5permissions/html5permissionsmanager.cpp
tools/html5permissions/html5permissionsnotification.cpp
tools/iconprovider.cpp
tools/listitemdelegate.cpp
tools/mactoolbutton.cpp
tools/menubar.cpp
tools/pagethumbnailer.cpp
tools/progressbar.cpp
tools/qzregexp.cpp
tools/qztools.cpp
tools/removeitemfocusdelegate.cpp
tools/scripts.cpp
tools/sqldatabase.cpp
tools/toolbutton.cpp
tools/treewidget.cpp
tools/widget.cpp
tools/wheelhelper.cpp
webengine/javascript/autofilljsobject.cpp
webengine/javascript/externaljsobject.cpp
webengine/loadrequest.cpp
webengine/webhittestresult.cpp
webengine/webinspector.cpp
webengine/webpage.cpp
webengine/webview.cpp
webengine/webscrollbar.cpp
webengine/webscrollbarmanager.cpp
webtab/searchtoolbar.cpp
webtab/tabbedwebview.cpp
webtab/webtab.cpp
)
if (WIN32)
set(SRCS ${SRCS} other/registerqappassociation.cpp)
endif()
if (APPLE)
set(SRCS ${SRCS} tools/disablewindowtabbbing.mm)
endif()
# TODO: use ki18n_wrap_ui?
qt5_wrap_ui(SRCS
adblock/adblockaddsubscriptiondialog.ui
adblock/adblockdialog.ui
autofill/autofillnotification.ui
autofill/autofillwidget.ui
autofill/passwordbackends/masterpassworddialog.ui
bookmarks/bookmarksexport/bookmarksexportdialog.ui
bookmarks/bookmarksimport/bookmarksimportdialog.ui
bookmarks/bookmarksmanager.ui
bookmarks/bookmarkswidget.ui
cookies/cookiemanager.ui
downloads/downloaditem.ui
downloads/downloadmanager.ui
downloads/downloadoptionsdialog.ui
history/historymanager.ui
network/sslerrordialog.ui
notifications/desktopnotification.ui
opensearch/editsearchengine.ui
opensearch/searchenginesdialog.ui
other/aboutdialog.ui
other/browsinglibrary.ui
other/clearprivatedata.ui
other/iconchooser.ui
other/siteinfo.ui
other/siteinfowidget.ui
preferences/acceptlanguage.ui
preferences/addacceptlanguage.ui
preferences/autofillmanager.ui
preferences/jsoptions.ui
preferences/pluginslist.ui
preferences/preferences.ui
preferences/thememanager.ui
preferences/useragentdialog.ui
session/sessionmanagerdialog.ui
sidebar/bookmarkssidebar.ui
sidebar/historysidebar.ui
tools/certificateinfowidget.ui
tools/docktitlebarwidget.ui
tools/html5permissions/html5permissionsdialog.ui
tools/html5permissions/html5permissionsnotification.ui
webengine/jsalert.ui
webengine/jsconfirm.ui
webengine/jsprompt.ui
webtab/searchtoolbar.ui
)
qt5_add_resources(SRCS
data/data.qrc
data/html.qrc
data/icons.qrc
data/breeze-fallback.qrc
)
add_library(FalkonPrivate SHARED ${SRCS})
target_link_libraries(FalkonPrivate Qt5::Widgets Qt5::WebEngineWidgets Qt5::Network Qt5::Sql Qt5::PrintSupport Qt5::QuickWidgets Qt5::WebChannel)
if (UNIX AND NOT APPLE)
if (NOT NO_X11)
target_link_libraries(FalkonPrivate XCB::XCB Qt5::X11Extras)
endif()
target_link_libraries(FalkonPrivate crypto)
set_target_properties(FalkonPrivate PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION "5")
install(TARGETS FalkonPrivate ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP)
endif()
if (WIN32)
target_link_libraries(FalkonPrivate Qt5::WinExtras)
target_link_libraries(FalkonPrivate libeay32)
endif()
if (APPLE)
# homebrew openssl
execute_process(COMMAND "readlink `brew --prefix openssl` | sed 's/..//'"
OUTPUT_VARIABLE READLINK_OUTPUT)
set(BREW_OPENSSL "/usr/local${READLINK_OUTPUT}")
include_directories(${BREW_OPENSSL}/include)
target_link_libraries(FalkonPrivate ${BREW_OPENSSL}/lib/libcrypto.so "-framework CoreServices -framework AppKit")
endif()
if (NOT DISABLE_DBUS)
target_link_libraries(FalkonPrivate Qt5::DBus)
endif()

View File

@ -88,21 +88,22 @@ void DataPaths::init()
#if defined(Q_OS_MACOS) #if defined(Q_OS_MACOS)
m_paths[AppData].append(QApplication::applicationDirPath() + QLatin1String("/../Resources")); m_paths[AppData].append(QApplication::applicationDirPath() + QLatin1String("/../Resources"));
#elif defined(Q_OS_UNIX) && !defined(NO_SYSTEM_DATAPATH) #elif defined(Q_OS_UNIX) && !defined(NO_SYSTEM_DATAPATH)
m_paths[AppData].append(USE_DATADIR); // Add standard data lookup paths (our appname has a capital F so we manually construct
// the final paths for now)
for (const auto& location : QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation)) {
m_paths[AppData].append(location + QLatin1String("/falkon"));
m_paths[Translations].append(location + QLatin1String("/falkon/locale"));
m_paths[Themes].append(location + QLatin1String("/falkon/themes"));
m_paths[Plugins].append(location + QLatin1String("/falkon/plugins"));
}
#else #else
m_paths[AppData].append(QApplication::applicationDirPath()); m_paths[AppData].append(QApplication::applicationDirPath());
#endif #endif
if (m_paths[Translations].isEmpty()) {
m_paths[Translations].append(m_paths[AppData].at(0) + QLatin1String("/locale")); m_paths[Translations].append(m_paths[AppData].at(0) + QLatin1String("/locale"));
m_paths[Themes].append(m_paths[AppData].at(0) + QLatin1String("/themes")); m_paths[Themes].append(m_paths[AppData].at(0) + QLatin1String("/themes"));
m_paths[Plugins].append(m_paths[AppData].at(0) + QLatin1String("/plugins")); m_paths[Plugins].append(m_paths[AppData].at(0) + QLatin1String("/plugins"));
// Add standard data lookup paths (our appname has a capital F so we manually construct
// the final paths for now)
for (auto location : QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation)) {
m_paths[Translations].append(location + QLatin1String("/falkon/locale"));
m_paths[Themes].append(location + QLatin1String("/falkon/themes"));
m_paths[Plugins].append(location + QLatin1String("/falkon/plugins"));
} }
// Config // Config

View File

@ -149,7 +149,7 @@ bool CookieJar::rejectCookie(const QString &domain, const QNetworkCookie &cookie
} }
} }
#if QTWEBENGINE_DISABLED #ifdef QTWEBENGINE_DISABLED
if (m_filterThirdParty) { if (m_filterThirdParty) {
bool result = matchDomain(cookieDomain, domain); bool result = matchDomain(cookieDomain, domain);
if (!result) { if (!result) {

View File

@ -382,7 +382,7 @@ QString FalkonSchemeReply::configPage()
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Themes"), DataPaths::path(DataPaths::Themes)) + QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Themes"), DataPaths::path(DataPaths::Themes)) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Translations"), DataPaths::path(DataPaths::Translations))); QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Translations"), DataPaths::path(DataPaths::Translations)));
#ifdef FALKON_DEBUG_BUILD #ifdef QT_DEBUG
QString debugBuild = tr("<b>Enabled</b>"); QString debugBuild = tr("<b>Enabled</b>");
#else #else
QString debugBuild = tr("Disabled"); QString debugBuild = tr("Disabled");