aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt48
-rw-r--r--doc/Building.asciidoc4
-rw-r--r--lib/about/aboutdialog.cpp6
-rw-r--r--lib/configuration/configuration.cpp16
-rw-r--r--lib/configuration/defaults.h.in14
-rw-r--r--linux/makepkg/PKGBUILD22
-rw-r--r--src/CMakeLists.txt22
-rw-r--r--src/browser.cpp2
-rw-r--r--src/main.cpp10
-rw-r--r--src/version.h.in6
-rw-r--r--vendor.cmake54
11 files changed, 93 insertions, 111 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 51983e3..074e736 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,47 +3,49 @@ project(smolbote)
include(FeatureSummary)
-set(VENDOR "${CMAKE_SOURCE_DIR}/vendor.cmake" CACHE FILEPATH "vendor configuration path")
-include(${VENDOR})
-
# Options
-option(QtDeprecatedWarnings "Qt deprecated warnings" ON)
-option(UseLibCpp "Use libc++ over stdlibc++ (requires clang)" OFF)
-option(Tests "Enable/disable some basic autotests" OFF)
-option(Plasma "Enable Plasma integration" OFF)
-option(Breakpad "Enable breakpad crash reports" OFF)
+option(Feature_ClangLibCpp "Use libc++ over stdlibc++" OFF)
+option(Feature_Plasma "Enable Plasma integration" OFF)
+option(Feature_Breakpad "Enable Breakpad crash reports" OFF)
+
+option(Devel_QtDeprecated "Enable Qt deprecation warnings" ON)
+option(Devel_Tests "Enable automatic testing" OFF)
+
+set(Vendor "${CMAKE_SOURCE_DIR}/vendor.cmake" CACHE FILEPATH "vendor configuration path")
+include(${Vendor})
# Libraries
-find_package(Qt5 COMPONENTS Core Widgets Concurrent REQUIRED)
-find_package(Qt5 5.11.0 COMPONENTS WebEngineWidgets REQUIRED)
+find_package(Qt5 5.11.0 COMPONENTS Core Widgets WebEngineWidgets REQUIRED)
find_package(Boost 1.66 COMPONENTS program_options REQUIRED)
-if(Plasma)
+if(Feature_Plasma)
find_package(ECM 1.6.0 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
find_package(KF5 "5.6.0" COMPONENTS Wallet WindowSystem REQUIRED)
-endif(Plasma)
+endif(Feature_Plasma)
+
+if(Feature_Breakpad)
+ find_package(Threads REQUIRED)
+ add_subdirectory(3rd-party/breakpad)
+endif(Feature_Breakpad)
# Global C++ settings
set(CMAKE_CXX_STANDARD 17)
-if(QtDeprecatedWarnings)
+if(Devel_QtDeprecated)
add_definitions(-DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050900)
-endif(QtDeprecatedWarnings)
+endif(Devel_QtDeprecated)
# link to libc++
-if (UseLibCpp)
+if (Feature_ClangLibCpp)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
-endif (UseLibCpp)
+endif (Feature_ClangLibCpp)
# configure a header file to pass version information
configure_file("${PROJECT_SOURCE_DIR}/src/version.h.in" "${PROJECT_BINARY_DIR}/src/version.h")
add_subdirectory(3rd-party/SingleApplication)
-if(Breakpad)
- add_subdirectory(3rd-party/breakpad)
-endif()
add_subdirectory(lib/about)
add_subdirectory(lib/addressbar)
@@ -59,17 +61,17 @@ add_subdirectory(plugins/ConfigurationEditor)
# browser source code
add_subdirectory(src)
-if (Tests)
+if(Devel_Tests)
enable_testing()
find_package(Qt5 COMPONENTS Test REQUIRED)
add_subdirectory(test)
-endif()
+endif(Devel_Tests)
# Summarize
message(STATUS "=== Configuration summary ===")
-message(STATUS "Building ${poi_exe} ${VerTag}; version ${VerDescribe} ${VerBranch}:${VerCommit}")
-message(STATUS "vendor.cmake: ${VENDOR}")
+message(STATUS "Building ${poi_exe} ${poi_Build}")
+message(STATUS "vendor.cmake: ${Vendor}")
message(STATUS "Platform: ${CMAKE_SYSTEM_NAME}")
message(STATUS "Generator: ${CMAKE_GENERATOR}")
diff --git a/doc/Building.asciidoc b/doc/Building.asciidoc
index 47eb0bb..6fabf8f 100644
--- a/doc/Building.asciidoc
+++ b/doc/Building.asciidoc
@@ -49,12 +49,14 @@ make -j4
make install
----
+You can also use ccmake (cmake curses interface) or cmake-gui.
+
=== vendor.cmake
vendor.cmake contains various settings to customize the way in which the program
functions. The available options and their values may change with revisions.
When changing vendor.cmake, make sure to have all values defined in the preset.
- -DVENDOR=path/to/custom-vendor.cmake
+ -DVendor=path/to/custom-vendor.cmake
=== Compiler flags
cmake does not set any C++ flags by default, including no optimization flags.
diff --git a/lib/about/aboutdialog.cpp b/lib/about/aboutdialog.cpp
index 2a3d210..c7ed385 100644
--- a/lib/about/aboutdialog.cpp
+++ b/lib/about/aboutdialog.cpp
@@ -8,7 +8,7 @@
#include "aboutdialog.h"
#include "ui_aboutdialog.h"
-#include "version.h"
+#include <version.h>
#include <QtWebEngine/QtWebEngineVersion>
#include <boost/version.hpp>
@@ -50,8 +50,8 @@ AboutDialog::AboutDialog(QWidget *parent)
"</ul>"
"<p>This program is distributed in the hope that it will be useful, but without any warranty.</p>"));
- ui->detailsLabel->setText(tr("<p>Version " SMOLBOTE_DESCRIBE "</p>"
- "<p>Build " SMOLBOTE_BUILD "</p>"
+ ui->detailsLabel->setText(tr("<p>Version " poi_Describe "</p>"
+ "<p>Build " poi_Build "</p>"
"<p>Compiled with " compiler "</p>"));
}
diff --git a/lib/configuration/configuration.cpp b/lib/configuration/configuration.cpp
index 48acecf..cf58d82 100644
--- a/lib/configuration/configuration.cpp
+++ b/lib/configuration/configuration.cpp
@@ -18,8 +18,8 @@ namespace po = boost::program_options;
inline std::string defaultUserConfigLocation()
{
-#ifdef ConfigPath
- return ConfigPath;
+#ifdef Path_Config
+ return Path_Config;
#else
// try to locate an existing config
QString path = QStandardPaths::locate(QStandardPaths::ConfigLocation, "smolbote/smolbote.cfg");
@@ -55,7 +55,7 @@ Configuration::Configuration(QObject *parent)
("browser.locale", po::value<std::string>(), "Set Qt localization.")
("browser.translation", po::value<std::string>(), "Set application localization.")
- ("browser.crash.path", po::value<std::string>()->default_value(CrashdumpPath))
+ ("browser.crash.path", po::value<std::string>()->default_value(Path_Crashdump))
("browser.crash.handler", po::value<std::string>())
// main window ui
@@ -100,7 +100,7 @@ Configuration::Configuration(QObject *parent)
("subwindow.shortcuts.fullscreen", po::value<std::string>()->default_value("F11"))
// Filter settings
- ("filter.path", po::value<std::string>()->default_value(FilterPath))
+ ("filter.path", po::value<std::string>()->default_value(Path_Filter))
("filter.adblock", po::value<std::string>())
("filter.header", po::value<std::vector<std::string>>())
// ("filter.cookies.block.all", po::value<bool>()->default_value(false))
@@ -108,22 +108,22 @@ Configuration::Configuration(QObject *parent)
// ("filter.cookies.path", po::value<std::string>()->default_value("~/.config/smolbote/cookies.d"))
// Plugin settings
- ("plugins.path", po::value<std::string>()->default_value(PluginsPath))
+ ("plugins.path", po::value<std::string>()->default_value(Path_Plugins))
// Profile settings
// default profile name the browser should use; "" is off-the-record
("profile.default", po::value<std::string>()->default_value(""))
- ("profile.path", po::value<std::string>()->default_value(ProfilesPath))
+ ("profile.path", po::value<std::string>()->default_value(Path_Profiles))
("profile.search", po::value<std::string>()->default_value("https://duckduckgo.com/?q=%1&ia=web"))
("profile.homepage", po::value<std::string>()->default_value("about:blank"))
("profile.newtab", po::value<std::string>()->default_value("about:blank"))
// Bookmark settings
- ("bookmarks.path", po::value<std::string>()->default_value(BookmarksPath))
+ ("bookmarks.path", po::value<std::string>()->default_value(Path_Bookmarks))
("bookmarks.shortcut", po::value<std::string>()->default_value("Ctrl+B"))
// Downloads settings
- ("downloads.path", po::value<std::string>()->default_value(DownloadsPath))
+ ("downloads.path", po::value<std::string>()->default_value(Path_Downloads))
("downloads.shortcut", po::value<std::string>()->default_value("Ctrl+D"))
;
}
diff --git a/lib/configuration/defaults.h.in b/lib/configuration/defaults.h.in
index f239b14..6a7232e 100644
--- a/lib/configuration/defaults.h.in
+++ b/lib/configuration/defaults.h.in
@@ -1,14 +1,14 @@
#ifndef SMOLBOTE_DEFAULTS
#define SMOLBOTE_DEFAULTS
-#cmakedefine ConfigPath "@ConfigPath@"
-#cmakedefine CrashdumpPath "@CrashdumpPath@"
+#cmakedefine Path_Config "@Path_Config@"
+#cmakedefine Path_Crashdump "@Path_Crashdump@"
-#cmakedefine FilterPath "@FilterPath@"
-#cmakedefine PluginsPath "@PluginsPath@"
-#cmakedefine ProfilesPath "@ProfilesPath@"
+#cmakedefine Path_Filter "@Path_Filter@"
+#cmakedefine Path_Plugins "@Path_Plugins@"
+#cmakedefine Path_Profiles "@Path_Profiles@"
-#cmakedefine BookmarksPath "@BookmarksPath@"
-#cmakedefine DownloadsPath "@DownloadsPath@"
+#cmakedefine Path_Bookmarks "@Path_Bookmarks@"
+#cmakedefine Path_Downloads "@Path_Downloads@"
#endif // SMOLBOTE_DEFAULTS
diff --git a/linux/makepkg/PKGBUILD b/linux/makepkg/PKGBUILD
index cac761b..240f711 100644
--- a/linux/makepkg/PKGBUILD
+++ b/linux/makepkg/PKGBUILD
@@ -53,25 +53,17 @@ pkgver() {
build() {
# generate makefile
-
- # option default
- # -DQtDeprecatedWarnings On
- # -DUseLibCpp Off
- # -DTests Off
- # -DPlasma Off
- # -DBreakpad Off If you turn it on, add a breakpad
- # dependancy to makedepends, or modify
- # 3rd-pary/breakpad/CMakeLists.txt
- # accordingly.
-
+ # see doc/Building.asciidoc for list of options
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$pkgdir/usr/local \
- -DVerTag=$_tag \
- -DVerDescribe=$_describe \
- -DVerCommit=$_commit \
- -DVerBranch=$_branch \
+ -Dpoi_Version="$_tag" \
+ -Dpoi_Describe="$pkgver" \
+ -Dpoi_Build="$_branch:$_commit" \
$srcdir/smolbote
+ # if you want to manually customize the build, you can use ccmake here
+ ccmake .
+
# Build
make
}
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b772792..9425b2d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -58,9 +58,9 @@ set(srclist
)
# if you are using a custom build location for breakpad:
-#if(Breakpad)
+#if(Feature_Breakpad)
# link_directories("${BREAKPAD_LIBRARY_DIRS}")
-#endif()
+#endif(Feature_Breakpad)
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
add_executable(${poi_exe} WIN32 ${srclist} ${PROJECT_SOURCE_DIR}/data/windows.rc)
@@ -69,14 +69,14 @@ else()
endif()
target_include_directories(${poi_exe}
- PRIVATE ${Boost_INCLUDE_DIRS}
+ PRIVATE ${Boost_INCLUDE_DIRS}
PRIVATE ${PROJECT_SOURCE_DIR}/include
- PRIVATE ${PROJECT_SOURCE_DIR}/lib
- PRIVATE ${PROJECT_SOURCE_DIR}/plugins
+ PRIVATE ${PROJECT_SOURCE_DIR}/lib
+ PRIVATE ${PROJECT_SOURCE_DIR}/plugins
)
target_link_libraries(${poi_exe}
- Qt5::Core Qt5::Widgets Qt5::Concurrent Qt5::WebEngineWidgets
+ Qt5::Core Qt5::Widgets Qt5::WebEngineWidgets
${Boost_LIBRARIES}
SingleApplication
about
@@ -85,20 +85,18 @@ target_link_libraries(${poi_exe}
bookmarks downloads web urlfilter
)
-if(Breakpad)
- find_package(Threads REQUIRED)
-
+if(Feature_Breakpad)
target_link_libraries(${poi_exe} Threads::Threads ${BREAKPAD_LIBRARIES})
target_include_directories(${poi_exe} PRIVATE ${BREAKPAD_INCLUDE_DIRS})
target_compile_options(${poi_exe} PRIVATE ${BREAKPAD_CFLAGS_OTHER})
target_compile_definitions(${poi_exe} PRIVATE BreakpadEnabled)
-endif()
+endif(Feature_Breakpad)
-if(Plasma)
+if(Feature_Plasma)
target_link_libraries(${poi_exe} KF5::Wallet KF5::WindowSystem)
target_compile_definitions(${poi_exe} PRIVATE PLASMA)
-endif(Plasma)
+endif(Feature_Plasma)
target_compile_definitions(${poi_exe}
PRIVATE QAPPLICATION_CLASS=QApplication
diff --git a/src/browser.cpp b/src/browser.cpp
index 0ad1071..27dda2b 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -36,7 +36,7 @@ Browser::Browser(int &argc, char *argv[], bool allowSecondary)
{
setApplicationName(POI_NAME);
setWindowIcon(QIcon(":/icon.svg"));
- setApplicationVersion(SMOLBOTE_VERSION);
+ setApplicationVersion(poi_Version);
}
Browser::~Browser()
diff --git a/src/main.cpp b/src/main.cpp
index e0ba7eb..5eb32fe 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -9,7 +9,7 @@
#include "browser.h"
#include "session.h"
#include "util.h"
-#include "version.h"
+#include <version.h>
#include <QFile>
#include <QLibraryInfo>
#include <QTranslator>
@@ -47,7 +47,7 @@ static bool dumpCallback(const google_breakpad::MinidumpDescriptor &descriptor,
pid_t pid = fork();
if(pid == 0) {
char buffer[256];
- snprintf(buffer, 256, "%s %s %s", ctx->handler, SMOLBOTE_BUILD, descriptor.path());
+ snprintf(buffer, 256, "%s %s %s", ctx->handler, poi_Build, descriptor.path());
execlp("/bin/sh", "/bin/sh", "-c", buffer, (char *)nullptr);
}
}
@@ -93,13 +93,13 @@ int main(int argc, char **argv)
// --version
if(config->exists("version")) {
- std::cout << "smolbote " << SMOLBOTE_VERSION << std::endl;
+ std::cout << "smolbote " << poi_Version << std::endl;
return 0;
}
// --build
if(config->exists("build")) {
- std::cout << SMOLBOTE_BUILD;
+ std::cout << poi_Build;
return 0;
}
@@ -124,7 +124,7 @@ int main(int argc, char **argv)
}
if(config->exists("help")) {
- std::cout << "smolbote " << SMOLBOTE_VERSION << ": yet another no-frills browser" << std::endl;
+ std::cout << "smolbote " << poi_Version << ": yet another no-frills browser" << std::endl;
std::cout << "Usage: " << argv[0] << " [options] [command/URL(s)]" << std::endl
<< std::endl;
diff --git a/src/version.h.in b/src/version.h.in
index 59f85c8..c31c4a8 100644
--- a/src/version.h.in
+++ b/src/version.h.in
@@ -2,13 +2,13 @@
#define SMOLBOTE_VERSION_H
// Version: 1.2.3
-#define SMOLBOTE_VERSION "@VerTag@"
+#cmakedefine poi_Version "@poi_Version@"
// Describe: 1.2.3-r123-0123456789ab
-#define SMOLBOTE_DESCRIBE "@VerDescribe@"
+#cmakedefine poi_Describe "@poi_Describe@"
// Build
-#define SMOLBOTE_BUILD "@VerBranch@:@VerCommit@"
+#cmakedefine poi_Build "@poi_Build@"
#endif // SMOLBOTE_VERSION_H
diff --git a/vendor.cmake b/vendor.cmake
index 183dce9..b6e1819 100644
--- a/vendor.cmake
+++ b/vendor.cmake
@@ -1,44 +1,35 @@
## Build configuration
# Feel free to copy this file and change settings as you need. To use your own
-# variant, use -DVENDOR=<path to your vendor.cmake> when generating the build
+# variant, use -DVendor=<path to your vendor.cmake> when generating the build
# script.
-## Naming
-# Executable name
-set(poi_exe poi)
-# Application name
-set(poi_name "smolbote")
+## Application
+set(poi_exe "poi" CACHE STRING "Executable name")
+set(poi_name "smolbote" CACHE STRING "Application name")
## Configuration paths, used in lib/configuration/defaults.h.in
-if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
- set(ConfigPath "smolbote.ini")
- set(CrashdumpPath "crashes")
-
- set(FilterPath "hosts")
- set(PluginsPath "plugins")
- set(ProfilesPath "profiles")
-
- set(BookmarksPath "bookmarks.xbel")
- set(DownloadsPath "~/Downloads")
+if(UNIX)
+ set(PathPrefix "~/.config/smolbote")
else()
- set(ConfigPath "~/.config/smolbote/smolbote.cfg")
- set(CrashdumpPath "~/.config/smolbote/crash.d")
+ set(PathPrefix ".")
+endif()
- set(FilterPath "~/.config/smolbote/hosts.d")
- set(PluginsPath "~/.config/smolbote/plugins.d")
- set(ProfilesPath "~/.config/smolbote/profiles.d")
+set(Path_Config "${PathPrefix}/smolbote.cfg" CACHE STRING "Configuration location")
+set(Path_Crashdump "${PathPrefix}/crash.d" CACHE STRING "Crash dump location")
- set(BookmarksPath "~/.config/smolbote/bookmarks.xbel")
- set(DownloadsPath "~/Downloads")
-endif()
+set(Path_Filter "${PathPrefix}/hosts.d" CACHE STRING "Host path location")
+set(Path_Plugins "${PathPrefix}/plugins.d" CACHE STRING "Plugin load location")
+set(Path_Profiles "${PathPrefix}/profiles.d" CACHE STRING "Profile load location")
+set(Path_Bookmarks "${PathPrefix}/bookmarks.xbel" CACHE STRING "Bookmark location")
+set(Path_Downloads "~/Downloads" CACHE STRING "Download location")
## Install Paths
# Binaries will be installed to ${CMAKE_INSTALL_PREFIX}/${installPath_bin}
set(installPath_bin bin)
# Plugins will be installed to ${CMAKE_INSTALL_PREFIX}/${installPath_plugin}
-if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+if(WIN32)
set(installPath_plugin bin/plugins)
else()
set(installPath_plugin lib/smolbote)
@@ -48,18 +39,15 @@ endif()
if (EXISTS "${PROJECT_SOURCE_DIR}/.git")
execute_process(COMMAND git rev-list --count HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerRevision OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND git rev-parse --short HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerShortId OUTPUT_STRIP_TRAILING_WHITESPACE)
- set(VerTag "r${VerRevision}")
- set(VerDescribe "r${VerRevision}-${VerShortId}")
execute_process(COMMAND git rev-parse HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerCommit OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND git rev-parse --abbrev-ref HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerBranch OUTPUT_STRIP_TRAILING_WHITESPACE)
-else()
- message(FATAL_ERROR "Cannot find repository metadata. Please set version information in vendor.cmake")
- #set(VerTag "0.2.2")
- #set(VerDescribe "0.2.2-unknown")
- #set(VerCommit "00000000")
- #set(VerBranch "unknown")
endif()
+set(poi_Version "r${VerRevision}" CACHE STRING "Short version string")
+set(poi_Describe "r${VerRevision}-${VerShortId}" CACHE STRING "Long version string")
+set(poi_Build "${VerBranch}-${VerCommit}" CACHE STRING "Build string")
+
+
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -O2")