cmake buildsystem

This commit is contained in:
taipanromania 2008-09-18 14:44:52 +00:00
parent b6c5e74476
commit f4d73b209a
8 changed files with 133 additions and 4 deletions

35
CMakeLists.txt Normal file
View File

@ -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)

34
backend/CMakeLists.txt Normal file
View File

@ -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)

View File

@ -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)

15
frontend/CMakeLists.txt Normal file
View File

@ -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)

View File

@ -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} )

View File

@ -37,7 +37,7 @@ QRectF BarcodeItem::boundingRect() const
void BarcodeItem::paint(QPainter * painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/) 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);
} }

View File

@ -18,7 +18,7 @@
#define BARCODEITEM_H #define BARCODEITEM_H
#include <QGraphicsItem> #include <QGraphicsItem>
#include <barcoderender.h> #include <qzint.h>
/** /**
@author BogDan Vatra <taipan@licentia.eu> @author BogDan Vatra <taipan@licentia.eu>
@ -33,7 +33,7 @@ public:
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0); void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
public: public:
mutable Zint::BareCode bc; mutable Zint::QZint bc;
int scaleFactor; int scaleFactor;
int w,h; int w,h;
}; };

View File

@ -75,7 +75,7 @@ void MainWindow::on_generate_clicked()
m_bc.bc.setPrimaryMessage(primary->text()); m_bc.bc.setPrimaryMessage(primary->text());
m_bc.bc.setSymbol(metaObject()->enumerator(0).value(stype->currentIndex())); 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.setBorderWidth(bwidth->value());
m_bc.bc.setHeight(heightb->value()); m_bc.bc.setHeight(heightb->value());
m_bc.bc.setWidth(widthb->value()); m_bc.bc.setWidth(widthb->value());