Menu

#27 Conditinal Define for BarCode

1.0
closed
aliks-os
None
2015-02-08
2014-12-22
Mauro Anjo
No

Hey Alik,

It would be a nice feature to have a define on QtRPT.pri that we remove BarCode functionality from QtRPT, to not bother the user that does not want that to have to build Zint.

Like (in QtRPT.pri file):

DEFINES += NO_BARCODE

And all over the code when including headers, or using BarCode.h class you should check for it with compiler directives (when inside C++ code):

#ifdef NO_BARCODE
// BarCode manipulation
#endif

And on CommonFiles_QtRPT.pri you should do something like this:

INCLUDEPATH += $$PWD

!contains(DEFINES,NO_BARCODE) {
    INCLUDEPATH += $$PWD/../zint-2.4.4/backend_qt4
    INCLUDEPATH += $$PWD/../zint-2.4.4/backend
}
SOURCES += $$PWD/CommonClasses.cpp \
           $$PWD/chart.cpp
!contains(DEFINES,NO_BARCODE) {
    SOURCES += $$PWD/Barcode.cpp
}
HEADERS += $$PWD/CommonClasses.h \
           $$PWD/chart.h
!contains(DEFINES,NO_BARCODE) {
    HEADERS += $$PWD/Barcode.h
}

!contains(DEFINES,NO_BARCODE) {
    include($$PWD/../QtRPT/config.pri)

    LIBS += -L $$DEST_DIRECTORY/lib -lQtZint
}

Discussion

  • Mauro Anjo

    Mauro Anjo - 2014-12-22

    Sorry in C++ code it should be ifndef:

    #ifndef NO_BARCODE
    // BarCode manipulation
    #endif
    
     
  • aliks-os

    aliks-os - 2014-12-23

    Added, thank you

     
  • aliks-os

    aliks-os - 2014-12-23
    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB