diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d705b5..5c04967 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,58 +1,65 @@ -project(nota) cmake_minimum_required(VERSION 3.0) +set(NOTA_VERSION 1.0.0) +project(nota VERSION ${NOTA_VERSION}) find_package(ECM 1.7.0 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${ECM_MODULE_PATH}) find_package(MauiKit REQUIRED) find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Qml Quick Sql Svg QuickControls2 Widgets Xml) find_package(KF5 ${KF5_VERSION} REQUIRED COMPONENTS I18n Notifications Config KIO Attica SyntaxHighlighting) include(KDEInstallDirs) include(KDECompilerSettings NO_POLICY_SCOPE) include(KDECMakeSettings) include(ECMInstallIcons) -include(FeatureSummary) include(ECMAddAppIcon) +include(ECMSetupVersion) +include(FeatureSummary) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTORCC ON) set(nota_SRCS src/main.cpp src/models/documentsmodel.cpp ) set(nota_HDRS src/models/documentsmodel.h ) set(nota_ASSETS src/qml.qrc src/assets/img_assets.qrc ) add_executable(nota ${nota_SRCS} ${nota_HDRS} ${nota_ASSETS} ) +ecm_setup_version(${NOTA_VERSION} + VARIABLE_PREFIX NOTA + VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/nota_version.h" + ) + if (ANDROID) find_package(Qt5 REQUIRED COMPONENTS AndroidExtras WebView) target_link_libraries(nota MauiKit Qt5::AndroidExtras) else() find_package(Qt5 REQUIRED COMPONENTS WebEngine) endif() target_link_libraries(nota MauiKit Qt5::Sql Qt5::Qml Qt5::Widgets Qt5::Svg KF5::ConfigCore KF5::Notifications KF5::KIOCore KF5::I18n KF5::Attica) install(TARGETS nota ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) install(FILES org.kde.nota.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) #TODO: port to ecm_install_icons() # install(FILES assets/pix.svg DESTINATION ${KDE_INSTALL_ICONDIR}/hicolor/scalable/apps) # install(FILES org.kde.pix.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/main.cpp b/src/main.cpp index c7af893..18094cf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,55 +1,59 @@ #include #include #include + +#include "nota_version.h" + #ifdef Q_OS_ANDROID #include #else #include #endif #ifdef STATIC_KIRIGAMI #include "3rdparty/kirigami/src/kirigamiplugin.h" #endif #ifdef STATIC_MAUIKIT #include "3rdparty/mauikit/src/mauikit.h" #endif #include "src/models/documentsmodel.h" Q_DECL_EXPORT int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #ifdef Q_OS_ANDROID QGuiApplication app(argc, argv); if (!MAUIAndroid::checkRunTimePermissions()) return -1; #else QApplication app(argc, argv); #endif app.setApplicationName("nota"); - app.setApplicationVersion("1.0"); - app.setApplicationDisplayName("Nota"); + app.setApplicationVersion(NOTA_VERSION_STRING); + app.setApplicationDisplayName("Nota"); app.setOrganizationName("Maui"); app.setOrganizationDomain("org.maui.nota"); + app.setWindowIcon(QIcon(":/nota.svg")); #ifdef STATIC_KIRIGAMI KirigamiPlugin::getInstance().registerTypes(); #endif #ifdef STATIC_MAUIKIT MauiKit::getInstance().registerTypes(); #endif qmlRegisterType ("org.maui.nota", 1, 0, "Documents"); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); if (engine.rootObjects().isEmpty()) return -1; return app.exec(); }