Skip to content

Commit

Permalink
[libiodata] Add qt5 variant
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewvogt committed Apr 15, 2013
1 parent fa18486 commit bdcb4d8
Show file tree
Hide file tree
Showing 17 changed files with 189 additions and 29 deletions.
1 change: 1 addition & 0 deletions H/iodata-qt5
15 changes: 15 additions & 0 deletions iodata-qt5.prf
@@ -0,0 +1,15 @@
LIBS += -liodata-qt5

QMAKE_EXTRA_COMPILERS += iodata_type_to_cxx iodata_type_to_h

iodata_type_to_cxx.input = IODATA_TYPES
iodata_type_to_cxx.output = iodata_${QMAKE_FILE_IN_BASE}.cpp
iodata_type_to_cxx.variable_out = SOURCES
iodata_type_to_cxx.commands = iodata-qt5-type-to-c++ ${QMAKE_FILE_IN} -o iodata_${QMAKE_FILE_IN_BASE}.cpp -d ${QMAKE_FILE_IN}.h

iodata_type_to_h.input = IODATA_TYPES
iodata_type_to_h.output = ${QMAKE_FILE_IN}.h
iodata_type_to_h.variable_out = HEADERS
iodata_type_to_h.commands = iodata-qt5-type-to-c++ ${QMAKE_FILE_IN} -o iodata_${QMAKE_FILE_IN_BASE}.cpp -d ${QMAKE_FILE_IN}.h

# iodata-qt5-type-to-c++ ${QMAKE_FILE_IN} -d ${QMAKE_FILE_OUT}
10 changes: 8 additions & 2 deletions root.pro
Expand Up @@ -2,7 +2,13 @@ TEMPLATE = subdirs

SUBDIRS = src tests type-to-cxx

prf.files = iodata.prf
prf.path = /usr/share/qt4/mkspecs/features
equals(QT_MAJOR_VERSION, 4) {
prf.files = iodata.prf
prf.path = /usr/share/qt4/mkspecs/features
}
equals(QT_MAJOR_VERSION, 5) {
prf.files = iodata-qt5.prf
prf.path = /usr/share/qt5/mkspecs/features
}

INSTALLS = prf
70 changes: 70 additions & 0 deletions rpm/libiodata-qt5.spec
@@ -0,0 +1,70 @@
%define _name iodata-qt5
Name: libiodata-qt5
Version: 0.17
Release: 1
Summary: Library for input/ouput data
Group: System/System Control
License: LGPLv2
URL: http://meego.gitorious.org/meego-middleware/iodata
Source0: %{_name}-%{version}.tar.bz2

BuildRequires: pkgconfig(Qt5Core)
BuildRequires: bison
BuildRequires: flex
BuildRequires: libqmlog-qt5-devel

%description
This package provides a library for writing and reading structured data.

%package devel
Summary: Development package for %{name}
Group: Development/Libraries
Requires: pkgconfig(Qt5Core)
Requires: %{name} = %{version}-%{release}

%description devel
Provides header files for iodata library.

%package tests
Summary: Testcases for iodata library
Group: Development/System
Requires: testrunner-lite

%description tests
%{summary}.

%prep
%setup -q -n %{_name}-%{version}

%build
export IODATA_VERSION=`head -n1 debian/changelog | sed "s/.*(\([^)+]*\).*/\1/"`
%qmake
make

%install
%qmake_install
install -d %{buildroot}/%{_datadir}/%{name}-tests/
mv %{buildroot}/%{_datadir}/%{_name}-tests/tests.xml %{buildroot}/%{_datadir}/%{name}-tests/tests.xml

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc COPYING debian/changelog debian/copyright
%{_libdir}/%{name}.so.*

%files devel
%defattr(-,root,root,-)
%doc COPYING
%{_bindir}/iodata-qt5-type-to-c++
%{_includedir}/iodata-qt5/*
%{_libdir}/%{name}.so
%{_datadir}/qt5/mkspecs/features/iodata-qt5.prf

%files tests
%defattr(-,root,root,-)
%doc COPYING
%{_bindir}/%{_name}-test
%{_datadir}/%{name}-tests/tests.xml
5 changes: 5 additions & 0 deletions src/iodata
@@ -1 +1,6 @@
#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <iodata-qt5/iodata.h>
#else
#include <iodata/iodata.h>
#endif
5 changes: 5 additions & 0 deletions src/misc.cpp
Expand Up @@ -4,7 +4,12 @@

using namespace std ;

#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <qmlog-qt5>
#else
#include <qmlog>
#endif

#include "misc.h"

Expand Down
21 changes: 15 additions & 6 deletions src/src.pro
Expand Up @@ -2,19 +2,28 @@ VERSION = 0.$$(IODATA_VERSION)
TEMPLATE=lib
QT -= gui

CONFIG += qmlog
equals(QT_MAJOR_VERSION, 4): CONFIG += qmlog
equals(QT_MAJOR_VERSION, 5): CONFIG += qmlog-qt5

INCLUDEPATH += ../H
SOURCES = iodata.cpp validator.cpp storage.cpp misc.cpp

TARGET = iodata
equals(QT_MAJOR_VERSION, 4): TARGET = iodata
equals(QT_MAJOR_VERSION, 5): TARGET = iodata-qt5
target.path = /usr/lib

devheaders.files = iodata.h validator.h storage.h iodata validator storage
devheaders.path = /usr/include/iodata

prf.files = iodata.prf
prf.path = /usr/share/qt4/mkspecs/features
equals(QT_MAJOR_VERSION, 4): devheaders.path = /usr/include/iodata
equals(QT_MAJOR_VERSION, 5): devheaders.path = /usr/include/iodata-qt5

equals(QT_MAJOR_VERSION, 4) {
prf.files = iodata.prf
prf.path = /usr/share/qt4/mkspecs/features
}
equals(QT_MAJOR_VERSION, 5) {
prf.files = iodata-qt5.prf
prf.path = /usr/share/qt5/mkspecs/features
}

INSTALLS = target devheaders prf

Expand Down
5 changes: 5 additions & 0 deletions src/storage
@@ -1 +1,6 @@
#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <iodata-qt5/storage.h>
#else
#include <iodata/storage.h>
#endif
11 changes: 8 additions & 3 deletions src/storage.cpp
Expand Up @@ -30,11 +30,16 @@
#include <sstream>
using namespace std ;

#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <qmlog-qt5>
#else
#include <qmlog>
#endif

#include <iodata/iodata>
#include <iodata/validator>
#include <iodata/storage>
#include "iodata.h"
#include "validator.h"
#include "storage.h"

using namespace iodata ;

Expand Down
10 changes: 8 additions & 2 deletions src/storage.h
Expand Up @@ -32,8 +32,14 @@
#include <vector>
#include <string>

#include <iodata/iodata>
#include <iodata/validator>
#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <iodata-qt5/iodata.h>
#include <iodata-qt5/validator.h>
#else
#include <iodata/iodata.h>
#include <iodata/validator.h>
#endif

namespace iodata { class storage ; }

Expand Down
5 changes: 5 additions & 0 deletions src/validator
@@ -1 +1,6 @@
#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <iodata-qt5/validator.h>
#else
#include <iodata/validator.h>
#endif
5 changes: 5 additions & 0 deletions src/validator.cpp
Expand Up @@ -25,7 +25,12 @@
#include <iostream>
using namespace std ;

#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <qmlog-qt5>
#else
#include <qmlog>
#endif

#include "iodata.h"
#include "validator.h"
Expand Down
8 changes: 6 additions & 2 deletions src/validator.h
Expand Up @@ -34,8 +34,12 @@
#include <typeinfo>
using namespace std ;


#include <iodata/iodata>
#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <iodata-qt5/iodata.h>
#else
#include <iodata/iodata.h>
#endif

namespace iodata
{
Expand Down
9 changes: 7 additions & 2 deletions tests/iodata-test.cpp
Expand Up @@ -5,9 +5,14 @@
#include <sstream>
using namespace std ;

#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <qmlog-qt5>
#include <iodata-qt5/iodata.h>
#else
#include <qmlog>

#include <iodata/iodata>
#include <iodata/iodata.h>
#endif

int trivial(int ac, char **av) ;
int storage(int ac, char **av) ;
Expand Down
14 changes: 9 additions & 5 deletions tests/tests.pro
@@ -1,19 +1,23 @@
VERSION = $$(IODATA_VERSION)
TEMPLATE = app
QT -= Gui
TARGET = iodata-test
QT -= gui
equals(QT_MAJOR_VERSION, 4): TARGET = iodata-test
equals(QT_MAJOR_VERSION, 5): TARGET = iodata-qt5-test

CONFIG += qmlog
equals(QT_MAJOR_VERSION, 4): CONFIG += qmlog
equals(QT_MAJOR_VERSION, 5): CONFIG += qmlog-qt5

INSTALLS = target tests

LIBS += -liodata
equals(QT_MAJOR_VERSION, 4): LIBS += -liodata
equals(QT_MAJOR_VERSION, 5): LIBS += -liodata-qt5
QMAKE_LIBDIR_FLAGS += -L../src
INCLUDEPATH += ../H

SOURCES = iodata-test.cpp

tests.path = /usr/share/iodata-tests
equals(QT_MAJOR_VERSION, 4): tests.path = /usr/share/iodata-tests
equals(QT_MAJOR_VERSION, 5): tests.path = /usr/share/iodata-qt5-tests
tests.files = tests.xml

target.path = /usr/bin
15 changes: 11 additions & 4 deletions type-to-cxx/type-to-cxx.cpp
Expand Up @@ -3,11 +3,18 @@ using namespace std ;

#include <argp.h>

#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <qmlog-qt5>
#include <iodata-qt5/iodata.h>
#include <iodata-qt5/validator.h>
#include <iodata-qt5/storage.h>
#else
#include <qmlog>

#include <iodata/iodata>
#include <iodata/validator>
#include <iodata/storage>
#include <iodata/iodata.h>
#include <iodata/validator.h>
#include <iodata/storage.h>
#endif

void dump_h(ostringstream &h, iodata::validator *v)
{
Expand Down
9 changes: 6 additions & 3 deletions type-to-cxx/type-to-cxx.pro
@@ -1,13 +1,16 @@
VERSION = $$(IODATA_VERSION)
TEMPLATE = app
QT -= gui
TARGET = iodata-type-to-c++
equals(QT_MAJOR_VERSION, 4): TARGET = iodata-type-to-c++
equals(QT_MAJOR_VERSION, 5): TARGET = iodata-qt5-type-to-c++

CONFIG += qmlog
equals(QT_MAJOR_VERSION, 4): CONFIG += qmlog
equals(QT_MAJOR_VERSION, 5): CONFIG += qmlog-qt5

INSTALLS = target

LIBS += -liodata -lcrypt
equals(QT_MAJOR_VERSION, 4): LIBS += -liodata -lcrypt
equals(QT_MAJOR_VERSION, 5): LIBS += -liodata-qt5 -lcrypt
QMAKE_LIBDIR_FLAGS += -L../src
INCLUDEPATH += ../H

Expand Down

0 comments on commit bdcb4d8

Please sign in to comment.