Skip to content

Commit

Permalink
Merge pull request #3 from neochapay/qt6
Browse files Browse the repository at this point in the history
Fixup qt6 build
  • Loading branch information
pvuorela authored Nov 27, 2023
2 parents d94d70e + 967a020 commit dc95f5d
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 7 deletions.
15 changes: 15 additions & 0 deletions iodata-qt6.prf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
LIBS += -liodata-qt6

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-qt6-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-qt6-type-to-c++ ${QMAKE_FILE_IN} -o iodata_${QMAKE_FILE_IN_BASE}.cpp -d ${QMAKE_FILE_IN}.h

# iodata-qt6-type-to-c++ ${QMAKE_FILE_IN} -d ${QMAKE_FILE_OUT}
6 changes: 4 additions & 2 deletions root.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ TEMPLATE = subdirs

SUBDIRS = src tests type-to-cxx

prf.path = $$[QT_INSTALL_DATA]/mkspecs/features
prf.files = iodata-qt5.prf
prf.path = $$[QT_HOST_DATA]/mkspecs/features

equals(QT_MAJOR_VERSION, 5): prf.files = iodata-qt5.prf
equals(QT_MAJOR_VERSION, 6): prf.files = iodata-qt6.prf

INSTALLS = prf

Expand Down
5 changes: 5 additions & 0 deletions src/iodata
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <iodata-qt6/iodata.h>
#elif QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <iodata-qt5/iodata.h>
#endif
6 changes: 4 additions & 2 deletions src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ QT -= gui
HEADERS = iodata.h validator.h storage.h misc.h log.h
SOURCES = iodata.cpp validator.cpp storage.cpp misc.cpp

TARGET = iodata-qt5
equals(QT_MAJOR_VERSION, 5): TARGET = iodata-qt5
equals(QT_MAJOR_VERSION, 6): TARGET = iodata-qt6
target.path = $$[QT_INSTALL_LIBS]

devheaders.files = iodata.h validator.h storage.h iodata validator storage
devheaders.path = /usr/include/iodata-qt5
equals(QT_MAJOR_VERSION, 5): devheaders.path = /usr/include/iodata-qt5
equals(QT_MAJOR_VERSION, 6): devheaders.path = /usr/include/iodata-qt6

INSTALLS = target devheaders

Expand Down
5 changes: 5 additions & 0 deletions src/storage
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <iodata-qt6/storage.h>
#elif QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <iodata-qt5/storage.h>
#endif
5 changes: 5 additions & 0 deletions src/validator
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <iodata-qt6/validator.h>
#elif QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <iodata-qt5/validator.h>
#endif
3 changes: 2 additions & 1 deletion tests/tests.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ VERSION = $$(IODATA_VERSION)
TEMPLATE = app
QT -= gui

PACKAGENAME = iodata-qt5
equals(QT_MAJOR_VERSION, 5): PACKAGENAME = iodata-qt5
equals(QT_MAJOR_VERSION, 6): PACKAGENAME = iodata-qt6

TARGET = $${PACKAGENAME}-test

Expand Down
8 changes: 8 additions & 0 deletions type-to-cxx/type-to-cxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ using namespace std;

void dump_h(ostringstream &h, iodata::validator *v)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
h << "#include <iodata-qt6/validator>" << endl ;
#elif QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
h << "#include <iodata-qt5/validator>" << endl;
#endif
for (vector<string>::const_iterator it = v->v_namespace.begin(); it != v->v_namespace.end();
++it)
h << "namespace " << *it << " {" << endl;
Expand Down Expand Up @@ -188,7 +192,11 @@ int main_try(int ac, char **av)
}

if (not c_output.empty()) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
string include = "#include <iodata-qt6/validator>\n";
#else
string include = "#include <iodata-qt5/validator>\n";
#endif

if (not h_output.empty())
include += "#include \"" + h_output + "\"\n";
Expand Down
7 changes: 5 additions & 2 deletions type-to-cxx/type-to-cxx.pro
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
VERSION = $$(IODATA_VERSION)
TEMPLATE = app
QT -= gui
TARGET = iodata-qt5-type-to-c++
equals(QT_MAJOR_VERSION, 5): TARGET = iodata-qt5-type-to-c++
equals(QT_MAJOR_VERSION, 6): TARGET = iodata-qt6-type-to-c++

INSTALLS = target

LIBS += -liodata-qt5 -lcrypt
equals(QT_MAJOR_VERSION, 5): LIBS += -liodata-qt5 -lcrypt
equals(QT_MAJOR_VERSION, 6): LIBS += -liodata-qt6 -lcrypt

QMAKE_LIBDIR_FLAGS += -L../src

SOURCES = type-to-cxx.cpp
Expand Down

0 comments on commit dc95f5d

Please sign in to comment.