From 2c0e343c55ee76f393990cbeb7c8e98915aaecf8 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Fri, 16 Jun 2017 03:06:09 +0300 Subject: [PATCH] Static build has been fixed. CONFIG no_zint & static_build flags have been added --- 3rdparty/zint-2.4.4/backend_qt4/Zint.pro | 13 ++++++++++--- 3rdparty/zint-2.4.4/backend_qt4/qzint_global.h | 4 ++++ common.pri | 5 ++++- demo_r1/demo_r1.pro | 12 ++++++++---- demo_r2/demo_r2.pro | 13 ++++++++----- designer/designer.pro | 13 ++++++++----- limereport.pro | 6 ++++++ limereport/limereport.pro | 12 +++++++++--- limereport/lrfactoryinitializer.cpp | 4 +++- 9 files changed, 60 insertions(+), 22 deletions(-) diff --git a/3rdparty/zint-2.4.4/backend_qt4/Zint.pro b/3rdparty/zint-2.4.4/backend_qt4/Zint.pro index b579cde..b8c6bd5 100644 --- a/3rdparty/zint-2.4.4/backend_qt4/Zint.pro +++ b/3rdparty/zint-2.4.4/backend_qt4/Zint.pro @@ -1,7 +1,15 @@ DEFINES += NO_PNG - TEMPLATE = lib -CONFIG += dll + +contains(CONFIG, static_build){ + CONFIG += staticlib + DEFINES += HAVE_STATIC_BUILD +} + +!contains(CONFIG, staticlib){ + CONFIG += dll + DEFINES += QZINT_LIBRARY +} include(../../../common.pri) @@ -18,7 +26,6 @@ unix{ INCLUDEPATH += $$PWD/../backend DEFINES += _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS ZINT_VERSION=\\\"$$VERSION\\\" -DEFINES += QZINT_LIBRARY TARGET = QtZint !contains(DEFINES, NO_PNG) { diff --git a/3rdparty/zint-2.4.4/backend_qt4/qzint_global.h b/3rdparty/zint-2.4.4/backend_qt4/qzint_global.h index 025b16e..ea46fe2 100644 --- a/3rdparty/zint-2.4.4/backend_qt4/qzint_global.h +++ b/3rdparty/zint-2.4.4/backend_qt4/qzint_global.h @@ -3,10 +3,14 @@ #include +#ifdef HAVE_STATIC_BUILD +# define QZINTSHARED_EXPORT /**/ +#else #if defined(QZINT_LIBRARY) # define QZINTSHARED_EXPORT Q_DECL_EXPORT #else # define QZINTSHARED_EXPORT Q_DECL_IMPORT #endif +#endif #endif // QZINT_GLOBAL_H diff --git a/common.pri b/common.pri index baea82d..d19ba65 100644 --- a/common.pri +++ b/common.pri @@ -1,5 +1,8 @@ CONFIG += build_translations -CONFIG += zint + +!contains(CONFIG, no_zint){ + CONFIG += zint +} ZINT_PATH = $$PWD/3rdparty/zint-2.4.4 contains(CONFIG,zint){ diff --git a/demo_r1/demo_r1.pro b/demo_r1/demo_r1.pro index 26f70cd..b620055 100644 --- a/demo_r1/demo_r1.pro +++ b/demo_r1/demo_r1.pro @@ -27,8 +27,10 @@ macx{ unix:{ LIBS += -L$${DEST_LIBS} -llimereport - contains(CONFIG,zint){ - LIBS += -L$${DEST_LIBS} -lQtZint + !contains(CONFIG, static_build){ + contains(CONFIG,zint){ + LIBS += -L$${DEST_LIBS} -lQtZint + } } DESTDIR = $$DEST_DIR # QMAKE_POST_LINK += mkdir -p $$quote($$REPORTS_DIR) | @@ -53,8 +55,10 @@ win32 { RC_FILE += mainicon.rc QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR\\*) $$quote($$REPORTS_DIR\\demo_reports) $$escape_expand(\\n\\t) - contains(CONFIG,zint){ - LIBS += -L$${DEST_LIBS} -lQtZint + !contains(CONFIG, static_build){ + contains(CONFIG,zint){ + LIBS += -L$${DEST_LIBS} -lQtZint + } } LIBS += -L$${DEST_LIBS} -llimereport } diff --git a/demo_r2/demo_r2.pro b/demo_r2/demo_r2.pro index cec1043..f327957 100644 --- a/demo_r2/demo_r2.pro +++ b/demo_r2/demo_r2.pro @@ -27,8 +27,10 @@ macx{ unix:{ LIBS += -L$${DEST_LIBS} -llimereport - contains(CONFIG,zint){ - LIBS += -L$${DEST_LIBS} -lQtZint + !contains(CONFIG, static_build){ + contains(CONFIG,zint){ + LIBS += -L$${DEST_LIBS} -lQtZint + } } DESTDIR = $$DEST_DIR QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR) $$quote($$REPORTS_DIR) $$escape_expand(\n\t) @@ -50,9 +52,10 @@ win32 { DESTDIR = $$DEST_DIR RC_FILE += mainicon.rc - - contains(CONFIG,zint){ - LIBS += -L$${DEST_LIBS} -lQtZint + !contains(CONFIG, static_build){ + contains(CONFIG,zint){ + LIBS += -L$${DEST_LIBS} -lQtZint + } } LIBS += -L$${DEST_LIBS} -llimereport diff --git a/designer/designer.pro b/designer/designer.pro index e483859..fef1c0f 100644 --- a/designer/designer.pro +++ b/designer/designer.pro @@ -18,8 +18,10 @@ macx{ unix:{ LIBS += -L$${DEST_LIBS} -llimereport - contains(CONFIG,zint){ - LIBS += -L$${DEST_LIBS} -lQtZint + !contains(CONFIG, static_build){ + contains(CONFIG,zint){ + LIBS += -L$${DEST_LIBS} -lQtZint + } } DESTDIR = $$DEST_DIR linux{ @@ -40,9 +42,10 @@ win32 { DESTDIR = $$DEST_DIR RC_FILE += mainicon.rc - - contains(CONFIG,zint){ - LIBS += -L$${DEST_LIBS} -lQtZint + !contains(CONFIG, static_build){ + contains(CONFIG,zint){ + LIBS += -L$${DEST_LIBS} -lQtZint + } } LIBS += -L$${DEST_LIBS} -llimereport } diff --git a/limereport.pro b/limereport.pro index c03043d..84179ac 100644 --- a/limereport.pro +++ b/limereport.pro @@ -1,9 +1,15 @@ TEMPLATE = subdirs + +!contains(CONFIG, no_zint){ + CONFIG += zint +} + include(common.pri) contains(CONFIG, zint){ SUBDIRS += 3rdparty } +export($$CONFIG) SUBDIRS += \ limereport diff --git a/limereport/limereport.pro b/limereport/limereport.pro index 5af5676..5f85023 100644 --- a/limereport/limereport.pro +++ b/limereport/limereport.pro @@ -1,9 +1,15 @@ TARGET = limereport TEMPLATE = lib -CONFIG += lib -CONFIG += dll -#CONFIG += staticlib +contains(CONFIG, static_build){ + CONFIG += staticlib +} + +!contains(CONFIG, staticlib){ + CONFIG += lib + CONFIG += dll +} + CONFIG += create_prl CONFIG += link_prl diff --git a/limereport/lrfactoryinitializer.cpp b/limereport/lrfactoryinitializer.cpp index cf83c8c..5aef43a 100644 --- a/limereport/lrfactoryinitializer.cpp +++ b/limereport/lrfactoryinitializer.cpp @@ -39,7 +39,7 @@ #include "serializators/lrxmlqrectserializator.h" #include "serializators/lrxmlserializatorsfactory.h" -inline void initResources(){ +void initResources(){ Q_INIT_RESOURCE(report); Q_INIT_RESOURCE(lobjectinspector); Q_INIT_RESOURCE(lrdatabrowser); @@ -95,9 +95,11 @@ BaseDesignIntf * createTextItem(QObject* owner, LimeReport::BaseDesignIntf* par return new LimeReport::TextItem(owner,parent); } +#ifdef HAVE_ZINT BaseDesignIntf * createBarcodeItem(QObject* owner, LimeReport::BaseDesignIntf* parent){ return new BarcodeItem(owner,parent); } +#endif BaseDesignIntf* createHLayout(QObject *owner, LimeReport::BaseDesignIntf *parent) {