From 23ee0e6f009894bf30abff8e83af8cfe0b3f324a Mon Sep 17 00:00:00 2001 From: Srivats P Date: Thu, 17 Nov 2022 12:12:13 +0530 Subject: [PATCH] Extract libostfilegui out of libostfile libostfile now has no GUI dependencies --- client/ostinato.pro | 12 +++++++++--- common/nativefileformat.cpp | 10 ++++++---- common/ostfile.pro | 13 +------------ common/ostfilegui.pro | 15 +++++++++++++++ common/pcapfileformat.cpp | 2 -- ost.pro | 7 +++++-- test/test.pro | 2 +- 7 files changed, 37 insertions(+), 24 deletions(-) create mode 100644 common/ostfilegui.pro diff --git a/client/ostinato.pro b/client/ostinato.pro index 615700c..6c80918 100644 --- a/client/ostinato.pro +++ b/client/ostinato.pro @@ -8,26 +8,32 @@ INCLUDEPATH += "../rpc/" "../common/" win32 { QMAKE_LFLAGS += -static CONFIG(debug, debug|release) { - LIBS += -L"../common/debug" -lostfile -lostprotogui -lostproto + LIBS += -L"../common/debug" -lostfilegui -lostfile + LIBS += -L"../common/debug" -lostprotogui -lostproto LIBS += -L"../rpc/debug" -lpbrpc POST_TARGETDEPS += \ + "../common/debug/libostfilegui.a" \ "../common/debug/libostfile.a" \ "../common/debug/libostprotogui.a" \ "../common/debug/libostproto.a" \ "../rpc/debug/libpbrpc.a" } else { - LIBS += -L"../common/release" -lostfile -lostprotogui -lostproto + LIBS += -L"../common/release" -lostfilegui -lostfile + LIBS += -L"../common/release" -lostprotogui -lostproto LIBS += -L"../rpc/release" -lpbrpc POST_TARGETDEPS += \ + "../common/release/libostfilegui.a" \ "../common/release/libostfile.a" \ "../common/release/libostprotogui.a" \ "../common/release/libostproto.a" \ "../rpc/release/libpbrpc.a" } } else { - LIBS += -L"../common" -lostfile -lostprotogui -lostproto + LIBS += -L"../common" -lostfile -lostfilegui + LIBS += -L"../common" -lostprotogui -lostproto LIBS += -L"../rpc" -lpbrpc POST_TARGETDEPS += \ + "../common/libostfilegui.a" \ "../common/libostfile.a" \ "../common/libostprotogui.a" \ "../common/libostproto.a" \ diff --git a/common/nativefileformat.cpp b/common/nativefileformat.cpp index f7b6f12..12ff4b6 100644 --- a/common/nativefileformat.cpp +++ b/common/nativefileformat.cpp @@ -21,7 +21,7 @@ along with this program. If not, see #include "crc32c.h" -#include +#include #include #include @@ -437,17 +437,19 @@ _exit: void NativeFileFormat::initFileMetaData(OstProto::FileMetaData &metaData) { + QCoreApplication *app = QCoreApplication::instance(); + // Fill in the "native" file format version metaData.set_format_version_major(kFileFormatVersionMajor); metaData.set_format_version_minor(kFileFormatVersionMinor); metaData.set_format_version_revision(kFileFormatVersionRevision); metaData.set_generator_name( - qApp->applicationName().toUtf8().constData()); + app->applicationName().toUtf8().constData()); metaData.set_generator_version( - qApp->property("version").toString().toUtf8().constData()); + app->property("version").toString().toUtf8().constData()); metaData.set_generator_revision( - qApp->property("revision").toString().toUtf8().constData()); + app->property("revision").toString().toUtf8().constData()); } int NativeFileFormat::fileMetaSize(const quint8* file, int size) diff --git a/common/ostfile.pro b/common/ostfile.pro index ac8ca29..6c827b3 100644 --- a/common/ostfile.pro +++ b/common/ostfile.pro @@ -1,12 +1,9 @@ TEMPLATE = lib CONFIG += qt staticlib -QT += widgets network xml script +QT += network xml script LIBS += \ -lprotobuf -FORMS = \ - pcapfileimport.ui \ - PROTOS = \ fileformat.proto @@ -24,10 +21,6 @@ HEADERS = \ sessionfileformat.h \ streamfileformat.h -HEADERS += \ - fileformatoptions.h \ - pcapoptionsdialog.h - SOURCES += \ ostprotolib.cpp \ nativefileformat.cpp \ @@ -42,10 +35,6 @@ SOURCES += \ sessionfileformat.cpp \ streamfileformat.cpp \ -SOURCES += \ - fileformatoptions.cpp \ - pcapoptionsdialog.cpp - SOURCES += \ vlanpdml.cpp \ svlanpdml.cpp \ diff --git a/common/ostfilegui.pro b/common/ostfilegui.pro new file mode 100644 index 0000000..eb7c62a --- /dev/null +++ b/common/ostfilegui.pro @@ -0,0 +1,15 @@ +TEMPLATE = lib +CONFIG += qt staticlib +QT += widgets + +FORMS = \ + pcapfileimport.ui + +HEADERS = \ + fileformatoptions.h \ + pcapoptionsdialog.h + +SOURCES = \ + fileformatoptions.cpp \ + pcapoptionsdialog.cpp + diff --git a/common/pcapfileformat.cpp b/common/pcapfileformat.cpp index e3284c9..d3f9da1 100644 --- a/common/pcapfileformat.cpp +++ b/common/pcapfileformat.cpp @@ -19,8 +19,6 @@ along with this program. If not, see #include "pcapfileformat.h" -#include "pcapoptionsdialog.h" - #include "pdmlreader.h" #include "ostprotolib.h" #include "streambase.h" diff --git a/ost.pro b/ost.pro index a174bc3..873671b 100644 --- a/ost.pro +++ b/ost.pro @@ -1,9 +1,9 @@ TEMPLATE = subdirs -SUBDIRS = client server ostfile ostproto ostprotogui rpc extra +SUBDIRS = client server ostfile ostfilegui ostproto ostprotogui rpc extra client.target = client client.file = client/ostinato.pro -client.depends = ostfile ostproto ostprotogui rpc extra +client.depends = ostfile ostfilegui ostproto ostprotogui rpc extra server.target = server server.file = server/drone.pro @@ -12,6 +12,9 @@ server.depends = ostproto rpc ostfile.file = common/ostfile.pro ostfile.depends = ostproto +ostfilegui.file = common/ostfilegui.pro +ostfilegui.depends = ostfile + ostproto.file = common/ostproto.pro ostprotogui.file = common/ostprotogui.pro diff --git a/test/test.pro b/test/test.pro index 1ba6bfb..a2fe5a7 100644 --- a/test/test.pro +++ b/test/test.pro @@ -1,6 +1,6 @@ TEMPLATE = app CONFIG += qt console -QT += xml network script widgets +QT += xml network script INCLUDEPATH += "../rpc/" "../common/" "../client" win32 { LIBS += -lwpcap -lpacket