From e5aa55a25c876626925a8995c4df5b7216371198 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 9 Jun 2018 17:01:52 +0200 Subject: [PATCH] Support for Qt-binding-less Python modules. --- src/klayout_main/klayout_main/klayout.cc | 20 ++++++++++++------- src/lay/lay/gsiDeclLayApplication.cc | 19 +++++++++++++++--- src/lay/lay/gsiDeclLayHelpDialog.cc | 9 +++++++-- src/lay/lay/gsiDeclLayMainWindow.cc | 9 +++++++-- src/laybasic/laybasic/gsiDeclLayDialogs.cc | 10 ++++++++-- src/laybasic/laybasic/gsiDeclLayLayoutView.cc | 9 +++++++-- 6 files changed, 58 insertions(+), 18 deletions(-) diff --git a/src/klayout_main/klayout_main/klayout.cc b/src/klayout_main/klayout_main/klayout.cc index 80eb28fb0..29cb382b7 100644 --- a/src/klayout_main/klayout_main/klayout.cc +++ b/src/klayout_main/klayout_main/klayout.cc @@ -43,17 +43,19 @@ #include "libForceLink.h" #include "antForceLink.h" #include "imgForceLink.h" -#ifdef HAVE_RUBY +#if defined(HAVE_RUBY) #include "drcForceLink.h" #endif +#if defined(HAVE_QTBINDINGS) + // pulls in the Qt GSI binding modules -#include "gsiQtGuiExternals.h" -#include "gsiQtCoreExternals.h" -#include "gsiQtXmlExternals.h" -#include "gsiQtSqlExternals.h" -#include "gsiQtNetworkExternals.h" -#include "gsiQtDesignerExternals.h" +# include "gsiQtGuiExternals.h" +# include "gsiQtCoreExternals.h" +# include "gsiQtXmlExternals.h" +# include "gsiQtSqlExternals.h" +# include "gsiQtNetworkExternals.h" +# include "gsiQtDesignerExternals.h" FORCE_LINK_GSI_QTCORE FORCE_LINK_GSI_QTGUI @@ -62,6 +64,10 @@ FORCE_LINK_GSI_QTDESIGNER FORCE_LINK_GSI_QTNETWORK FORCE_LINK_GSI_QTSQL +#else +# define QT_EXTERNAL_BASE(x) +#endif + #include #include #include diff --git a/src/lay/lay/gsiDeclLayApplication.cc b/src/lay/lay/gsiDeclLayApplication.cc index a00550fa6..c5e97bc15 100644 --- a/src/lay/lay/gsiDeclLayApplication.cc +++ b/src/lay/lay/gsiDeclLayApplication.cc @@ -24,11 +24,14 @@ #include "layMainWindow.h" #include "laySignalHandler.h" #include "gsiDecl.h" +#include "tlArch.h" + +#if defined(HAVE_QTBINDINGS) + #include "gsiQtGuiExternals.h" #include "gsiQtWidgetsExternals.h" // for Qt5 #include "gsiQtCoreExternals.h" #include "gsiQtXmlExternals.h" -#include "tlArch.h" // this is here *once* FORCE_LINK_GSI_QTCORE @@ -37,6 +40,8 @@ FORCE_LINK_GSI_QTWIDGETS // required because the GSI bindings use QDomDocument FORCE_LINK_GSI_QTXML +#endif + namespace gsi { @@ -254,7 +259,11 @@ LAY_PUBLIC make_application_decl (bool non_gui_mode) if (non_gui_mode) { non_gui_app_decl.reset ( - new Class (QT_EXTERNAL_BASE (QCoreApplication) "lay", "Application", + new Class ( +#if defined(HAVE_QTBINDINGS) + QT_EXTERNAL_BASE (QCoreApplication) +#endif + "lay", "Application", application_methods (), application_doc () ) @@ -263,7 +272,11 @@ LAY_PUBLIC make_application_decl (bool non_gui_mode) } else { gui_app_decl.reset ( - new Class (QT_EXTERNAL_BASE (QApplication) "lay", "Application", + new Class ( +#if defined(HAVE_QTBINDINGS) + QT_EXTERNAL_BASE (QApplication) +#endif + "lay", "Application", application_methods (), application_doc () ) diff --git a/src/lay/lay/gsiDeclLayHelpDialog.cc b/src/lay/lay/gsiDeclLayHelpDialog.cc index 84b1d7234..980249fdb 100644 --- a/src/lay/lay/gsiDeclLayHelpDialog.cc +++ b/src/lay/lay/gsiDeclLayHelpDialog.cc @@ -26,8 +26,13 @@ #include "layMainWindow.h" #include "laybasicCommon.h" #include "gsiDecl.h" -#include "gsiQtGuiExternals.h" -#include "gsiQtWidgetsExternals.h" + +#if defined(HAVE_QTBINDINGS) +# include "gsiQtGuiExternals.h" +# include "gsiQtWidgetsExternals.h" +#else +# define QT_EXTERNAL_BASE(x) +#endif namespace tl { diff --git a/src/lay/lay/gsiDeclLayMainWindow.cc b/src/lay/lay/gsiDeclLayMainWindow.cc index 8cfd7f66c..c5ac84bc2 100644 --- a/src/lay/lay/gsiDeclLayMainWindow.cc +++ b/src/lay/lay/gsiDeclLayMainWindow.cc @@ -22,10 +22,15 @@ #include "gsiDecl.h" #include "gsiSignals.h" -#include "gsiQtGuiExternals.h" -#include "gsiQtWidgetsExternals.h" // for Qt5 #include "layMainWindow.h" +#if defined(HAVE_QTBINDINGS) +# include "gsiQtGuiExternals.h" +# include "gsiQtWidgetsExternals.h" // for Qt5 +#else +# define QT_EXTERNAL_BASE(x) +#endif + namespace gsi { diff --git a/src/laybasic/laybasic/gsiDeclLayDialogs.cc b/src/laybasic/laybasic/gsiDeclLayDialogs.cc index 6aa3f587a..95a1503cc 100644 --- a/src/laybasic/laybasic/gsiDeclLayDialogs.cc +++ b/src/laybasic/laybasic/gsiDeclLayDialogs.cc @@ -22,8 +22,6 @@ #include "gsiDecl.h" #include "gsiDeclBasic.h" -#include "gsiQtGuiExternals.h" -#include "gsiQtWidgetsExternals.h" #include "layBrowserDialog.h" #include "layBrowserPanel.h" @@ -35,9 +33,17 @@ #include +#if defined(HAVE_QTBINDINGS) +# include "gsiQtGuiExternals.h" +# include "gsiQtWidgetsExternals.h" + FORCE_LINK_GSI_QTGUI FORCE_LINK_GSI_QTWIDGETS // for Qt5 +#else +# define QT_EXTERNAL_BASE(x) +#endif + namespace gsi { diff --git a/src/laybasic/laybasic/gsiDeclLayLayoutView.cc b/src/laybasic/laybasic/gsiDeclLayLayoutView.cc index 72fcf2ed3..4973fa550 100644 --- a/src/laybasic/laybasic/gsiDeclLayLayoutView.cc +++ b/src/laybasic/laybasic/gsiDeclLayLayoutView.cc @@ -23,8 +23,6 @@ #include "gsiDecl.h" #include "gsiSignals.h" -#include "gsiQtGuiExternals.h" -#include "gsiQtWidgetsExternals.h" // for Qt5 #include "rdb.h" #include "layLayoutView.h" #include "layDitherPattern.h" @@ -32,6 +30,13 @@ #include "dbSaveLayoutOptions.h" #include "tlStream.h" +#if defined(HAVE_QTBINDINGS) +# include "gsiQtGuiExternals.h" +# include "gsiQtWidgetsExternals.h" // for Qt5 +#else +# define QT_EXTERNAL_BASE(x) +#endif + namespace gsi {