From ad9ed1b6988254cb6cdddb88a8e4590d4067b177 Mon Sep 17 00:00:00 2001 From: eelke Date: Wed, 13 Dec 2017 18:04:10 +0100 Subject: [PATCH] Introduced new library for pglab code which I want to unit test. Not everything can go into core because that would result in circular dependencies between core and pgsql. --- core/core.pro | 21 +-------- pglab/pglab.pro | 13 ++++++ pglabAll.pro | 3 +- {core => pglablib}/ParamListJson.cpp | 0 {core => pglablib}/ParamListJson.h | 0 {core => pglablib}/ParamListModel.cpp | 0 {core => pglablib}/ParamListModel.h | 0 pglablib/Pglablib.cpp | 6 +++ pglablib/Pglablib.h | 12 +++++ pglablib/pglablib.pro | 64 +++++++++++++++++++++++++++ 10 files changed, 98 insertions(+), 21 deletions(-) rename {core => pglablib}/ParamListJson.cpp (100%) rename {core => pglablib}/ParamListJson.h (100%) rename {core => pglablib}/ParamListModel.cpp (100%) rename {core => pglablib}/ParamListModel.h (100%) create mode 100644 pglablib/Pglablib.cpp create mode 100644 pglablib/Pglablib.h create mode 100644 pglablib/pglablib.pro diff --git a/core/core.pro b/core/core.pro index e785438..9bce7da 100644 --- a/core/core.pro +++ b/core/core.pro @@ -36,9 +36,7 @@ SOURCES += my_boost_assert_handler.cpp \ BackupFormatModel.cpp \ QueuedBackgroundTask.cpp \ ExplainTreeModelItem.cpp \ - jsoncpp.cpp \ - ParamListJson.cpp \ - ParamListModel.cpp + jsoncpp.cpp HEADERS += PasswordManager.h \ SqlLexer.h \ @@ -48,26 +46,9 @@ HEADERS += PasswordManager.h \ QueuedBackgroundTask.h \ Expected.h \ ExplainTreeModelItem.h \ - ParamListJson.h \ - ParamListModel.h \ json/json.h unix { target.path = /usr/lib INSTALLS += target } - - - -win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../pgsql/release/ -lpgsql -else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../pgsql/debug/ -lpgsql -else:unix:!macx: LIBS += -L$$OUT_PWD/../pgsql/ -lpgsql - -INCLUDEPATH += $$PWD/../pgsql -DEPENDPATH += $$PWD/../pgsql - -win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../pgsql/release/libpgsql.a -else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../pgsql/debug/libpgsql.a -else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../pgsql/release/pgsql.lib -else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../pgsql/debug/pgsql.lib -else:unix:!macx: PRE_TARGETDEPS += $$OUT_PWD/../pgsql/libpgsql.a diff --git a/pglab/pglab.pro b/pglab/pglab.pro index 39842bd..f3a4dcc 100644 --- a/pglab/pglab.pro +++ b/pglab/pglab.pro @@ -169,3 +169,16 @@ else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PW else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../pgsql/debug/pgsql.lib else:unix:!macx: PRE_TARGETDEPS += $$OUT_PWD/../pgsql/libpgsql.a + +win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../pglablib/release/ -lpglablib +else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../pglablib/debug/ -lpglablib +else:unix:!macx: LIBS += -L$$OUT_PWD/../pglablib/ -lpglablib + +INCLUDEPATH += $$PWD/../pglablib +DEPENDPATH += $$PWD/../pglablib + +win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../pglablib/release/libpglablib.a +else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../pglablib/debug/libpglablib.a +else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../pglablib/release/pglablib.lib +else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../pglablib/debug/pglablib.lib +else:unix:!macx: PRE_TARGETDEPS += $$OUT_PWD/../pglablib/libpglablib.a diff --git a/pglabAll.pro b/pglabAll.pro index 503beee..6995c21 100644 --- a/pglabAll.pro +++ b/pglabAll.pro @@ -5,7 +5,8 @@ DEFINES += BOOST_ENABLE_ASSERT_HANDLER SUBDIRS += core \ pgsql \ -pglab +pglab \ + pglablib CONFIG(debug, debug|release) { SUBDIRS += tests diff --git a/core/ParamListJson.cpp b/pglablib/ParamListJson.cpp similarity index 100% rename from core/ParamListJson.cpp rename to pglablib/ParamListJson.cpp diff --git a/core/ParamListJson.h b/pglablib/ParamListJson.h similarity index 100% rename from core/ParamListJson.h rename to pglablib/ParamListJson.h diff --git a/core/ParamListModel.cpp b/pglablib/ParamListModel.cpp similarity index 100% rename from core/ParamListModel.cpp rename to pglablib/ParamListModel.cpp diff --git a/core/ParamListModel.h b/pglablib/ParamListModel.h similarity index 100% rename from core/ParamListModel.h rename to pglablib/ParamListModel.h diff --git a/pglablib/Pglablib.cpp b/pglablib/Pglablib.cpp new file mode 100644 index 0000000..90d5368 --- /dev/null +++ b/pglablib/Pglablib.cpp @@ -0,0 +1,6 @@ +#include "Pglablib.h" + + +Pglablib::Pglablib() +{ +} diff --git a/pglablib/Pglablib.h b/pglablib/Pglablib.h new file mode 100644 index 0000000..1ac52ad --- /dev/null +++ b/pglablib/Pglablib.h @@ -0,0 +1,12 @@ +#ifndef PGLABLIB_H +#define PGLABLIB_H + + +class Pglablib +{ + +public: + Pglablib(); +}; + +#endif // PGLABLIB_H diff --git a/pglablib/pglablib.pro b/pglablib/pglablib.pro new file mode 100644 index 0000000..e6249fb --- /dev/null +++ b/pglablib/pglablib.pro @@ -0,0 +1,64 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2017-12-13T17:36:43 +# +#------------------------------------------------- + +QT += widgets + +TARGET = pglablib +TEMPLATE = lib +CONFIG += staticlib + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which has been marked as deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +INCLUDEPATH += C:\prog\include C:\Prog\include\pgsql C:\VSproj\boost32\include\boost-1_65_1 + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \ + Pglablib.cpp \ + ParamListJson.cpp \ + ParamListModel.cpp + +HEADERS += \ + Pglablib.h \ + ParamListJson.h \ + ParamListModel.h +unix { + target.path = /usr/lib + INSTALLS += target +} + +win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../core/release/ -lcore +else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../core/debug/ -lcore +else:unix:!macx: LIBS += -L$$OUT_PWD/../core/ -lcore + +INCLUDEPATH += $$PWD/../core +DEPENDPATH += $$PWD/../core + +win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../core/release/libcore.a +else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../core/debug/libcore.a +else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../core/release/core.lib +else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../core/debug/core.lib +else:unix:!macx: PRE_TARGETDEPS += $$OUT_PWD/../core/libcore.a + +win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../pgsql/release/ -lpgsql +else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../pgsql/debug/ -lpgsql +else:unix:!macx: LIBS += -L$$OUT_PWD/../pgsql/ -lpgsql + +INCLUDEPATH += $$PWD/../pgsql +DEPENDPATH += $$PWD/../pgsql + +win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../pgsql/release/libpgsql.a +else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../pgsql/debug/libpgsql.a +else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../pgsql/release/pgsql.lib +else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../pgsql/debug/pgsql.lib +else:unix:!macx: PRE_TARGETDEPS += $$OUT_PWD/../pgsql/libpgsql.a