From 5a9d3032869382ec2103e11ef785fe939f93a74f Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Wed, 7 Mar 2018 14:08:52 +0100 Subject: Reworked CMakeLists to be a bit more readable --- CMakeLists.txt | 90 ++--------------------------------- config/CMakeLists.txt | 14 ++++-- lib/bookmarks/CMakeLists.txt | 8 +++- lib/downloads/CMakeLists.txt | 8 +++- plugins/ProfileEditor/CMakeLists.txt | 2 - src/CMakeLists.txt | 84 ++++++++++++++++++++++++++++++++ src/addressbar/urllineedit.cpp | 2 +- src/addressbar/urllineedit.h | 2 +- src/browser.cpp | 2 +- src/browser.h | 2 +- src/main.cpp | 2 +- src/mainwindow/mainwindow.cpp | 6 +-- src/mainwindow/widgets/searchform.cpp | 2 +- src/webengine/webview.cpp | 4 +- src/widgets/mainwindowmenubar.cpp | 2 +- src/widgets/mainwindowtabbar.cpp | 4 +- 16 files changed, 126 insertions(+), 108 deletions(-) create mode 100644 src/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 841c64d..c0ab789 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,13 +13,6 @@ find_package(Qt5Concurrent REQUIRED) find_package(Qt5WebEngineWidgets REQUIRED) find_package(Boost COMPONENTS program_options REQUIRED) -# Find includes in corresponding build directories -set(CMAKE_INCLUDE_CURRENT_DIR ON) -# Instruct CMake to run moc automatically when needed. -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTOUIC ON) -set(CMAKE_AUTORCC ON) - # Global C++ settings set(CMAKE_CXX_STANDARD 17) @@ -47,83 +40,8 @@ add_subdirectory(lib/downloads) add_subdirectory(plugins/ProfileEditor) -add_subdirectory(config) - -# configure a header file to pass version information -# if you don't have git, or are building this off the source tarball, define versions in version.h.in -execute_process(COMMAND hg log -r '.' --template={latesttag} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsVersion OUTPUT_STRIP_TRAILING_WHITESPACE) -execute_process(COMMAND hg identify --id WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsCommit OUTPUT_STRIP_TRAILING_WHITESPACE) -execute_process(COMMAND hg identify --num WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsRevision OUTPUT_STRIP_TRAILING_WHITESPACE) -execute_process(COMMAND hg identify --branch WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsBranch OUTPUT_STRIP_TRAILING_WHITESPACE) -configure_file(src/version.h.in "${PROJECT_BINARY_DIR}/version.h") - -set(SourceCode - # main - "src/main.cpp" - "src/singleapplication.cpp" - "src/singleapplication.h" - "src/browser.cpp" - "src/browser.h" - src/configuration.cpp - src/configuration.h - "data/resources.qrc" - - # main window - src/mainwindow/mainwindow.cpp - src/mainwindow/mainwindow.h - src/mainwindow/mainwindow.ui - src/mainwindow/widgets/loadingbar.cpp - src/mainwindow/widgets/loadingbar.h - src/mainwindow/widgets/navigationbar.cpp - src/mainwindow/widgets/navigationbar.h - src/mainwindow/widgets/searchform.cpp - src/mainwindow/widgets/searchform.h - src/mainwindow/widgets/searchform.ui - - # address bar - src/addressbar/completer.cpp - src/addressbar/completer.h - src/addressbar/urllineedit.cpp - src/addressbar/urllineedit.h - - # todo: move all to src/mainwindow - "src/widgets/mainwindowmenubar.cpp" - "src/widgets/mainwindowmenubar.h" - "src/widgets/mainwindowtabbar.cpp" - "src/widgets/mainwindowtabbar.h" +# browser source code +add_subdirectory(src) - # webengine - src/webengine/cookieinterceptor.cpp - src/webengine/cookieinterceptor.h - "src/webengine/urlinterceptor.cpp" - "src/webengine/urlinterceptor.h" - "src/webengine/webengineprofile.cpp" # todo: rename to profile - "src/webengine/webengineprofile.h" - "src/webengine/webpage.cpp" - "src/webengine/webpage.h" - "src/webengine/webview.cpp" - "src/webengine/webview.h" - - # forms - "src/forms/aboutdialog.cpp" - "src/forms/aboutdialog.h" - "src/forms/aboutdialog.ui" - # todo: move to src/webengine - #"src/forms/cookiesform.cpp" - #"src/forms/cookiesform.h" - #"src/forms/cookiesform.ui" - - # plugin interfaces - plugins/interfaces.h src/commandline.cpp src/commandline.h) - -add_executable(poi ${SourceCode}) - -target_include_directories(poi - PRIVATE src lib - PRIVATE plugins) - -target_link_libraries(poi Qt5::Core Qt5::Widgets Qt5::Concurrent Qt5::WebEngineWidgets) -target_link_libraries(poi ${Boost_LIBRARIES}) -target_link_libraries(poi bookmarks downloads) - -install(TARGETS poi RUNTIME DESTINATION bin CONFIGURATIONS Release) +# configuration program +add_subdirectory(config) diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt index 129b2f2..cde4648 100644 --- a/config/CMakeLists.txt +++ b/config/CMakeLists.txt @@ -1,8 +1,11 @@ -cmake_minimum_required(VERSION 3.1.0) - # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) +# Instruct CMake to run moc automatically when needed. +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + add_executable(poi-config main.cpp settingsdialog.cpp @@ -11,5 +14,8 @@ add_executable(poi-config ../src/configuration.cpp ) -target_link_libraries(poi-config Qt5::Core Qt5::Widgets) -target_link_libraries(poi-config ${Boost_LIBRARIES}) +target_link_libraries(poi-config + Qt5::Core Qt5::Widgets + ${Boost_LIBRARIES}) + +install(TARGETS poi-config RUNTIME DESTINATION bin CONFIGURATIONS Release) diff --git a/lib/bookmarks/CMakeLists.txt b/lib/bookmarks/CMakeLists.txt index e94c494..b7bbf0d 100644 --- a/lib/bookmarks/CMakeLists.txt +++ b/lib/bookmarks/CMakeLists.txt @@ -1,4 +1,10 @@ -cmake_minimum_required(VERSION 3.1.0) +# Find includes in corresponding build directories +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +# Instruct CMake to run moc automatically when needed. +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) add_library(bookmarks bookmarksform.ui diff --git a/lib/downloads/CMakeLists.txt b/lib/downloads/CMakeLists.txt index ca67f0a..ad1a3fe 100644 --- a/lib/downloads/CMakeLists.txt +++ b/lib/downloads/CMakeLists.txt @@ -1,4 +1,10 @@ -cmake_minimum_required(VERSION 3.1.0) +# Find includes in corresponding build directories +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +# Instruct CMake to run moc automatically when needed. +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) add_library(downloads downloadsform.ui diff --git a/plugins/ProfileEditor/CMakeLists.txt b/plugins/ProfileEditor/CMakeLists.txt index a4a4005..10b939d 100644 --- a/plugins/ProfileEditor/CMakeLists.txt +++ b/plugins/ProfileEditor/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 3.1.0) - find_package(Qt5Core REQUIRED) find_package(Qt5Widgets REQUIRED) find_package(Qt5WebEngineWidgets REQUIRED) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..d2febde --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,84 @@ +# Find includes in corresponding build directories +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +# Instruct CMake to run moc automatically when needed. +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +# configure a header file to pass version information +# if you don't have git, or are building this off the source tarball, define versions in version.h.in +execute_process(COMMAND hg log -r '.' --template={latesttag} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsVersion OUTPUT_STRIP_TRAILING_WHITESPACE) +execute_process(COMMAND hg identify --id WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsCommit OUTPUT_STRIP_TRAILING_WHITESPACE) +execute_process(COMMAND hg identify --num WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsRevision OUTPUT_STRIP_TRAILING_WHITESPACE) +execute_process(COMMAND hg identify --branch WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsBranch OUTPUT_STRIP_TRAILING_WHITESPACE) +configure_file(version.h.in "${PROJECT_BINARY_DIR}/src/version.h") + +add_executable(poi + # main + main.cpp + singleapplication.cpp + singleapplication.h + browser.cpp + browser.h + configuration.cpp + configuration.h + ../data/resources.qrc + + # main window + mainwindow/mainwindow.cpp + mainwindow/mainwindow.h + mainwindow/mainwindow.ui + mainwindow/widgets/loadingbar.cpp + mainwindow/widgets/loadingbar.h + mainwindow/widgets/navigationbar.cpp + mainwindow/widgets/navigationbar.h + mainwindow/widgets/searchform.cpp + mainwindow/widgets/searchform.h + mainwindow/widgets/searchform.ui + + # address bar + addressbar/completer.cpp + addressbar/completer.h + addressbar/urllineedit.cpp + addressbar/urllineedit.h + + # todo: move all to mainwindow + widgets/mainwindowmenubar.cpp + widgets/mainwindowmenubar.h + widgets/mainwindowtabbar.cpp + widgets/mainwindowtabbar.h + + # webengine + webengine/cookieinterceptor.cpp + webengine/cookieinterceptor.h + webengine/urlinterceptor.cpp + webengine/urlinterceptor.h + webengine/webengineprofile.cpp # todo: rename to profile + webengine/webengineprofile.h + webengine/webpage.cpp + webengine/webpage.h + webengine/webview.cpp + webengine/webview.h + + # forms + forms/aboutdialog.cpp + forms/aboutdialog.h + forms/aboutdialog.ui + # todo: move to webengine + #forms/cookiesform.cpp + #forms/cookiesform.h + #forms/cookiesform.ui + + # plugin interfaces + ../plugins/interfaces.h commandline.cpp commandline.h) + +target_include_directories(poi + PRIVATE ../lib ../plugins) + +target_link_libraries(poi + Qt5::Core Qt5::Widgets Qt5::Concurrent Qt5::WebEngineWidgets + ${Boost_LIBRARIES} + bookmarks downloads) + +install(TARGETS poi RUNTIME DESTINATION bin CONFIGURATIONS Release) diff --git a/src/addressbar/urllineedit.cpp b/src/addressbar/urllineedit.cpp index 21effb4..fa43a58 100644 --- a/src/addressbar/urllineedit.cpp +++ b/src/addressbar/urllineedit.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include UrlLineEdit::UrlLineEdit(QWidget *parent) : QLineEdit(parent) diff --git a/src/addressbar/urllineedit.h b/src/addressbar/urllineedit.h index 4c5ce82..f03b513 100644 --- a/src/addressbar/urllineedit.h +++ b/src/addressbar/urllineedit.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include "webengine/webview.h" #include "completer.h" class BookmarksView; diff --git a/src/browser.cpp b/src/browser.cpp index 2f2249a..22af1f0 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -7,7 +7,7 @@ */ #include "browser.h" -#include "src/mainwindow/mainwindow.h" +#include "mainwindow/mainwindow.h" #include "webengine/urlinterceptor.h" #include #include diff --git a/src/browser.h b/src/browser.h index cc4cbb8..2b9317d 100644 --- a/src/browser.h +++ b/src/browser.h @@ -15,7 +15,7 @@ #include #include #include "webengine/cookieinterceptor.h" -#include +#include "../plugins/interfaces.h" class MainWindow; class BookmarksWidget; diff --git a/src/main.cpp b/src/main.cpp index 6efb882..dfaad50 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,7 +8,7 @@ #include "browser.h" #include "commandline.h" -#include "src/mainwindow/mainwindow.h" +#include "mainwindow/mainwindow.h" #include "version.h" #include #include diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp index 2d7ba09..e280fee 100644 --- a/src/mainwindow/mainwindow.cpp +++ b/src/mainwindow/mainwindow.cpp @@ -8,15 +8,15 @@ #include "mainwindow.h" #include "forms/aboutdialog.h" -#include "src/mainwindow/widgets/searchform.h" +#include "mainwindow/widgets/searchform.h" #include "ui_mainwindow.h" #include "widgets/mainwindowmenubar.h" #include #include #include #include -#include -#include +#include "addressbar/urllineedit.h" +#include //#include MainWindow::MainWindow(std::shared_ptr config, QWidget *parent) diff --git a/src/mainwindow/widgets/searchform.cpp b/src/mainwindow/widgets/searchform.cpp index 08d4470..afbde98 100644 --- a/src/mainwindow/widgets/searchform.cpp +++ b/src/mainwindow/widgets/searchform.cpp @@ -7,7 +7,7 @@ */ #include "searchform.h" -#include "src/mainwindow/mainwindow.h" +#include "mainwindow/mainwindow.h" #include "ui_searchform.h" SearchForm::SearchForm(MainWindow *parentWindow, QWidget *parent) diff --git a/src/webengine/webview.cpp b/src/webengine/webview.cpp index 9cf0157..0b0a9e3 100644 --- a/src/webengine/webview.cpp +++ b/src/webengine/webview.cpp @@ -27,11 +27,11 @@ #include #include -#include "src/mainwindow/mainwindow.h" +#include "mainwindow/mainwindow.h" #include // ssl errors -#include "src/addressbar/urllineedit.h" +#include "addressbar/urllineedit.h" WebView::WebView(MainWindow *parentMainWindow, QWidget *parent) : QWebEngineView(parent) diff --git a/src/widgets/mainwindowmenubar.cpp b/src/widgets/mainwindowmenubar.cpp index 3c5b042..4aa6cc8 100644 --- a/src/widgets/mainwindowmenubar.cpp +++ b/src/widgets/mainwindowmenubar.cpp @@ -9,7 +9,7 @@ #include "mainwindowmenubar.h" #include "browser.h" #include "downloads/downloadswidget.h" -#include "src/mainwindow/mainwindow.h" +#include "mainwindow/mainwindow.h" #include MainWindowMenuBar::MainWindowMenuBar(std::shared_ptr config, MainWindow *parent) diff --git a/src/widgets/mainwindowtabbar.cpp b/src/widgets/mainwindowtabbar.cpp index 007a2d1..114b0e3 100644 --- a/src/widgets/mainwindowtabbar.cpp +++ b/src/widgets/mainwindowtabbar.cpp @@ -7,8 +7,8 @@ */ #include "mainwindowtabbar.h" -#include "src/configuration.h" -#include "src/mainwindow/mainwindow.h" +#include "configuration.h" +#include "mainwindow/mainwindow.h" #include #include #include -- cgit v1.2.1