From f4d73b209a2e20ba48f8e0612142633b756de720 Mon Sep 17 00:00:00 2001 From: taipanromania Date: Thu, 18 Sep 2008 14:44:52 +0000 Subject: [PATCH] cmake buildsystem --- CMakeLists.txt | 35 +++++++++++++++++++++++++++++++++++ backend/CMakeLists.txt | 34 ++++++++++++++++++++++++++++++++++ backend_qt4/CMakeLists.txt | 28 ++++++++++++++++++++++++++++ frontend/CMakeLists.txt | 15 +++++++++++++++ frontend_qt4/CMakeLists.txt | 17 +++++++++++++++++ frontend_qt4/barcodeitem.cpp | 2 +- frontend_qt4/barcodeitem.h | 4 ++-- frontend_qt4/mainwindow.cpp | 2 +- 8 files changed, 133 insertions(+), 4 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 backend/CMakeLists.txt create mode 100644 backend_qt4/CMakeLists.txt create mode 100644 frontend/CMakeLists.txt create mode 100644 frontend_qt4/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..856d3c44 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,35 @@ +# (c) 2008 by BogDan Vatra < bogdan@licentia.eu > + +cmake_minimum_required(VERSION 2.6) +project(zint-package) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_VERBOSE_MAKEFILE ON) +#comment remove the above line before release + +set (ZINT_VERSION_MAJOR 1) +set (ZINT_VERSION_MINOR 80) +set (ZINT_VERSION_RELEASE 0) +set (ZINT_VERSION "${ZINT_VERSION_MAJOR}.${ZINT_VERSION_MINOR}.${ZINT_VERSION_RELEASE}" ) + +add_definitions (-DZINT_VERSION=\"${ZINT_VERSION}\") + +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ) + +find_package(Qt4) + +add_subdirectory(backend) +add_subdirectory(frontend) + +if (QT4_FOUND) + set( QT_USE_QTGUI TRUE ) + include( ${QT_USE_FILE} ) + include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${QT_INCLUDE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ) + add_subdirectory(backend_qt4) + add_subdirectory(frontend_qt4) +endif(QT4_FOUND) diff --git a/backend/CMakeLists.txt b/backend/CMakeLists.txt new file mode 100644 index 00000000..b64eaef7 --- /dev/null +++ b/backend/CMakeLists.txt @@ -0,0 +1,34 @@ +# (c) 2008 by BogDan Vatra < bogdan@licentia.eu > + +project(zint) + +find_package(PNG) +find_package(Qr) + +set(zint_COMMON_SRCS common.c png.c library.c ps.c large.c reedsol.c) +set(zint_ONEDIM_SRCS code.c code128.c 2of5.c upcean.c telepen.c medical.c plessey.c rss.c) +set(zint_POSTAL_SRCS postal.c auspost.c imail.c) +set(zint_TWODIM_SRCS code16k.c blockf.c dmatrix.c dm200.c pdf417.c qr.c maxicode.c composite.c aztec.c) +set(zint_SRCS ${zint_COMMON_SRCS} ${zint_ONEDIM_SRCS} ${zint_POSTAL_SRCS} ${zint_TWODIM_SRCS} ) + +if(PNG_FOUND) + include_directories( ${PNG_INCLUDES} ) +else(PNG_FOUND) + add_definitions (-DNO_PNG) +endif(PNG_FOUND) + +if(QR_FOUND) + include_directories( ${QR_INCLUDES} ) +else(QR_FOUND) + add_definitions (-DNO_QR) +endif(QR_FOUND) + +add_library(zint SHARED ${zint_SRCS}) + +set_target_properties(zint PROPERTIES VERSION ${ZINT_VERSION} + SOVERSION ${ZINT_VERSION}) + +target_link_libraries(zint ${PNG_LIBRARIES} ${QR_LIBRARIES} ) + +install(TARGETS zint LIBRARY DESTINATION lib) +install(FILES zint.h DESTINATION include COMPONENT Devel) diff --git a/backend_qt4/CMakeLists.txt b/backend_qt4/CMakeLists.txt new file mode 100644 index 00000000..879172df --- /dev/null +++ b/backend_qt4/CMakeLists.txt @@ -0,0 +1,28 @@ +# (c) 2008 by BogDan Vatra < bogdan@licentia.eu > + +project(QZint) + +include_directories(BEFORE ../backend ) + +set(QZint_SRCS qzint.cpp) + +QT4_WRAP_CPP(QZint_SRCS qzint.h) + +#add_definitions (-DNO_QT_KEYWORDS) +# Uncomment the above line if you want to compile qzint without qt keywords + + +add_library(QZint SHARED ${QZint_SRCS}) + +set_target_properties(QZint PROPERTIES VERSION ${ZINT_VERSION} + SOVERSION ${ZINT_VERSION}) + +add_dependencies(QZint zint) + +link_directories( "../backend" ) + +target_link_libraries(QZint zint ${QT_QTGUI_LIBRARY} + ${QT_QTCORE_LIBRARY} ) + +install(TARGETS QZint LIBRARY DESTINATION lib) +install(FILES qzint.h DESTINATION include COMPONENT Devel) diff --git a/frontend/CMakeLists.txt b/frontend/CMakeLists.txt new file mode 100644 index 00000000..d7a2c1e9 --- /dev/null +++ b/frontend/CMakeLists.txt @@ -0,0 +1,15 @@ +# (c) 2008 by BogDan Vatra < bogdan@licentia.eu > + +project(zint_frontend) + +set(zint_frontend_SRCS main.c ) + +include_directories(BEFORE ../backend) + +add_executable(zint_frontend ${zint_frontend_SRCS}) + +add_dependencies(zint_frontend zint) + +link_directories( "../backend" ) + +target_link_libraries(zint_frontend zint) diff --git a/frontend_qt4/CMakeLists.txt b/frontend_qt4/CMakeLists.txt new file mode 100644 index 00000000..eb4b3d7c --- /dev/null +++ b/frontend_qt4/CMakeLists.txt @@ -0,0 +1,17 @@ +# (c) 2008 by BogDan Vatra < bogdan@licentia.eu > + +project(QZint_frontend) + +include_directories(BEFORE ../backend ../backend_qt4) + +set(QZint_frontend_SRCS barcodeitem.cpp main.cpp mainwindow.cpp) +QT4_WRAP_CPP(QZint_frontend_SRCS barcodeitem.h mainwindow.h) +QT4_WRAP_UI(QZint_frontend_SRCS mainWindow.ui) + +add_executable(QZint_frontend ${QZint_frontend_SRCS}) +add_dependencies(QZint_frontend QZint zint) + +link_directories( "../backend" "../backend_qt4" ) + +target_link_libraries(QZint_frontend zint QZint ${QT_QTGUI_LIBRARY} + ${QT_QTCORE_LIBRARY} ) diff --git a/frontend_qt4/barcodeitem.cpp b/frontend_qt4/barcodeitem.cpp index c28928cb..60de9b6c 100644 --- a/frontend_qt4/barcodeitem.cpp +++ b/frontend_qt4/barcodeitem.cpp @@ -37,7 +37,7 @@ QRectF BarcodeItem::boundingRect() const void BarcodeItem::paint(QPainter * painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/) { - bc.render(*painter,boundingRect(),Zint::BareCode::IgnoreAspectRatio,scaleFactor); + bc.render(*painter,boundingRect(),Zint::QZint::IgnoreAspectRatio,scaleFactor); } diff --git a/frontend_qt4/barcodeitem.h b/frontend_qt4/barcodeitem.h index 13ad13fd..c15c019e 100644 --- a/frontend_qt4/barcodeitem.h +++ b/frontend_qt4/barcodeitem.h @@ -18,7 +18,7 @@ #define BARCODEITEM_H #include -#include +#include /** @author BogDan Vatra @@ -33,7 +33,7 @@ public: void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0); public: - mutable Zint::BareCode bc; + mutable Zint::QZint bc; int scaleFactor; int w,h; }; diff --git a/frontend_qt4/mainwindow.cpp b/frontend_qt4/mainwindow.cpp index 19679429..d97e6a11 100644 --- a/frontend_qt4/mainwindow.cpp +++ b/frontend_qt4/mainwindow.cpp @@ -75,7 +75,7 @@ void MainWindow::on_generate_clicked() m_bc.bc.setPrimaryMessage(primary->text()); m_bc.bc.setSymbol(metaObject()->enumerator(0).value(stype->currentIndex())); - m_bc.bc.setBorderType((Zint::BareCode::BorderType)btype->currentIndex()); + m_bc.bc.setBorderType((Zint::QZint::BorderType)btype->currentIndex()); m_bc.bc.setBorderWidth(bwidth->value()); m_bc.bc.setHeight(heightb->value()); m_bc.bc.setWidth(widthb->value());