diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,9 +50,9 @@ set (OPT_KF5_COMPONENTS DocTools Holidays Contacts Akonadi IdentityManagement Activities) find_package(Gpgmepp) if (Gpgmepp_FOUND) - set(GPG_ENCRYPTION ON) + set(GPG_FOUND TRUE) else() - set(GPG_ENCRYPTION OFF) + set(GPG_FOUND FALSE) list(APPEND OPT_KF5_COMPONENTS Gpgmepp) endif() @@ -75,14 +75,16 @@ # include_directories(${GMP_INCLUDE_DIR}) #endif() -find_package(KChart 2.6.0 REQUIRED) +find_package(KChart 2.6.0) if(KF5Gpgmepp_FOUND) - set(GPG_ENCRYPTION ON) - add_definitions(-DGpgmepp_FOUND) + set(GPG_FOUND TRUE) endif() -add_feature_info("Encryption" GPG_ENCRYPTION "It allows encrypting your financial data.") +cmake_dependent_option(ENABLE_GPG "Enable GPG support." ON + "GPG_FOUND" OFF) + +add_feature_info("Encryption" ENABLE_GPG "It allows encrypting your financial data.") add_definitions(-DQT_USE_QSTRINGBUILDER -DQT_NO_CAST_TO_ASCII -DQT_NO_URL_CAST_FROM_STRING) set(CMAKE_CXX_STANDARD 14) @@ -130,16 +132,23 @@ set(QT_INSTALL_DIR ${QT_DIR} CACHE PATH "Qt install prefix defaults to the Qt prefix: ${QT_DIR}") -if(KF5IdentityManagement_FOUND AND KF5Akonadi_FOUND AND KF5Contacts_FOUND) - set(KMM_ADDRESSBOOK_FOUND true) -endif() +cmake_dependent_option(ENABLE_ADDRESSBOOK "Enable addressbook support." ON + "KF5IdentityManagement_FOUND;KF5Akonadi_FOUND;KF5Contacts_FOUND" OFF) + +add_feature_info("Address book" ENABLE_ADDRESSBOOK "It allows fetching payee information from KDE PIM system.") + +cmake_dependent_option(ENABLE_HOLIDAYS "Enable addressbook support." ON + "KF5Holidays_FOUND" OFF) + +add_feature_info("Holidays" ENABLE_HOLIDAYS "It allows fetching holidays from KDE PIM system.") -add_feature_info("Address book" KMM_ADDRESSBOOK_FOUND "It allows fetching payee information from KDE PIM system.") -add_feature_info("Holidays" KF5Holidays_FOUND "It allows fetching holidays from KDE PIM system.") +cmake_dependent_option(ENABLE_ACTIVITIES "Enable activities support." ON + "KF5Activities_FOUND" OFF) option(ENABLE_FORECASTVIEW "Enable forecast view" ON) add_feature_info("Forecast view" ENABLE_FORECASTVIEW "It adds possibility to calculate forecasts.") -option(ENABLE_REPORTSVIEW "Enable reports view" ON) +cmake_dependent_option(ENABLE_REPORTSVIEW "Enable reports view." ON + "KChart_FOUND" OFF) add_feature_info("Reports view" ENABLE_REPORTSVIEW "It adds possibility to display chart and table reports.") option(ENABLE_BUDGETVIEW "Enable budget view" ON) add_feature_info("Budget view" ENABLE_BUDGETVIEW "It adds possibility to plan a budget.") diff --git a/config-kmymoney.h.cmake b/config-kmymoney.h.cmake --- a/config-kmymoney.h.cmake +++ b/config-kmymoney.h.cmake @@ -7,16 +7,16 @@ #cmakedefine KMM_DBUS 1 -#cmakedefine KF5Holidays_FOUND 1 +#cmakedefine ENABLE_HOLIDAYS 1 -#cmakedefine Gpgmepp_FOUND 1 +#cmakedefine ENABLE_ADDRESSBOOK 1 -#cmakedefine KMM_ADDRESSBOOK_FOUND 1 - -#cmakedefine KF5Activities_FOUND 1 +#cmakedefine ENABLE_ACTIVITIES 1 #cmakedefine ENABLE_WEBENGINE 1 #cmakedefine ENABLE_UNFINISHEDFEATURES 1 #cmakedefine ENABLE_SQLCIPHER 1 + +#cmakedefine ENABLE_GPG 1 diff --git a/kmymoney/CMakeLists.txt b/kmymoney/CMakeLists.txt --- a/kmymoney/CMakeLists.txt +++ b/kmymoney/CMakeLists.txt @@ -152,15 +152,12 @@ interfaces kmm_plugin Qt5::Core - KF5::Archive KF5::ConfigGui KF5::WidgetsAddons - KF5::KIOCore KF5::CoreAddons - KChart $<$:Qt5::Test> - $<$:KF5::Holidays> - $<$:KF5::Activities> + $<$:KF5::Holidays> + $<$:KF5::Activities> PRIVATE $<$:sqlcipher> ) diff --git a/kmymoney/dialogs/CMakeLists.txt b/kmymoney/dialogs/CMakeLists.txt --- a/kmymoney/dialogs/CMakeLists.txt +++ b/kmymoney/dialogs/CMakeLists.txt @@ -76,7 +76,6 @@ target_link_libraries(dialogs PUBLIC - KChart KF5::ItemViews KF5::I18n KF5::TextWidgets diff --git a/kmymoney/dialogs/settings/CMakeLists.txt b/kmymoney/dialogs/settings/CMakeLists.txt --- a/kmymoney/dialogs/settings/CMakeLists.txt +++ b/kmymoney/dialogs/settings/CMakeLists.txt @@ -40,7 +40,7 @@ Alkimia::alkimia ) -if (KF5Holidays_FOUND) +if (ENABLE_HOLIDAYS) target_link_libraries(settings PUBLIC KF5::Holidays) endif() diff --git a/kmymoney/dialogs/settings/ksettingsschedules.cpp b/kmymoney/dialogs/settings/ksettingsschedules.cpp --- a/kmymoney/dialogs/settings/ksettingsschedules.cpp +++ b/kmymoney/dialogs/settings/ksettingsschedules.cpp @@ -27,7 +27,7 @@ // KDE Includes #include -#ifdef KF5Holidays_FOUND +#ifdef ENABLE_HOLIDAYS #include #include using namespace KHolidays; @@ -86,7 +86,7 @@ { Q_D(KSettingsSchedules); QStringList regions; -#ifdef KF5Holidays_FOUND +#ifdef ENABLE_HOLIDAYS QStringList regionCodes = HolidayRegion::regionCodes(); foreach (const QString ®ionCode, regionCodes) { diff --git a/kmymoney/kcreditswindow.cpp b/kmymoney/kcreditswindow.cpp --- a/kmymoney/kcreditswindow.cpp +++ b/kmymoney/kcreditswindow.cpp @@ -37,13 +37,13 @@ if (!aboutData.homepage().isEmpty()) return aboutData; QStringList features; -#ifdef Gpgmepp_FOUND +#ifdef ENABLE_GPG features << i18n("GPG encryption"); #endif -#ifdef KMM_ADDRESSBOOK_FOUND +#ifdef ENABLE_ADDRESSBOOK features << i18n("Addressbook integration"); #endif -#ifdef KF5Holidays_FOUND +#ifdef ENABLE_HOLIDAYS features << i18n("Holiday regions integration"); #endif diff --git a/kmymoney/kmymoney.cpp b/kmymoney/kmymoney.cpp --- a/kmymoney/kmymoney.cpp +++ b/kmymoney/kmymoney.cpp @@ -67,15 +67,12 @@ #include #include #include -#include -#include -#include #include -#ifdef KF5Holidays_FOUND +#ifdef ENABLE_HOLIDAYS #include #include #endif -#ifdef KF5Activities_FOUND +#ifdef ENABLE_ACTIVITIES #include #endif @@ -220,10 +217,10 @@ m_autoSavePeriod(0), m_inAutoSaving(false), m_recentFiles(nullptr), -#ifdef KF5Holidays_FOUND +#ifdef ENABLE_HOLIDAYS m_holidayRegion(nullptr), #endif -#ifdef KF5Activities_FOUND +#ifdef ENABLE_ACTIVITIES m_activityResourceInstance(nullptr), #endif m_applicationIsReady(true), @@ -312,12 +309,12 @@ KRecentFilesAction* m_recentFiles; -#ifdef KF5Holidays_FOUND +#ifdef ENABLE_HOLIDAYS // used by the calendar interface for schedules KHolidays::HolidayRegion* m_holidayRegion; #endif -#ifdef KF5Activities_FOUND +#ifdef ENABLE_ACTIVITIES KActivities::ResourceInstance * m_activityResourceInstance; #endif @@ -1201,7 +1198,7 @@ connect(d->m_myMoneyView, &KMyMoneyView::statusProgress, this, &KMyMoneyApp::slotStatusProgressBar); // Initialize kactivities resource instance -#ifdef KF5Activities_FOUND +#ifdef ENABLE_ACTIVITIES d->m_activityResourceInstance = new KActivities::ResourceInstance(window()->winId(), this); #endif @@ -1264,11 +1261,11 @@ KMyMoneyPlugin::pluginHandling(KMyMoneyPlugin::Action::Unload, pPlugins, this, guiFactory()); d->removeStorage(); -#ifdef KF5Holidays_FOUND +#ifdef ENABLE_HOLIDAYS delete d->m_holidayRegion; #endif -#ifdef KF5Activities_FOUND +#ifdef ENABLE_ACTIVITIES delete d->m_activityResourceInstance; #endif @@ -3260,7 +3257,7 @@ void KMyMoneyApp::setHolidayRegion(const QString& holidayRegion) { -#ifdef KF5Holidays_FOUND +#ifdef ENABLE_HOLIDAYS //since the cost of updating the cache is now not negligible //check whether the region has been modified if (!d->m_holidayRegion || d->m_holidayRegion->regionCode() != holidayRegion) { @@ -3281,7 +3278,7 @@ { if (!d->m_processingDays.testBit(date.dayOfWeek())) return false; -#ifdef KF5Holidays_FOUND +#ifdef ENABLE_HOLIDAYS if (!d->m_holidayRegion || !d->m_holidayRegion->isValid()) return true; @@ -3300,7 +3297,7 @@ void KMyMoneyApp::preloadHolidays() { -#ifdef KF5Holidays_FOUND +#ifdef ENABLE_HOLIDAYS //clear the cache before loading d->m_holidayMap.clear(); //only do this if it is a valid region @@ -3637,7 +3634,7 @@ onlineJobAdministration::instance()->updateOnlineTaskProperties(); q->connect(MyMoneyFile::instance(), &MyMoneyFile::dataChanged, q, &KMyMoneyApp::slotDataChanged); -#ifdef KF5Activities_FOUND +#ifdef ENABLE_ACTIVITIES m_activityResourceInstance->setUri(m_storageInfo.url); #endif break; diff --git a/kmymoney/mymoney/CMakeLists.txt b/kmymoney/mymoney/CMakeLists.txt --- a/kmymoney/mymoney/CMakeLists.txt +++ b/kmymoney/mymoney/CMakeLists.txt @@ -96,7 +96,7 @@ onlinetask_interfaces ) -if(KMM_ADDRESSBOOK_FOUND) +if(ENABLE_ADDRESSBOOK) target_link_libraries(kmm_mymoney PUBLIC KF5::IdentityManagement KF5::AkonadiCore KF5::Contacts) endif() diff --git a/kmymoney/mymoney/mymoneycontact.cpp b/kmymoney/mymoney/mymoneycontact.cpp --- a/kmymoney/mymoney/mymoneycontact.cpp +++ b/kmymoney/mymoney/mymoneycontact.cpp @@ -19,7 +19,7 @@ #include "mymoneycontact.h" -#ifdef KMM_ADDRESSBOOK_FOUND +#ifdef ENABLE_ADDRESSBOOK #include #include #include @@ -35,7 +35,7 @@ bool MyMoneyContact::ownerExists() const { -#ifdef KMM_ADDRESSBOOK_FOUND +#ifdef ENABLE_ADDRESSBOOK KIdentityManagement::IdentityManager im; KIdentityManagement::Identity id = im.defaultIdentity(); return !id.isNull(); @@ -46,7 +46,7 @@ QString MyMoneyContact::ownerEmail() const { -#ifdef KMM_ADDRESSBOOK_FOUND +#ifdef ENABLE_ADDRESSBOOK KIdentityManagement::IdentityManager im; KIdentityManagement::Identity id = im.defaultIdentity(); return id.primaryEmailAddress(); @@ -57,7 +57,7 @@ QString MyMoneyContact::ownerFullName() const { -#ifdef KMM_ADDRESSBOOK_FOUND +#ifdef ENABLE_ADDRESSBOOK KIdentityManagement::IdentityManager im; KIdentityManagement::Identity id = im.defaultIdentity(); return id.fullName(); @@ -68,7 +68,7 @@ void MyMoneyContact::fetchContact(const QString &email) { -#ifdef KMM_ADDRESSBOOK_FOUND +#ifdef ENABLE_ADDRESSBOOK QRegularExpression re(".+@.+"); if (!re.match(email).hasMatch()) { ContactData contact; @@ -91,7 +91,7 @@ void MyMoneyContact::searchContactResult(KJob *job) { -#ifdef KMM_ADDRESSBOOK_FOUND +#ifdef ENABLE_ADDRESSBOOK const Akonadi::RecursiveItemFetchJob *contactJob = qobject_cast(job); Akonadi::Item::List items; if (contactJob) diff --git a/kmymoney/plugins/xml/libkgpgfile/CMakeLists.txt b/kmymoney/plugins/xml/libkgpgfile/CMakeLists.txt --- a/kmymoney/plugins/xml/libkgpgfile/CMakeLists.txt +++ b/kmymoney/plugins/xml/libkgpgfile/CMakeLists.txt @@ -5,7 +5,7 @@ add_library(kgpgfile STATIC ${kgpgfile_STAT_SRCS}) target_link_libraries(kgpgfile PUBLIC Qt5::Core) -if(Gpgmepp_FOUND OR KF5Gpgmepp_FOUND) +if(ENABLE_GPG) if(WIN32) find_package(KDEWin REQUIRED) target_include_directories(kgpgfile PUBLIC ${KDEWIN_INCLUDES}) diff --git a/kmymoney/plugins/xml/libkgpgfile/kgpgfile.cpp b/kmymoney/plugins/xml/libkgpgfile/kgpgfile.cpp --- a/kmymoney/plugins/xml/libkgpgfile/kgpgfile.cpp +++ b/kmymoney/plugins/xml/libkgpgfile/kgpgfile.cpp @@ -37,7 +37,7 @@ // ---------------------------------------------------------------------------- // KDE Includes -#ifdef Gpgmepp_FOUND +#ifdef ENABLE_GPG #include #include #include @@ -378,7 +378,7 @@ } } -#else // not Gpgmepp_FOUND +#else // not ENABLE_GPG // NOOP implementation KGPGFile::KGPGFile(const QString& fn, const QString& homedir, const QString& options) : d(0) diff --git a/kmymoney/views/CMakeLists.txt b/kmymoney/views/CMakeLists.txt --- a/kmymoney/views/CMakeLists.txt +++ b/kmymoney/views/CMakeLists.txt @@ -62,7 +62,7 @@ add_library(views STATIC ${libviews_a_SOURCES}) -target_link_libraries(views PUBLIC newaccountwizard KChart KF5::KIOFileWidgets KF5::Notifications KF5::Archive KF5::TextWidgets Qt5::PrintSupport Alkimia::alkimia) +target_link_libraries(views PUBLIC newaccountwizard KF5::TextWidgets Qt5::PrintSupport) if(ENABLE_WEBENGINE) target_link_libraries(views PUBLIC Qt5::WebEngineWidgets) diff --git a/kmymoney/views/khomeview_p.h b/kmymoney/views/khomeview_p.h --- a/kmymoney/views/khomeview_p.h +++ b/kmymoney/views/khomeview_p.h @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #ifdef ENABLE_WEBENGINE @@ -51,8 +52,6 @@ // ---------------------------------------------------------------------------- // KDE Includes -#include -#include #include #include #include diff --git a/kmymoney/views/kmymoneyview.h b/kmymoney/views/kmymoneyview.h --- a/kmymoney/views/kmymoneyview.h +++ b/kmymoney/views/kmymoneyview.h @@ -34,7 +34,7 @@ // Project Includes #include "selectedtransactions.h" -#ifdef KF5Activities_FOUND +#ifdef ENABLE_ACTIVITIES namespace KActivities { class ResourceInstance; diff --git a/kmymoney/views/kmymoneyview.cpp b/kmymoney/views/kmymoneyview.cpp --- a/kmymoney/views/kmymoneyview.cpp +++ b/kmymoney/views/kmymoneyview.cpp @@ -42,7 +42,6 @@ #include #include -#include #include #include #include diff --git a/kmymoney/views/kpayeesview_p.h b/kmymoney/views/kpayeesview_p.h --- a/kmymoney/views/kpayeesview_p.h +++ b/kmymoney/views/kpayeesview_p.h @@ -190,7 +190,7 @@ ui->m_updateButton->setEnabled(false); ui->m_syncAddressbook->setEnabled(false); - #ifndef KMM_ADDRESSBOOK_FOUND + #ifndef ENABLE_ADDRESSBOOK ui->m_syncAddressbook->hide(); #endif ui->matchTypeCombo->setCurrentIndex(0); diff --git a/packaging/linux/appimage/build-kmymoney.sh b/packaging/linux/appimage/build-kmymoney.sh --- a/packaging/linux/appimage/build-kmymoney.sh +++ b/packaging/linux/appimage/build-kmymoney.sh @@ -37,9 +37,21 @@ # Configure KMyMoney cmake $KMYMONEY_SOURCES \ -DCMAKE_INSTALL_PREFIX:PATH=$BUILD_PREFIX/kmymoney.appdir/usr \ - -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DBUILD_TESTING=FALSE \ - -DENABLE_WEBENGINE=TRUE + -DENABLE_WEBENGINE=TRUE \ + -DENABLE_SQLCIPHER=FALSE \ + -DENABLE_SQLSTORAGE=FALSE \ + -DENABLE_KBANKING=FALSE \ + -DENABLE_ONLINEJOBOUTBOXVIEW=FALSE \ + -DENABLE_OFXIMPORTER=FALSE \ + -DENABLE_ADDRESSBOOK=FALSE \ + -DENABLE_HOLIDAYS=FALSE \ + -DENABLE_ACTIVITIES=FALSE \ + -DENABLE_FORECASTVIEW=FALSE \ + -DENABLE_REPORTSVIEW=FALSE \ + -DENABLE_BUDGETVIEW=FALSE \ + -DENABLE_GPG=FALSE # Build and Install KMyMoney (ready for the next phase) make -j$CPU_COUNT install