diff --git a/build.sh b/build.sh index 1caeccba9..79555a24f 100755 --- a/build.sh +++ b/build.sh @@ -27,6 +27,13 @@ IS_LINUX="no" HAVE_QTBINDINGS=1 HAVE_QT_UITOOLS=1 +HAVE_QT_NETWORK=1 +HAVE_QT_SQL=1 +HAVE_QT_SVG=1 +HAVE_QT_PRINTSUPPORT=1 +HAVE_QT_MULTIMEDIA=1 +HAVE_QT_DESIGNER=1 +HAVE_QT_XML=1 HAVE_64BIT_COORD=0 HAVE_QT=1 HAVE_QT5="" # not set @@ -96,6 +103,27 @@ while [ "$*" != "" ]; do -without-qt-uitools) HAVE_QT_UITOOLS=0 ;; + -without-qt-network) + HAVE_QT_NETWORK=0 + ;; + -without-qt-sql) + HAVE_QT_SQL=0 + ;; + -without-qt-svg) + HAVE_QT_SVG=0 + ;; + -without-qt-printsupport) + HAVE_QT_PRINTSUPPORT=0 + ;; + -without-qt-multimedia) + HAVE_QT_MULTIMEDIA=0 + ;; + -without-qt-designer) + HAVE_QT_DESIGNER=0 + ;; + -without-qt-xml) + HAVE_QT_XML=0 + ;; -with-64bit-coord) HAVE_64BIT_COORD=1 ;; @@ -610,6 +638,13 @@ qmake_options=( HAVE_PYTHON="$HAVE_PYTHON" HAVE_QTBINDINGS="$HAVE_QTBINDINGS" HAVE_QT_UITOOLS="$HAVE_QT_UITOOLS" + HAVE_QT_NETWORK="$HAVE_QT_NETWORK" + HAVE_QT_SQL="$HAVE_QT_SQL" + HAVE_QT_SVG="$HAVE_QT_SVG" + HAVE_QT_PRINTSUPPORT="$HAVE_QT_PRINTSUPPORT" + HAVE_QT_MULTIMEDIA="$HAVE_QT_MULTIMEDIA" + HAVE_QT_DESIGNER="$HAVE_QT_DESIGNER" + HAVE_QT_XML="$HAVE_QT_XML" HAVE_64BIT_COORD="$HAVE_64BIT_COORD" HAVE_QT="$HAVE_QT" HAVE_QT5="$HAVE_QT5" diff --git a/src/gsiqt/qt4/qt4.pro b/src/gsiqt/qt4/qt4.pro index 4b511b874..5aeee7dfd 100644 --- a/src/gsiqt/qt4/qt4.pro +++ b/src/gsiqt/qt4/qt4.pro @@ -5,17 +5,29 @@ TEMPLATE = subdirs SUBDIRS = \ QtCore \ - QtGui \ - QtXml \ - QtSql \ - QtNetwork \ - QtDesigner + QtGui QtGui.depends += QtCore -QtNetwork.depends += QtCore -QtSql.depends += QtCore -QtDesigner.depends += QtCore -QtXml.depends += QtCore + +equals(HAVE_QT_NETWORK, "1") { + SUBDIRS += QtNetwork + QtNetwork.depends += QtCore +} + +equals(HAVE_QT_SQL, "1") { + SUBDIRS += QtSql + QtSql.depends += QtCore +} + +equals(HAVE_QT_DESIGNER, "1") { + SUBDIRS += QtDesigner + QtDesigner.depends += QtCore +} + +equals(HAVE_QT_XML, "1") { + SUBDIRS += QtXml + QtXml.depends += QtCore +} equals(HAVE_QT_UITOOLS, "1") { SUBDIRS += QtUiTools diff --git a/src/gsiqt/qt5/qt5.pro b/src/gsiqt/qt5/qt5.pro index 5e4fd0074..710001c57 100644 --- a/src/gsiqt/qt5/qt5.pro +++ b/src/gsiqt/qt5/qt5.pro @@ -6,26 +6,46 @@ TEMPLATE = subdirs SUBDIRS = \ QtCore \ QtGui \ - QtNetwork \ - QtSql \ - QtWidgets \ - QtDesigner \ - QtMultimedia \ - QtPrintSupport \ - QtSvg \ - QtXmlPatterns \ - QtXml + QtWidgets QtGui.depends += QtCore -QtNetwork.depends += QtCore -QtSql.depends += QtCore QtWidgets.depends += QtGui -QtDesigner.depends += QtCore -QtMultimedia.depends += QtCore QtWidgets QtNetwork -QtPrintSupport.depends += QtCore QtWidgets -QtSvg.depends += QtCore QtWidgets -QtXmlPatterns.depends += QtCore -QtXml.depends += QtCore + +equals(HAVE_QT_NETWORK, "1") { + SUBDIRS += QtNetwork + QtNetwork.depends += QtCore +} + +equals(HAVE_QT_SQL, "1") { + SUBDIRS += QtSql + QtSql.depends += QtCore +} + +equals(HAVE_QT_SVG, "1") { + SUBDIRS += QtSvg + QtSvg.depends += QtCore QtWidgets +} + +equals(HAVE_QT_PRINTSUPPORT, "1") { + SUBDIRS += QtPrintSupport + QtPrintSupport.depends += QtCore QtWidgets +} + +equals(HAVE_QT_MULTIMEDIA, "1") { + SUBDIRS += QtMultimedia + QtMultimedia.depends += QtCore QtWidgets QtNetwork +} + +equals(HAVE_QT_DESIGNER, "1") { + SUBDIRS += QtDesigner + QtDesigner.depends += QtCore +} + +equals(HAVE_QT_XML, "1") { + SUBDIRS += QtXml QtXmlPatterns + QtXmlPatterns.depends += QtCore + QtXml.depends += QtCore +} equals(HAVE_QT_UITOOLS, "1") { SUBDIRS += QtUiTools diff --git a/src/gsiqt/qtbasic/gsiQtDesignerExternals.h b/src/gsiqt/qtbasic/gsiQtDesignerExternals.h index ff9e70738..e969f0fea 100644 --- a/src/gsiqt/qtbasic/gsiQtDesignerExternals.h +++ b/src/gsiqt/qtbasic/gsiQtDesignerExternals.h @@ -20,7 +20,9 @@ */ -#if QT_VERSION >= 0x050000 +#if !defined(HAVE_QT_DESIGNER) +# define FORCE_LINK_GSI_QTDESIGNER +#elif QT_VERSION >= 0x050000 # include "../qt5/QtDesigner/gsiQtExternals.h" #else # include "../qt4/QtDesigner/gsiQtExternals.h" diff --git a/src/gsiqt/qtbasic/gsiQtMultimediaExternals.h b/src/gsiqt/qtbasic/gsiQtMultimediaExternals.h index 19dc5bf3b..92f3efc62 100644 --- a/src/gsiqt/qtbasic/gsiQtMultimediaExternals.h +++ b/src/gsiqt/qtbasic/gsiQtMultimediaExternals.h @@ -20,7 +20,9 @@ */ -#if QT_VERSION >= 0x050000 +#if !defined(HAVE_QT_MULTIMEDIA) +# define FORCE_LINK_GSI_QTMULTIMEDIA +#elif QT_VERSION >= 0x050000 # include "../qt5/QtMultimedia/gsiQtExternals.h" #else // no present in Qt4 diff --git a/src/gsiqt/qtbasic/gsiQtNetworkExternals.h b/src/gsiqt/qtbasic/gsiQtNetworkExternals.h index 98cd86856..d7032d221 100644 --- a/src/gsiqt/qtbasic/gsiQtNetworkExternals.h +++ b/src/gsiqt/qtbasic/gsiQtNetworkExternals.h @@ -20,7 +20,9 @@ */ -#if QT_VERSION >= 0x050000 +#if !defined(HAVE_QT_NETWORK) +# define FORCE_LINK_GSI_QTNETWORK +#elif QT_VERSION >= 0x050000 # include "../qt5/QtNetwork/gsiQtExternals.h" #else # include "../qt4/QtNetwork/gsiQtExternals.h" diff --git a/src/gsiqt/qtbasic/gsiQtPrintSupportExternals.h b/src/gsiqt/qtbasic/gsiQtPrintSupportExternals.h index 267b31b70..251a3dc79 100644 --- a/src/gsiqt/qtbasic/gsiQtPrintSupportExternals.h +++ b/src/gsiqt/qtbasic/gsiQtPrintSupportExternals.h @@ -20,7 +20,9 @@ */ -#if QT_VERSION >= 0x050000 +#if !defined(HAVE_QT_PRINTSUPPORT) +# define FORCE_LINK_GSI_QTPRINTSUPPORT +#elif QT_VERSION >= 0x050000 # include "../qt5/QtPrintSupport/gsiQtExternals.h" #else // no present in Qt4 diff --git a/src/gsiqt/qtbasic/gsiQtSqlExternals.h b/src/gsiqt/qtbasic/gsiQtSqlExternals.h index 0cb0a4740..b595853eb 100644 --- a/src/gsiqt/qtbasic/gsiQtSqlExternals.h +++ b/src/gsiqt/qtbasic/gsiQtSqlExternals.h @@ -20,7 +20,9 @@ */ -#if QT_VERSION >= 0x050000 +#if !defined(HAVE_QT_SQL) +# define FORCE_LINK_GSI_QTSQL +#elif QT_VERSION >= 0x050000 # include "../qt5/QtSql/gsiQtExternals.h" #else # include "../qt4/QtSql/gsiQtExternals.h" diff --git a/src/gsiqt/qtbasic/gsiQtSvgExternals.h b/src/gsiqt/qtbasic/gsiQtSvgExternals.h index ccbacac80..fd6468d92 100644 --- a/src/gsiqt/qtbasic/gsiQtSvgExternals.h +++ b/src/gsiqt/qtbasic/gsiQtSvgExternals.h @@ -20,7 +20,9 @@ */ -#if QT_VERSION >= 0x050000 +#if !defined(HAVE_QT_SVG) +# define FORCE_LINK_GSI_QTSVG +#elif QT_VERSION >= 0x050000 # include "../qt5/QtSvg/gsiQtExternals.h" #else // no present in Qt4 diff --git a/src/gsiqt/qtbasic/gsiQtXmlExternals.h b/src/gsiqt/qtbasic/gsiQtXmlExternals.h index ba1da7d32..b4713bd5c 100644 --- a/src/gsiqt/qtbasic/gsiQtXmlExternals.h +++ b/src/gsiqt/qtbasic/gsiQtXmlExternals.h @@ -20,7 +20,9 @@ */ -#if QT_VERSION >= 0x050000 +#if !defined(HAVE_QT_XML) +# define FORCE_LINK_GSI_QTXML +#elif QT_VERSION >= 0x050000 # include "../qt5/QtXml/gsiQtExternals.h" #else # include "../qt4/QtXml/gsiQtExternals.h" diff --git a/src/gsiqt/qtbasic/gsiQtXmlPatternsExternals.h b/src/gsiqt/qtbasic/gsiQtXmlPatternsExternals.h index ce56bc674..e5c48f1c0 100644 --- a/src/gsiqt/qtbasic/gsiQtXmlPatternsExternals.h +++ b/src/gsiqt/qtbasic/gsiQtXmlPatternsExternals.h @@ -20,7 +20,9 @@ */ -#if QT_VERSION >= 0x050000 +#if !defined(HAVE_QT_XML) +# define FORCE_LINK_GSI_QTXMLPATTERNS +#elif QT_VERSION >= 0x050000 # include "../qt5/QtXmlPatterns/gsiQtExternals.h" #else // Not present in Qt4 diff --git a/src/gsiqt/qtbasic/qtbasic.pro b/src/gsiqt/qtbasic/qtbasic.pro index 8f08982ac..cf9d23b78 100644 --- a/src/gsiqt/qtbasic/qtbasic.pro +++ b/src/gsiqt/qtbasic/qtbasic.pro @@ -17,5 +17,19 @@ SOURCES += \ gsiQtHelper.cc HEADERS += \ + gsiDeclQtAllTypeTraits.h \ gsiQt.h \ - gsiQtBasicCommon.h \ + gsiQtBasicCommon.h \ \ + gsiQtCoreExternals.h \ + gsiQtDesignerExternals.h \ + gsiQtGuiExternals.h \ + gsiQtHelper.h \ + gsiQtMultimediaExternals.h \ + gsiQtNetworkExternals.h \ + gsiQtPrintSupportExternals.h \ + gsiQtSqlExternals.h \ + gsiQtSvgExternals.h \ + gsiQtUiToolsExternals.h \ + gsiQtWidgetsExternals.h \ + gsiQtXmlExternals.h \ + gsiQtXmlPatternsExternals.h diff --git a/src/klayout.pri b/src/klayout.pri index 28ec64ef7..312e0c6a3 100644 --- a/src/klayout.pri +++ b/src/klayout.pri @@ -169,27 +169,81 @@ equals(HAVE_QT, "0") { } else { DEFINES += HAVE_QT - QT += core network xml sql + QT += core xml network + + equals(HAVE_QTBINDINGS, "1") { + # sql isn't needed by the base application + !equals(HAVE_QT_SQL, "0") { + QT += sql + } + } equals(HAVE_QT5, "1") { - QT += designer printsupport widgets + + QT += widgets gui printsupport + equals(HAVE_QTBINDINGS, "1") { - QT += multimedia multimediawidgets xmlpatterns svg gui - } - equals(HAVE_QT_UITOOLS, "1") { - QT += uitools + !equals(HAVE_QT_DESIGNER, "0") { + # designer isn't needed by the base application + QT += designer + } + !equals(HAVE_QT_MULTIMEDIA, "0") { + # multimedia isn't needed by the base application + QT += multimedia multimediawidgets + } + !equals(HAVE_QT_XML, "0") { + # xmlpatterns isn't needed by the base application + QT += xmlpatterns + } + !equals(HAVE_QT_SVG, "0") { + # svg isn't needed by the base application + QT += svg + } + !equals(HAVE_QT_UITOOLS, "0") { + # uitools isn't needed by the base application + QT += uitools + } } + } else { - CONFIG += designer - equals(HAVE_QT_UITOOLS, "1") { - CONFIG += uitools + + equals(HAVE_QTBINDINGS, "1") { + !equals(HAVE_QT_DESIGNER, "0") { + # designer isn't needed by the base application + CONFIG += designer + } + !equals(HAVE_QT_UITOOLS, "0") { + # uitools isn't needed by the base application + CONFIG += uitools + } } + } - equals(HAVE_QT_UITOOLS, "1") { + !equals(HAVE_QT_UITOOLS, "0") { DEFINES += HAVE_QT_UITOOLS } - + !equals(HAVE_QT_NETWORK, "0") { + DEFINES += HAVE_QT_NETWORK + } + !equals(HAVE_QT_SQL, "0") { + DEFINES += HAVE_QT_SQL + } + !equals(HAVE_QT_SVG, "0") { + DEFINES += HAVE_QT_SVG + } + !equals(HAVE_QT_PRINTSUPPORT, "0") { + DEFINES += HAVE_QT_PRINTSUPPORT + } + !equals(HAVE_QT_MULTIMEDIA, "0") { + DEFINES += HAVE_QT_MULTIMEDIA + } + !equals(HAVE_QT_DESIGNER, "0") { + DEFINES += HAVE_QT_DESIGNER + } + !equals(HAVE_QT_XML, "0") { + DEFINES += HAVE_QT_XML + } } VERSION_STRING = $$KLAYOUT_VERSION diff --git a/src/klayout_main/klayout_main/klayout_main.pro b/src/klayout_main/klayout_main/klayout_main.pro index acb5aeb23..31ab7eb22 100644 --- a/src/klayout_main/klayout_main/klayout_main.pro +++ b/src/klayout_main/klayout_main/klayout_main.pro @@ -26,11 +26,42 @@ INCLUDEPATH += $$QTBASIC_INC DEPENDPATH += $$QTBASIC_INC equals(HAVE_QTBINDINGS, "1") { - LIBS += -lklayout_qtbasic -lklayout_QtGui -lklayout_QtXml -lklayout_QtNetwork -lklayout_QtSql -lklayout_QtDesigner - equals(HAVE_QT_UITOOLS, "1") { + + LIBS += -lklayout_qtbasic -lklayout_QtGui + + !equals(HAVE_QT_XML, "0") { + LIBS += -lklayout_QtXml + } + !equals(HAVE_QT_NETWORK, "0") { + LIBS += -lklayout_QtNetwork + } + !equals(HAVE_QT_SQL, "0") { + LIBS += -lklayout_QtSql + } + !equals(HAVE_QT_DESIGNER, "0") { + LIBS += -lklayout_QtDesigner + } + !equals(HAVE_QT_UITOOLS, "0") { LIBS += -lklayout_QtUiTools } + equals(HAVE_QT5, "1") { - LIBS += -lklayout_QtMultimedia -lklayout_QtPrintSupport -lklayout_QtSvg -lklayout_QtWidgets -lklayout_QtXmlPatterns + + LIBS += -lklayout_QtWidgets + + !equals(HAVE_QT_MULTIMEDIA, "0") { + LIBS += -lklayout_QtMultimedia + } + !equals(HAVE_QT_PRINTSUPPORT, "0") { + LIBS += -lklayout_QtPrintSupport + } + !equals(HAVE_QT_SVG, "0") { + LIBS += -lklayout_QtSvg + } + !equals(HAVE_QT_XML, "0") { + LIBS += -lklayout_QtXmlPatterns + } + } + } diff --git a/src/lay/lay/gsiDeclLayHelpDialog.cc b/src/lay/lay/gsiDeclLayHelpDialog.cc index 4eea9886c..1cb6fb7f1 100644 --- a/src/lay/lay/gsiDeclLayHelpDialog.cc +++ b/src/lay/lay/gsiDeclLayHelpDialog.cc @@ -97,7 +97,7 @@ Class decl_HelpDialog (QT_EXTERNAL_BASE (QDialog) "lay", "HelpD LAYBASIC_PUBLIC Class &laybasicdecl_BrowserSource (); Class decl_HelpSource (laybasicdecl_BrowserSource (), "lay", "HelpSource", -#if defined(HAVE_QTBINDINGS) +#if defined(HAVE_QTBINDINGS) && defined(HAVE_QT_XML) gsi::method ("get_dom", &lay::HelpSource::get_dom, "@brief For internal use") + #endif gsi::method ("urls", &lay::HelpSource::urls, "@brief Reserved for internal use") + diff --git a/src/lay/lay/lay.pro b/src/lay/lay/lay.pro index f2ba59502..8a07f7da3 100644 --- a/src/lay/lay/lay.pro +++ b/src/lay/lay/lay.pro @@ -203,7 +203,10 @@ INCLUDEPATH += $$QTBASIC_INC DEPENDPATH += $$QTBASIC_INC equals(HAVE_QTBINDINGS, "1") { - LIBS += -lklayout_qtbasic -lklayout_QtGui -lklayout_QtXml -lklayout_QtCore + LIBS += -lklayout_qtbasic -lklayout_QtGui -lklayout_QtCore + !equals(HAVE_QT_XML, "0") { + LIBS += -lklayout_QtXml + } equals(HAVE_QT5, "1") { LIBS += -lklayout_QtWidgets } diff --git a/src/pymod/QtUiTools/QtUiTools.pro b/src/pymod/QtUiTools/QtUiTools.pro index c378c58ea..2c1ed0966 100644 --- a/src/pymod/QtUiTools/QtUiTools.pro +++ b/src/pymod/QtUiTools/QtUiTools.pro @@ -8,9 +8,6 @@ SOURCES = \ HEADERS += \ -equals(HAVE_QT_UITOOLS, "1") { - LIBS += -lklayout_QtUiTools -} - +LIBS += -lklayout_QtUiTools LIBS += -lklayout_QtCore diff --git a/src/pymod/QtUiTools/QtUiToolsMain.cc b/src/pymod/QtUiTools/QtUiToolsMain.cc index d70d419d4..7038f2bfa 100644 --- a/src/pymod/QtUiTools/QtUiToolsMain.cc +++ b/src/pymod/QtUiTools/QtUiToolsMain.cc @@ -26,10 +26,8 @@ #include "../../gsiqt/qtbasic/gsiQtCoreExternals.h" FORCE_LINK_GSI_QTCORE -#if defined(HAVE_QT_UITOOLS) # include "../../gsiqt/qtbasic/gsiQtUiToolsExternals.h" FORCE_LINK_GSI_QTUITOOLS -#endif DEFINE_PYMOD(QtUiTools, "QtUiTools", "KLayout/Qt module 'QtUiTools'") diff --git a/src/pymod/pymod.pro b/src/pymod/pymod.pro index 71f8ddaaa..1b1998702 100644 --- a/src/pymod/pymod.pro +++ b/src/pymod/pymod.pro @@ -14,34 +14,49 @@ SUBDIRS = \ equals(HAVE_QTBINDINGS, "1") { + SUBDIRS += \ + QtCore \ + QtGui + equals(HAVE_QT5, "1") { - SUBDIRS += \ - QtCore \ - QtGui \ - QtNetwork \ - QtSql \ - QtWidgets \ - QtDesigner \ - QtMultimedia \ - QtPrintSupport \ - QtSvg \ - QtXmlPatterns \ - QtXml + SUBDIRS += QtWidgets - } else { + !equals(HAVE_QT_MULTIMEDIA, "0") { + SUBDIRS += QtMultimedia + } - SUBDIRS += \ - QtCore \ - QtGui \ - QtXml \ - QtSql \ - QtNetwork \ - QtDesigner + !equals(HAVE_QT_PRINTSUPPORT, "0") { + SUBDIRS += QtPrintSupport + } + + !equals(HAVE_QT_SVG, "0") { + SUBDIRS += QtSvg + } + + !equals(HAVE_QT_XML, "0") { + SUBDIRS += QtXmlPatterns + } } - equals(HAVE_QT_UITOOLS, "1") { + !equals(HAVE_QT_XML, "0") { + SUBDIRS += QtXml + } + + !equals(HAVE_QT_SQL, "0") { + SUBDIRS += QtSql + } + + !equals(HAVE_QT_NETWORK, "0") { + SUBDIRS += QtNetwork + } + + !equals(HAVE_QT_DESIGNER, "0") { + SUBDIRS += QtDesigner + } + + !equals(HAVE_QT_UITOOLS, "0") { SUBDIRS += QtUiTools } diff --git a/src/pymod/unit_tests/pymod_tests.cc b/src/pymod/unit_tests/pymod_tests.cc index 9812fa666..2e9d1d590 100644 --- a/src/pymod/unit_tests/pymod_tests.cc +++ b/src/pymod/unit_tests/pymod_tests.cc @@ -94,24 +94,37 @@ PYMODTEST (import_lay, "import_lay.py") PYMODTEST (import_QtCore, "import_QtCore.py") PYMODTEST (import_QtGui, "import_QtGui.py") +#if defined(HAVE_QT_XML) PYMODTEST (import_QtXml, "import_QtXml.py") +#endif +#if defined(HAVE_QT_SQL) PYMODTEST (import_QtSql, "import_QtSql.py") +#endif +#if defined(HAVE_QT_NETWORK) PYMODTEST (import_QtNetwork, "import_QtNetwork.py") +#endif +#if defined(HAVE_QT_DESIGNER) PYMODTEST (import_QtDesigner, "import_QtDesigner.py") - +#endif #if defined(HAVE_QT_UITOOLS) - PYMODTEST (import_QtUiTools, "import_QtUiTools.py") - #endif #if QT_VERSION >= 0x50000 PYMODTEST (import_QtWidgets, "import_QtWidgets.py") +#if defined(HAVE_QT_MULTIMEDIA) PYMODTEST (import_QtMultimedia, "import_QtMultimedia.py") +#endif +#if defined(HAVE_QT_PRINTSUPPORT) PYMODTEST (import_QtPrintSupport, "import_QtPrintSupport.py") +#endif +#if defined(HAVE_QT_SVG) PYMODTEST (import_QtSvg, "import_QtSvg.py") +#endif +#if defined(HAVE_QT_XML) PYMODTEST (import_QtXmlPatterns, "import_QtXmlPatterns.py") +#endif #endif diff --git a/src/unit_tests/unit_tests.pro b/src/unit_tests/unit_tests.pro index a5eb77c46..1676e614a 100644 --- a/src/unit_tests/unit_tests.pro +++ b/src/unit_tests/unit_tests.pro @@ -34,7 +34,9 @@ LIBS += -lklayout_gsi_test DEPENDPATH += $$QTBASIC_INC equals(HAVE_QTBINDINGS, "1") { - LIBS += -lklayout_QtXml + !equals(HAVE_QT_XML, "0") { + LIBS += -lklayout_QtXml + } equals(HAVE_QT5, "1") { LIBS += -lklayout_QtWidgets }