From 0c32af27e7e54e295d5aac02c698a5d72c298612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kubern=C3=A1t?= Date: Fri, 24 Nov 2023 22:52:53 +0100 Subject: [PATCH 1/5] Allow building with local necrolog --- 3rdparty/necrolog | 2 +- CMakeLists.txt | 6 +++++- libshvchainpack/CMakeLists.txt | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/3rdparty/necrolog b/3rdparty/necrolog index 549f35493..91f80caf7 160000 --- a/3rdparty/necrolog +++ b/3rdparty/necrolog @@ -1 +1 @@ -Subproject commit 549f35493eef9fb77f38b096eecd6c16ba66df32 +Subproject commit 91f80caf70febcfde95e7f518d5975f841a1b171 diff --git a/CMakeLists.txt b/CMakeLists.txt index ba2c951e4..2b3a03b2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,7 +72,11 @@ if(BUILD_TESTING) endif() if (NOT TARGET libnecrolog) - add_subdirectory(3rdparty/necrolog) + if(LIBSHV_USE_LOCAL_NECROLOG) + find_package(necrolog REQUIRED) + else() + add_subdirectory(3rdparty/necrolog) + endif() endif() function(check_shv_dep dependent dependent_var dependency dependency_var) diff --git a/libshvchainpack/CMakeLists.txt b/libshvchainpack/CMakeLists.txt index cae5c8f1c..44c3dc719 100644 --- a/libshvchainpack/CMakeLists.txt +++ b/libshvchainpack/CMakeLists.txt @@ -26,7 +26,7 @@ if (NOT WIN32) target_sources(libshvchainpack-cpp PRIVATE src/chainpack/socketrpcdriver.cpp) endif() -target_link_libraries(libshvchainpack-cpp libnecrolog libshvchainpack-c) +target_link_libraries(libshvchainpack-cpp libnecrolog::libnecrolog libshvchainpack-c) target_include_directories(libshvchainpack-cpp PUBLIC include) target_compile_definitions(libshvchainpack-cpp PRIVATE SHVCHAINPACK_BUILD_DLL) From eb5a8f4ad25fc7b19aa5b6bcb25594096e7e520f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kubern=C3=A1t?= Date: Sat, 25 Nov 2023 02:59:48 +0100 Subject: [PATCH 2/5] libshvvisu: Put includes directly into include/ Not sure how I missed those, but oh well. --- libshvvisu/include/shv/visu/errorlogmodel.h | 35 ++++++++- .../include/shv/visu/logtablemodelbase.h | 45 +++++++++++- libshvvisu/include/shv/visu/logwidget.h | 71 ++++++++++++++++++- .../include/shv/visu/timezonecombobox.h | 29 +++++++- libshvvisu/src/logwidget/errorlogmodel.cpp | 2 +- libshvvisu/src/logwidget/errorlogmodel.h | 34 --------- .../src/logwidget/logtablemodelbase.cpp | 2 +- libshvvisu/src/logwidget/logtablemodelbase.h | 44 ------------ libshvvisu/src/logwidget/logwidget.cpp | 4 +- libshvvisu/src/logwidget/logwidget.h | 70 ------------------ libshvvisu/src/logwidget/logwidget.ui | 2 +- libshvvisu/src/widgets/timezonecombobox.cpp | 2 +- libshvvisu/src/widgets/timezonecombobox.h | 28 -------- 13 files changed, 182 insertions(+), 186 deletions(-) delete mode 100644 libshvvisu/src/logwidget/errorlogmodel.h delete mode 100644 libshvvisu/src/logwidget/logtablemodelbase.h delete mode 100644 libshvvisu/src/logwidget/logwidget.h delete mode 100644 libshvvisu/src/widgets/timezonecombobox.h diff --git a/libshvvisu/include/shv/visu/errorlogmodel.h b/libshvvisu/include/shv/visu/errorlogmodel.h index dae57fb14..6a461c8a7 100644 --- a/libshvvisu/include/shv/visu/errorlogmodel.h +++ b/libshvvisu/include/shv/visu/errorlogmodel.h @@ -1 +1,34 @@ -#include "../../../src/logwidget/errorlogmodel.h" +#pragma once + +#include + +#include + +#include + +namespace shv { +namespace visu { + +class SHVVISU_DECL_EXPORT ErrorLogModel : public LogTableModelBase +{ + Q_OBJECT + + using Super = LogTableModelBase; +public: + ErrorLogModel(QObject *parent = nullptr); + + enum Cols {Level, TimeStamp, Message, UserData, Count}; + + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; + int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; + + QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; + + NecroLogLevel level(int row) const; + + void addLogRow(NecroLogLevel level, const std::string &msg, const QVariant &user_data = QVariant()); + +}; + +}} + diff --git a/libshvvisu/include/shv/visu/logtablemodelbase.h b/libshvvisu/include/shv/visu/logtablemodelbase.h index ff1582fef..ef25087c4 100644 --- a/libshvvisu/include/shv/visu/logtablemodelbase.h +++ b/libshvvisu/include/shv/visu/logtablemodelbase.h @@ -1 +1,44 @@ -#include "../../../src/logwidget/logtablemodelbase.h" +#pragma once + +#include + +#include + +#include + +namespace shv { +namespace visu { + +class SHVVISU_DECL_EXPORT LogTableModelRow : public QVector +{ +public: + explicit LogTableModelRow(int size = 0); +}; + +class SHVVISU_DECL_EXPORT LogTableModelBase : public QAbstractTableModel +{ + Q_OBJECT +private: + typedef QAbstractTableModel Super; +public: + LogTableModelBase(QObject *parent = nullptr); + + enum class Direction {AppendToTop, AppendToBottom}; + + SHV_PROPERTY_IMPL2(Direction, d, D, irection, Direction::AppendToBottom) + SHV_PROPERTY_IMPL2(int, m, M, aximumRowCount, 1000) + + int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; + QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; + + void clear(); + LogTableModelRow rowAt(int row) const; + void addLogRow(const LogTableModelRow &row); + Q_SIGNAL void logRowInserted(int row_no); +protected: + QList m_rows; +}; + +}} + + diff --git a/libshvvisu/include/shv/visu/logwidget.h b/libshvvisu/include/shv/visu/logwidget.h index de83302b9..21b58517e 100644 --- a/libshvvisu/include/shv/visu/logwidget.h +++ b/libshvvisu/include/shv/visu/logwidget.h @@ -1 +1,70 @@ -#include "../../../src/logwidget/logwidget.h" +#pragma once + +#include + +#include + +#include + +class QAbstractButton; + +namespace shv { +namespace visu { + +class LogFilterProxyModel; +class LogTableModelRow; +class LogTableModelBase; + +namespace Ui { +class LogWidget; +} + +class LogWidgetTableView : public QTableView +{ + Q_OBJECT +private: + typedef QTableView Super; +public: + LogWidgetTableView(QWidget *parent); + + void copy(); +protected: + void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE; +}; + +class SHVVISU_DECL_EXPORT LogWidget : public QWidget +{ + Q_OBJECT +private: + typedef QWidget Super; +public: + explicit LogWidget(QWidget *parent = nullptr); + ~LogWidget(); + + Q_SLOT void addLogRow(const LogTableModelRow &row); + Q_SLOT void scrollToLastRow(); + + void clear(); + virtual void setLogTableModel(LogTableModelBase *m); + LogTableModelBase* logTableModel(); + QTableView* tableView() const; + +protected: + QAbstractButton* tableMenuButton(); + + void onVerticalScrollBarValueChanged(); +private: + Q_SLOT void filterStringChanged(const QString &filter_string); + Q_SLOT void btClearLog_clicked(); + Q_SLOT void btResizeColumns_clicked(); +protected: + LogTableModelBase* m_logTableModel = nullptr; + LogFilterProxyModel* m_filterModel = nullptr; +private: + Ui::LogWidget *ui; + bool m_columnsResized = false; + bool m_isAutoScroll = true; +}; + +}} + diff --git a/libshvvisu/include/shv/visu/timezonecombobox.h b/libshvvisu/include/shv/visu/timezonecombobox.h index a09b0e221..352c23464 100644 --- a/libshvvisu/include/shv/visu/timezonecombobox.h +++ b/libshvvisu/include/shv/visu/timezonecombobox.h @@ -1 +1,28 @@ -#include "../../../src/widgets/timezonecombobox.h" +#pragma once + +#include + +#include + +class QTimeZone; + +namespace shv { +namespace visu { + +class SHVVISU_DECL_EXPORT TimeZoneComboBox : public QComboBox +{ + using Super = QComboBox; +public: + TimeZoneComboBox(QWidget *parent = nullptr); + +#if SHVVISU_HAS_TIMEZONE + QTimeZone currentTimeZone() const; +protected: + void keyPressEvent(QKeyEvent *event) override; +private: + QString m_searchText; +#endif +}; + +}} + diff --git a/libshvvisu/src/logwidget/errorlogmodel.cpp b/libshvvisu/src/logwidget/errorlogmodel.cpp index 1ace61c57..a4640462f 100644 --- a/libshvvisu/src/logwidget/errorlogmodel.cpp +++ b/libshvvisu/src/logwidget/errorlogmodel.cpp @@ -1,4 +1,4 @@ -#include "errorlogmodel.h" +#include #include diff --git a/libshvvisu/src/logwidget/errorlogmodel.h b/libshvvisu/src/logwidget/errorlogmodel.h deleted file mode 100644 index 6a461c8a7..000000000 --- a/libshvvisu/src/logwidget/errorlogmodel.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include - -#include - -#include - -namespace shv { -namespace visu { - -class SHVVISU_DECL_EXPORT ErrorLogModel : public LogTableModelBase -{ - Q_OBJECT - - using Super = LogTableModelBase; -public: - ErrorLogModel(QObject *parent = nullptr); - - enum Cols {Level, TimeStamp, Message, UserData, Count}; - - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; - int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; - - QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; - - NecroLogLevel level(int row) const; - - void addLogRow(NecroLogLevel level, const std::string &msg, const QVariant &user_data = QVariant()); - -}; - -}} - diff --git a/libshvvisu/src/logwidget/logtablemodelbase.cpp b/libshvvisu/src/logwidget/logtablemodelbase.cpp index a07880180..a9324d3ea 100644 --- a/libshvvisu/src/logwidget/logtablemodelbase.cpp +++ b/libshvvisu/src/logwidget/logtablemodelbase.cpp @@ -1,4 +1,4 @@ -#include "logtablemodelbase.h" +#include #include #include diff --git a/libshvvisu/src/logwidget/logtablemodelbase.h b/libshvvisu/src/logwidget/logtablemodelbase.h deleted file mode 100644 index ef25087c4..000000000 --- a/libshvvisu/src/logwidget/logtablemodelbase.h +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -#include - -#include - -#include - -namespace shv { -namespace visu { - -class SHVVISU_DECL_EXPORT LogTableModelRow : public QVector -{ -public: - explicit LogTableModelRow(int size = 0); -}; - -class SHVVISU_DECL_EXPORT LogTableModelBase : public QAbstractTableModel -{ - Q_OBJECT -private: - typedef QAbstractTableModel Super; -public: - LogTableModelBase(QObject *parent = nullptr); - - enum class Direction {AppendToTop, AppendToBottom}; - - SHV_PROPERTY_IMPL2(Direction, d, D, irection, Direction::AppendToBottom) - SHV_PROPERTY_IMPL2(int, m, M, aximumRowCount, 1000) - - int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; - QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; - - void clear(); - LogTableModelRow rowAt(int row) const; - void addLogRow(const LogTableModelRow &row); - Q_SIGNAL void logRowInserted(int row_no); -protected: - QList m_rows; -}; - -}} - - diff --git a/libshvvisu/src/logwidget/logwidget.cpp b/libshvvisu/src/logwidget/logwidget.cpp index 439b2cafe..82620bb05 100644 --- a/libshvvisu/src/logwidget/logwidget.cpp +++ b/libshvvisu/src/logwidget/logwidget.cpp @@ -1,7 +1,7 @@ -#include "logwidget.h" +#include #include "ui_logwidget.h" -#include "logtablemodelbase.h" +#include #include diff --git a/libshvvisu/src/logwidget/logwidget.h b/libshvvisu/src/logwidget/logwidget.h deleted file mode 100644 index 21b58517e..000000000 --- a/libshvvisu/src/logwidget/logwidget.h +++ /dev/null @@ -1,70 +0,0 @@ -#pragma once - -#include - -#include - -#include - -class QAbstractButton; - -namespace shv { -namespace visu { - -class LogFilterProxyModel; -class LogTableModelRow; -class LogTableModelBase; - -namespace Ui { -class LogWidget; -} - -class LogWidgetTableView : public QTableView -{ - Q_OBJECT -private: - typedef QTableView Super; -public: - LogWidgetTableView(QWidget *parent); - - void copy(); -protected: - void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE; -}; - -class SHVVISU_DECL_EXPORT LogWidget : public QWidget -{ - Q_OBJECT -private: - typedef QWidget Super; -public: - explicit LogWidget(QWidget *parent = nullptr); - ~LogWidget(); - - Q_SLOT void addLogRow(const LogTableModelRow &row); - Q_SLOT void scrollToLastRow(); - - void clear(); - virtual void setLogTableModel(LogTableModelBase *m); - LogTableModelBase* logTableModel(); - QTableView* tableView() const; - -protected: - QAbstractButton* tableMenuButton(); - - void onVerticalScrollBarValueChanged(); -private: - Q_SLOT void filterStringChanged(const QString &filter_string); - Q_SLOT void btClearLog_clicked(); - Q_SLOT void btResizeColumns_clicked(); -protected: - LogTableModelBase* m_logTableModel = nullptr; - LogFilterProxyModel* m_filterModel = nullptr; -private: - Ui::LogWidget *ui; - bool m_columnsResized = false; - bool m_isAutoScroll = true; -}; - -}} - diff --git a/libshvvisu/src/logwidget/logwidget.ui b/libshvvisu/src/logwidget/logwidget.ui index 707a25a2b..cf46151f1 100644 --- a/libshvvisu/src/logwidget/logwidget.ui +++ b/libshvvisu/src/logwidget/logwidget.ui @@ -130,7 +130,7 @@ LogWidgetTableView QTableView -
src/logwidget/logwidget.h
+
shv/visu/logwidget.h
diff --git a/libshvvisu/src/widgets/timezonecombobox.cpp b/libshvvisu/src/widgets/timezonecombobox.cpp index c165cee56..f5b3d3a4a 100644 --- a/libshvvisu/src/widgets/timezonecombobox.cpp +++ b/libshvvisu/src/widgets/timezonecombobox.cpp @@ -1,4 +1,4 @@ -#include "timezonecombobox.h" +#include #include #include diff --git a/libshvvisu/src/widgets/timezonecombobox.h b/libshvvisu/src/widgets/timezonecombobox.h deleted file mode 100644 index 352c23464..000000000 --- a/libshvvisu/src/widgets/timezonecombobox.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -#include - -#include - -class QTimeZone; - -namespace shv { -namespace visu { - -class SHVVISU_DECL_EXPORT TimeZoneComboBox : public QComboBox -{ - using Super = QComboBox; -public: - TimeZoneComboBox(QWidget *parent = nullptr); - -#if SHVVISU_HAS_TIMEZONE - QTimeZone currentTimeZone() const; -protected: - void keyPressEvent(QKeyEvent *event) override; -private: - QString m_searchText; -#endif -}; - -}} - From 7e883e61a96026fa53ca477a9ad4fb2137b2e055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kubern=C3=A1t?= Date: Sat, 25 Nov 2023 03:13:10 +0100 Subject: [PATCH 3/5] libshvchainpack/c: Move includes to include/ --- libshvchainpack/c/CMakeLists.txt | 2 +- libshvchainpack/c/cchainpack.c | 2 +- libshvchainpack/c/ccpcp.c | 2 +- libshvchainpack/c/ccpcp_convert.c | 4 ++-- libshvchainpack/c/ccpon.c | 2 +- .../c/{ => include/shv/chainpack}/cchainpack.h | 0 libshvchainpack/c/{ => include/shv/chainpack}/ccpcp.h | 0 .../c/{ => include/shv/chainpack}/ccpcp_convert.h | 0 libshvchainpack/c/{ => include/shv/chainpack}/ccpon.h | 0 .../c/{ => include/shv/chainpack}/pack_double.h | 0 libshvchainpack/c/tests/test_ccpcp.c | 8 ++++---- .../include/shv/chainpack/abstractstreamreader.h | 2 +- .../include/shv/chainpack/abstractstreamwriter.h | 2 +- libshvchainpack/include/shv/chainpack/chainpack.h | 2 +- libshvchainpack/src/chainpack/chainpackreader.cpp | 2 +- libshvchainpack/src/chainpack/chainpackwriter.cpp | 2 +- libshvchainpack/src/chainpack/cponreader.cpp | 2 +- libshvchainpack/src/chainpack/cponwriter.cpp | 2 +- libshvchainpack/src/chainpack/rpcvalue.cpp | 2 +- utils/ccp2cp/main.c | 6 +++--- 20 files changed, 21 insertions(+), 21 deletions(-) rename libshvchainpack/c/{ => include/shv/chainpack}/cchainpack.h (100%) rename libshvchainpack/c/{ => include/shv/chainpack}/ccpcp.h (100%) rename libshvchainpack/c/{ => include/shv/chainpack}/ccpcp_convert.h (100%) rename libshvchainpack/c/{ => include/shv/chainpack}/ccpon.h (100%) rename libshvchainpack/c/{ => include/shv/chainpack}/pack_double.h (100%) diff --git a/libshvchainpack/c/CMakeLists.txt b/libshvchainpack/c/CMakeLists.txt index 55de9ca78..976b8caff 100644 --- a/libshvchainpack/c/CMakeLists.txt +++ b/libshvchainpack/c/CMakeLists.txt @@ -4,7 +4,7 @@ add_library(libshvchainpack-c STATIC ccpcp_convert.c ccpon.c ) -target_include_directories(libshvchainpack-c PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_include_directories(libshvchainpack-c PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) function(add_shv_test test_name) add_executable(test_${test_name} diff --git a/libshvchainpack/c/cchainpack.c b/libshvchainpack/c/cchainpack.c index 8c0000e13..e2531bdf4 100644 --- a/libshvchainpack/c/cchainpack.c +++ b/libshvchainpack/c/cchainpack.c @@ -1,4 +1,4 @@ -#include "cchainpack.h" +#include #include #include diff --git a/libshvchainpack/c/ccpcp.c b/libshvchainpack/c/ccpcp.c index aa0ce14b8..c58de5add 100644 --- a/libshvchainpack/c/ccpcp.c +++ b/libshvchainpack/c/ccpcp.c @@ -1,4 +1,4 @@ -#include "ccpcp.h" +#include #include diff --git a/libshvchainpack/c/ccpcp_convert.c b/libshvchainpack/c/ccpcp_convert.c index 0f508a3ab..db10f5833 100644 --- a/libshvchainpack/c/ccpcp_convert.c +++ b/libshvchainpack/c/ccpcp_convert.c @@ -1,5 +1,5 @@ -#include "cchainpack.h" -#include "ccpon.h" +#include +#include #include diff --git a/libshvchainpack/c/ccpon.c b/libshvchainpack/c/ccpon.c index 9a3e2cfae..923430f82 100644 --- a/libshvchainpack/c/ccpon.c +++ b/libshvchainpack/c/ccpon.c @@ -1,4 +1,4 @@ -#include "ccpon.h" +#include #include #include diff --git a/libshvchainpack/c/cchainpack.h b/libshvchainpack/c/include/shv/chainpack/cchainpack.h similarity index 100% rename from libshvchainpack/c/cchainpack.h rename to libshvchainpack/c/include/shv/chainpack/cchainpack.h diff --git a/libshvchainpack/c/ccpcp.h b/libshvchainpack/c/include/shv/chainpack/ccpcp.h similarity index 100% rename from libshvchainpack/c/ccpcp.h rename to libshvchainpack/c/include/shv/chainpack/ccpcp.h diff --git a/libshvchainpack/c/ccpcp_convert.h b/libshvchainpack/c/include/shv/chainpack/ccpcp_convert.h similarity index 100% rename from libshvchainpack/c/ccpcp_convert.h rename to libshvchainpack/c/include/shv/chainpack/ccpcp_convert.h diff --git a/libshvchainpack/c/ccpon.h b/libshvchainpack/c/include/shv/chainpack/ccpon.h similarity index 100% rename from libshvchainpack/c/ccpon.h rename to libshvchainpack/c/include/shv/chainpack/ccpon.h diff --git a/libshvchainpack/c/pack_double.h b/libshvchainpack/c/include/shv/chainpack/pack_double.h similarity index 100% rename from libshvchainpack/c/pack_double.h rename to libshvchainpack/c/include/shv/chainpack/pack_double.h diff --git a/libshvchainpack/c/tests/test_ccpcp.c b/libshvchainpack/c/tests/test_ccpcp.c index beb4d73b1..386c04d18 100644 --- a/libshvchainpack/c/tests/test_ccpcp.c +++ b/libshvchainpack/c/tests/test_ccpcp.c @@ -1,8 +1,8 @@ #define _GNU_SOURCE -#include -#include -#include -#include +#include +#include +#include +#include #include #include diff --git a/libshvchainpack/include/shv/chainpack/abstractstreamreader.h b/libshvchainpack/include/shv/chainpack/abstractstreamreader.h index 786d6489d..f95592425 100644 --- a/libshvchainpack/include/shv/chainpack/abstractstreamreader.h +++ b/libshvchainpack/include/shv/chainpack/abstractstreamreader.h @@ -1,7 +1,7 @@ #pragma once #include -#include "../../../c/ccpcp.h" +#include #include diff --git a/libshvchainpack/include/shv/chainpack/abstractstreamwriter.h b/libshvchainpack/include/shv/chainpack/abstractstreamwriter.h index 7fadb653f..de09bd1c7 100644 --- a/libshvchainpack/include/shv/chainpack/abstractstreamwriter.h +++ b/libshvchainpack/include/shv/chainpack/abstractstreamwriter.h @@ -1,7 +1,7 @@ #pragma once #include -#include "../../../c/ccpcp.h" +#include #include diff --git a/libshvchainpack/include/shv/chainpack/chainpack.h b/libshvchainpack/include/shv/chainpack/chainpack.h index 751a427a6..d893d46f7 100644 --- a/libshvchainpack/include/shv/chainpack/chainpack.h +++ b/libshvchainpack/include/shv/chainpack/chainpack.h @@ -1,7 +1,7 @@ #pragma once #include "rpcvalue.h" -#include "../../../c/cchainpack.h" +#include namespace shv { namespace chainpack { diff --git a/libshvchainpack/src/chainpack/chainpackreader.cpp b/libshvchainpack/src/chainpack/chainpackreader.cpp index a7b0f2a1c..6f88a0400 100644 --- a/libshvchainpack/src/chainpack/chainpackreader.cpp +++ b/libshvchainpack/src/chainpack/chainpackreader.cpp @@ -1,6 +1,6 @@ #include #include -#include "../../c/cchainpack.h" +#include #include #include diff --git a/libshvchainpack/src/chainpack/chainpackwriter.cpp b/libshvchainpack/src/chainpack/chainpackwriter.cpp index a8f6916f1..391be8700 100644 --- a/libshvchainpack/src/chainpack/chainpackwriter.cpp +++ b/libshvchainpack/src/chainpack/chainpackwriter.cpp @@ -1,7 +1,7 @@ #include #include -#include "../../c/cchainpack.h" +#include #include #include diff --git a/libshvchainpack/src/chainpack/cponreader.cpp b/libshvchainpack/src/chainpack/cponreader.cpp index 9b9421425..7f471b5d6 100644 --- a/libshvchainpack/src/chainpack/cponreader.cpp +++ b/libshvchainpack/src/chainpack/cponreader.cpp @@ -1,6 +1,6 @@ #include #include -#include "../../c/ccpon.h" +#include #include #include diff --git a/libshvchainpack/src/chainpack/cponwriter.cpp b/libshvchainpack/src/chainpack/cponwriter.cpp index 9e79c88de..854bef602 100644 --- a/libshvchainpack/src/chainpack/cponwriter.cpp +++ b/libshvchainpack/src/chainpack/cponwriter.cpp @@ -1,7 +1,7 @@ #include #include -#include "../../c/ccpon.h" +#include #include #include diff --git a/libshvchainpack/src/chainpack/rpcvalue.cpp b/libshvchainpack/src/chainpack/rpcvalue.cpp index d4a4d0b67..d0b2338d2 100644 --- a/libshvchainpack/src/chainpack/rpcvalue.cpp +++ b/libshvchainpack/src/chainpack/rpcvalue.cpp @@ -7,7 +7,7 @@ #include #include -#include "../../c/ccpon.h" +#include #include diff --git a/utils/ccp2cp/main.c b/utils/ccp2cp/main.c index a3ec81156..753bc587d 100644 --- a/utils/ccp2cp/main.c +++ b/utils/ccp2cp/main.c @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include #include #include From 23b4f5d5084c70d647eaefbcceede4181a63f763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kubern=C3=A1t?= Date: Fri, 24 Nov 2023 23:05:11 +0100 Subject: [PATCH 4/5] cmake: Install headers --- libshvbroker/CMakeLists.txt | 1 + libshvchainpack/CMakeLists.txt | 1 + libshvchainpack/c/CMakeLists.txt | 1 + libshvcore/CMakeLists.txt | 1 + libshvcoreqt/CMakeLists.txt | 1 + libshviotqt/CMakeLists.txt | 1 + libshvvisu/CMakeLists.txt | 1 + 7 files changed, 7 insertions(+) diff --git a/libshvbroker/CMakeLists.txt b/libshvbroker/CMakeLists.txt index 44d9ce198..51a2d7eb5 100644 --- a/libshvbroker/CMakeLists.txt +++ b/libshvbroker/CMakeLists.txt @@ -61,3 +61,4 @@ if(BUILD_TESTING) endif() install(TARGETS libshvbroker) +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/shv" TYPE INCLUDE) diff --git a/libshvchainpack/CMakeLists.txt b/libshvchainpack/CMakeLists.txt index 44c3dc719..15741eac3 100644 --- a/libshvchainpack/CMakeLists.txt +++ b/libshvchainpack/CMakeLists.txt @@ -72,3 +72,4 @@ if(BUILD_TESTING) endif() install(TARGETS libshvchainpack-cpp) +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/shv" TYPE INCLUDE) diff --git a/libshvchainpack/c/CMakeLists.txt b/libshvchainpack/c/CMakeLists.txt index 976b8caff..e2c2e1ef4 100644 --- a/libshvchainpack/c/CMakeLists.txt +++ b/libshvchainpack/c/CMakeLists.txt @@ -19,3 +19,4 @@ if(BUILD_TESTING) endif() install(TARGETS libshvchainpack-c) +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/shv" TYPE INCLUDE) diff --git a/libshvcore/CMakeLists.txt b/libshvcore/CMakeLists.txt index 76b0514f3..da788d149 100644 --- a/libshvcore/CMakeLists.txt +++ b/libshvcore/CMakeLists.txt @@ -53,3 +53,4 @@ if(BUILD_TESTING) endif() install(TARGETS libshvcore) +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/shv" TYPE INCLUDE) diff --git a/libshvcoreqt/CMakeLists.txt b/libshvcoreqt/CMakeLists.txt index 6502e23d8..75fe64f17 100644 --- a/libshvcoreqt/CMakeLists.txt +++ b/libshvcoreqt/CMakeLists.txt @@ -35,3 +35,4 @@ if(BUILD_TESTING) endif() install(TARGETS libshvcoreqt) +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/shv" TYPE INCLUDE) diff --git a/libshviotqt/CMakeLists.txt b/libshviotqt/CMakeLists.txt index 0d94fc2b8..240fb0e4d 100644 --- a/libshviotqt/CMakeLists.txt +++ b/libshviotqt/CMakeLists.txt @@ -82,3 +82,4 @@ if(BUILD_TESTING) endif() install(TARGETS libshviotqt) +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/shv" TYPE INCLUDE) diff --git a/libshvvisu/CMakeLists.txt b/libshvvisu/CMakeLists.txt index d97a549f6..b3bba7173 100644 --- a/libshvvisu/CMakeLists.txt +++ b/libshvvisu/CMakeLists.txt @@ -65,3 +65,4 @@ target_include_directories(libshvvisu PUBLIC include) target_compile_definitions(libshvvisu PRIVATE SHVVISU_BUILD_DLL) install(TARGETS libshvvisu) +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/shv" TYPE INCLUDE) From a6a3e3a19544d07e31e4a725d9e871375263ac5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kubern=C3=A1t?= Date: Sat, 25 Nov 2023 02:30:08 +0100 Subject: [PATCH 5/5] cmake: Add config files --- libshvbroker/CMakeLists.txt | 13 ++++++++++--- libshvchainpack/CMakeLists.txt | 12 ++++++++++-- libshvchainpack/c/CMakeLists.txt | 9 +++++++-- libshvcore/CMakeLists.txt | 11 +++++++++-- libshvcoreqt/CMakeLists.txt | 12 ++++++++++-- libshviotqt/CMakeLists.txt | 12 ++++++++++-- libshvvisu/CMakeLists.txt | 11 +++++++++-- 7 files changed, 65 insertions(+), 15 deletions(-) diff --git a/libshvbroker/CMakeLists.txt b/libshvbroker/CMakeLists.txt index 51a2d7eb5..2154b5330 100644 --- a/libshvbroker/CMakeLists.txt +++ b/libshvbroker/CMakeLists.txt @@ -29,6 +29,7 @@ qt_add_library(libshvbroker include/shv/broker/clientconnectionnode.h include/shv/broker/groupmapping.h ) +add_library(libshv::libshvbroker ALIAS libshvbroker) if(WITH_SHV_WEBSOCKETS) target_sources(libshvbroker PRIVATE @@ -41,12 +42,15 @@ if(OpenLDAP_FOUND) src/ldap.cpp src/openldap_dynamic.cpp ) - target_include_directories(libshvbroker PUBLIC "${OpenLDAP_INCLUDE_DIRS}") + target_include_directories(libshvbroker PUBLIC $) target_compile_definitions(libshvbroker PUBLIC WITH_SHV_LDAP) endif() target_link_libraries(libshvbroker PUBLIC Qt::Sql libshviotqt) -target_include_directories(libshvbroker PUBLIC include) +target_include_directories(libshvbroker PUBLIC + $ + $ + ) target_compile_definitions(libshvbroker PRIVATE SHVBROKER_BUILD_DLL) if(BUILD_TESTING) @@ -60,5 +64,8 @@ if(BUILD_TESTING) add_shvbroker_test(aclmanager) endif() -install(TARGETS libshvbroker) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/shv" TYPE INCLUDE) + +install(TARGETS libshvbroker EXPORT libshvConfig) +export(TARGETS libshvbroker NAMESPACE libshv:: FILE "${CMAKE_CURRENT_BINARY_DIR}/libshvConfig.cmake") +install(EXPORT libshvConfig DESTINATION share/libshv/cmake NAMESPACE libshv::) diff --git a/libshvchainpack/CMakeLists.txt b/libshvchainpack/CMakeLists.txt index 15741eac3..e17c5e020 100644 --- a/libshvchainpack/CMakeLists.txt +++ b/libshvchainpack/CMakeLists.txt @@ -21,13 +21,18 @@ add_library(libshvchainpack-cpp src/chainpack/utils.cpp include/shv/chainpack/crc32.h ) +add_library(libshv::libshvchainpack-cpp ALIAS libshvchainpack-cpp) if (NOT WIN32) target_sources(libshvchainpack-cpp PRIVATE src/chainpack/socketrpcdriver.cpp) endif() target_link_libraries(libshvchainpack-cpp libnecrolog::libnecrolog libshvchainpack-c) -target_include_directories(libshvchainpack-cpp PUBLIC include) +target_include_directories(libshvchainpack-cpp PUBLIC + $ + $ + ) + target_compile_definitions(libshvchainpack-cpp PRIVATE SHVCHAINPACK_BUILD_DLL) function(add_shv_test test_name) @@ -71,5 +76,8 @@ if(BUILD_TESTING) endif() endif() -install(TARGETS libshvchainpack-cpp) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/shv" TYPE INCLUDE) + +install(TARGETS libshvchainpack-cpp EXPORT libshvConfig) +export(TARGETS libshvchainpack-cpp NAMESPACE libshv:: FILE "${CMAKE_CURRENT_BINARY_DIR}/libshvConfig.cmake") +install(EXPORT libshvConfig DESTINATION share/libshv/cmake NAMESPACE libshv::) diff --git a/libshvchainpack/c/CMakeLists.txt b/libshvchainpack/c/CMakeLists.txt index e2c2e1ef4..5d1ec3c27 100644 --- a/libshvchainpack/c/CMakeLists.txt +++ b/libshvchainpack/c/CMakeLists.txt @@ -4,7 +4,9 @@ add_library(libshvchainpack-c STATIC ccpcp_convert.c ccpon.c ) -target_include_directories(libshvchainpack-c PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_include_directories(libshvchainpack-c PUBLIC + $ + ) function(add_shv_test test_name) add_executable(test_${test_name} @@ -18,5 +20,8 @@ if(BUILD_TESTING) add_shv_test(ccpcp) endif() -install(TARGETS libshvchainpack-c) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/shv" TYPE INCLUDE) + +install(TARGETS libshvchainpack-c EXPORT libshvConfig) +export(TARGETS libshvchainpack-c NAMESPACE libshvchainpack-c:: FILE "${CMAKE_CURRENT_BINARY_DIR}/libshvConfig.cmake") +install(EXPORT libshvConfig DESTINATION "share/libshv/cmake" NAMESPACE libshv::) diff --git a/libshvcore/CMakeLists.txt b/libshvcore/CMakeLists.txt index da788d149..35f3e1ae5 100644 --- a/libshvcore/CMakeLists.txt +++ b/libshvcore/CMakeLists.txt @@ -25,9 +25,13 @@ add_library(libshvcore src/utils/shvurl.cpp src/utils/versioninfo.cpp ) +add_library(libshv::libshvcore ALIAS libshvcore) target_link_libraries(libshvcore libshvchainpack-cpp) -target_include_directories(libshvcore PUBLIC include) +target_include_directories(libshvcore PUBLIC + $ + $ + ) target_compile_definitions(libshvcore PRIVATE SHVCORE_BUILD_DLL) function(add_shvcore_test test_name) @@ -52,5 +56,8 @@ if(BUILD_TESTING) endif() endif() -install(TARGETS libshvcore) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/shv" TYPE INCLUDE) + +install(TARGETS libshvcore EXPORT libshvConfig) +export(TARGETS libshvcore NAMESPACE libshv:: FILE "${CMAKE_CURRENT_BINARY_DIR}/libshvConfig.cmake") +install(EXPORT libshvConfig DESTINATION share/libshv/cmake NAMESPACE libshv::) diff --git a/libshvcoreqt/CMakeLists.txt b/libshvcoreqt/CMakeLists.txt index 75fe64f17..e82de7c2e 100644 --- a/libshvcoreqt/CMakeLists.txt +++ b/libshvcoreqt/CMakeLists.txt @@ -16,8 +16,13 @@ qt_add_library(libshvcoreqt include/shv/coreqt/utils.h include/shv/coreqt/exception.h ) +add_library(libshv::libshvcoreqt ALIAS libshvcoreqt) + target_link_libraries(libshvcoreqt PUBLIC Qt::Core libshvcore) -target_include_directories(libshvcoreqt PUBLIC include) +target_include_directories(libshvcoreqt PUBLIC + $ + $ + ) target_compile_definitions(libshvcoreqt PRIVATE SHVCOREQT_BUILD_DLL) function(add_shvcoreqt_test test_name) @@ -34,5 +39,8 @@ if(BUILD_TESTING) add_shvcoreqt_test(utils) endif() -install(TARGETS libshvcoreqt) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/shv" TYPE INCLUDE) + +install(TARGETS libshvcoreqt EXPORT libshvConfig) +export(TARGETS libshvcoreqt NAMESPACE libshv:: FILE "${CMAKE_CURRENT_BINARY_DIR}/libshvConfig.cmake") +install(EXPORT libshvConfig DESTINATION share/libshv/cmake NAMESPACE libshv::) diff --git a/libshviotqt/CMakeLists.txt b/libshviotqt/CMakeLists.txt index 240fb0e4d..204825ef9 100644 --- a/libshviotqt/CMakeLists.txt +++ b/libshviotqt/CMakeLists.txt @@ -43,6 +43,8 @@ qt_add_library(libshviotqt include/shv/iotqt/rpc/socketrpcconnection.h include/shv/iotqt/utils.h ) +add_library(libshv::libshviotqt ALIAS libshviotqt) + target_link_libraries(libshviotqt PUBLIC Qt::Network libshvcoreqt) if(NOT EMSCRIPTEN) @@ -52,7 +54,10 @@ if(NOT EMSCRIPTEN) ) endif() -target_include_directories(libshviotqt PUBLIC include) +target_include_directories(libshviotqt PUBLIC + $ + $ + ) target_compile_definitions(libshviotqt PRIVATE SHVIOTQT_BUILD_DLL) if(WITH_SHV_WEBSOCKETS) @@ -81,5 +86,8 @@ if(BUILD_TESTING) set_property(TEST test_iotqt_serialportsocket APPEND PROPERTY ENVIRONMENT "TESTS_DIR=${CMAKE_CURRENT_BINARY_DIR}/test_serialportsocket") endif() -install(TARGETS libshviotqt) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/shv" TYPE INCLUDE) + +install(TARGETS libshviotqt EXPORT libshvConfig) +export(TARGETS libshviotqt NAMESPACE libshv:: FILE "${CMAKE_CURRENT_BINARY_DIR}/libshvConfig.cmake") +install(EXPORT libshvConfig DESTINATION share/libshv/cmake NAMESPACE libshv::) diff --git a/libshvvisu/CMakeLists.txt b/libshvvisu/CMakeLists.txt index b3bba7173..ac7ee858c 100644 --- a/libshvvisu/CMakeLists.txt +++ b/libshvvisu/CMakeLists.txt @@ -58,11 +58,18 @@ add_library(libshvvisu include/shv/visu/svgscene/groupitem.h include/shv/visu/errorlogmodel.h ) +add_library(libshv::libshvvisu ALIAS libshvvisu) target_link_libraries(libshvvisu PUBLIC Qt::Widgets libshviotqt) target_include_directories(libshvvisu PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) -target_include_directories(libshvvisu PUBLIC include) +target_include_directories(libshvvisu PUBLIC + $ + $ + ) target_compile_definitions(libshvvisu PRIVATE SHVVISU_BUILD_DLL) -install(TARGETS libshvvisu) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/shv" TYPE INCLUDE) + +install(TARGETS libshvvisu EXPORT libshvConfig) +export(TARGETS libshvvisu NAMESPACE libshv:: FILE "${CMAKE_CURRENT_BINARY_DIR}/libshvConfig.cmake") +install(EXPORT libshvConfig DESTINATION share/libshv/cmake NAMESPACE libshv::)