From 5facc418cb7d9d12444e64959cc605d0719a37e5 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Thu, 12 May 2022 23:42:21 +0200 Subject: [PATCH] WIP: futher improvements on Python module for Qt-less case --- MANIFEST.in | 12 ++++-- setup.py | 38 +++++++++---------- src/klayout.pro | 3 +- src/laybasic/laybasic/laybasic.pro | 6 +-- src/pya/pya/pyaModule.cc | 5 +++ .../distutils_src/klayout/lay/__init__.py | 11 +----- src/pymod/lay/layMain.cc | 8 ++++ 7 files changed, 48 insertions(+), 35 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 531a510b2..42f956cba 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,10 +1,16 @@ -recursive-include src/tl/tl *.cc *.h +recursive-include src/ant/ant *.cc *.h recursive-include src/db/db *.cc *.cc_gen *.h +recursive-include src/edt/edt *.cc *.h recursive-include src/gsi/gsi *.cc *.h -recursive-include src/rdb/rdb *.cc *.h -recursive-include src/pya/pya *.cc *.h +recursive-include src/img/img *.cc *.h +recursive-include src/laybasic/laybasic *.cc *.h recursive-include src/lib/lib *.cc *.h +recursive-include src/lym/lym *.cc *.h +recursive-include src/pya/pya *.cc *.h recursive-include src/pymod *.cc *.h +recursive-include src/rbastub *.cc *.h +recursive-include src/rdb/rdb *.cc *.h +recursive-include src/tl/tl *.cc *.h include src/plugins/*/db_plugin/*.cc include src/plugins/*/*/db_plugin/*.cc include src/plugins/*/db_plugin/*.h diff --git a/setup.py b/setup.py index 595d035f1..bf826a911 100644 --- a/setup.py +++ b/setup.py @@ -523,6 +523,23 @@ _rdb = Library(config.root + '._rdb', sources=list(_rdb_sources)) config.add_extension(_rdb) +# ------------------------------------------------------------------ +# _lay dependency library + +_lay_path = os.path.join("src", "laybasic", "laybasic") +_lay_sources = set(glob.glob(os.path.join(_lay_path, "*.cc"))) + +_lay = Library(config.root + '._lay', + define_macros=config.macros() + [('MAKE_LAYBASIC_LIBRARY', 1)], + include_dirs=[_rdb_path, _db_path, _tl_path, _gsi_path], + extra_objects=[config.path_of('_rdb', _rdb_path), config.path_of('_tl', _tl_path), config.path_of('_gsi', _gsi_path), config.path_of('_db', _db_path)], + language='c++', + libraries=config.libraries('_lay'), + extra_link_args=config.link_args('_lay'), + extra_compile_args=config.compile_args('_lay'), + sources=list(_lay_sources)) +config.add_extension(_lay) + # ------------------------------------------------------------------ # _lym dependency library @@ -540,23 +557,6 @@ _lym = Library(config.root + '._lym', sources=list(_lym_sources)) config.add_extension(_lym) -# ------------------------------------------------------------------ -# _lay dependency library - -_lay_path = os.path.join("src", "laybasic", "laybasic") -_lay_sources = set(glob.glob(os.path.join(_lay_path, "*.cc"))) - -_lay = Library(config.root + '._lay', - define_macros=config.macros() + [('MAKE_LAYBASIC_LIBRARY', 1)], - include_dirs=[_lym_path, _rdb_path, _db_path, _tl_path, _gsi_path], - extra_objects=[config.path_of('_lym', _lym_path), config.path_of('_rdb', _rdb_path), config.path_of('_tl', _tl_path), config.path_of('_gsi', _gsi_path), config.path_of('_db', _db_path)], - language='c++', - libraries=config.libraries('_lay'), - extra_link_args=config.link_args('_lay'), - extra_compile_args=config.compile_args('_lay'), - sources=list(_lay_sources)) -config.add_extension(_lay) - # ------------------------------------------------------------------ # _ant dependency library @@ -699,8 +699,8 @@ lay_sources = set(glob.glob(os.path.join(lay_path, "*.cc"))) lay = Extension(config.root + '.laycore', define_macros=config.macros(), - include_dirs=[_lay_path, _tl_path, _gsi_path, _pya_path], - extra_objects=[config.path_of('_lay', _lay_path), config.path_of('_tl', _tl_path), config.path_of('_gsi', _gsi_path), config.path_of('_pya', _pya_path)], + include_dirs=[_lay_path, _img_path, _ant_path, _edt_path, _lym_path, _tl_path, _gsi_path, _pya_path], + extra_objects=[config.path_of('_lay', _lay_path), config.path_of('_img', _img_path), config.path_of('_ant', _ant_path), config.path_of('_edt', _edt_path), config.path_of('_lym', _lym_path), config.path_of('_tl', _tl_path), config.path_of('_gsi', _gsi_path), config.path_of('_pya', _pya_path)], extra_link_args=config.link_args('laycore'), extra_compile_args=config.compile_args('laycore'), sources=list(lay_sources)) diff --git a/src/klayout.pro b/src/klayout.pro index 1c6045181..c682bb064 100644 --- a/src/klayout.pro +++ b/src/klayout.pro @@ -64,7 +64,8 @@ lib.depends += db buddies.depends += plugins lym $$LANG_DEPENDS lym.depends += gsi $$LANG_DEPENDS -laybasic.depends += rdb lym + +laybasic.depends += rdb ant.depends += laybasic img.depends += laybasic diff --git a/src/laybasic/laybasic/laybasic.pro b/src/laybasic/laybasic/laybasic.pro index b0750a4e6..95ac373fa 100644 --- a/src/laybasic/laybasic/laybasic.pro +++ b/src/laybasic/laybasic/laybasic.pro @@ -337,9 +337,9 @@ HEADERS += \ laybasicCommon.h \ -INCLUDEPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LYM_INC -DEPENDPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LYM_INC -LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_db -lklayout_rdb -lklayout_lym +INCLUDEPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC +DEPENDPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC +LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_db -lklayout_rdb INCLUDEPATH += $$QTBASIC_INC DEPENDPATH += $$QTBASIC_INC diff --git a/src/pya/pya/pyaModule.cc b/src/pya/pya/pyaModule.cc index 0f962fa7e..5eff6c85d 100644 --- a/src/pya/pya/pyaModule.cc +++ b/src/pya/pya/pyaModule.cc @@ -2403,6 +2403,11 @@ public: PyTypeObject *make_class (const gsi::ClassBase *cls, bool as_static) { + // drop non-standard names + if (tl::verbosity () >= 40) { + tl::info << tl::sprintf (tl::to_string (tr ("Creating class %s.%s")), PyModule_GetName (mp_module->module ()), cls->name ()); + } + // NOTE: with as_static = true, this method produces a mixin. This is a class entirely consisting // of static constants and child classes only. It can be mixed into an existing class for emulation // additional base classes. diff --git a/src/pymod/distutils_src/klayout/lay/__init__.py b/src/pymod/distutils_src/klayout/lay/__init__.py index ee976c13d..3f8edad9e 100644 --- a/src/pymod/distutils_src/klayout/lay/__init__.py +++ b/src/pymod/distutils_src/klayout/lay/__init__.py @@ -1,12 +1,5 @@ import klayout.laycore -import klayout.antcore -import klayout.edtcore -import klayout.imgcore -import klayout.lymcore -from klayout.laycore import * -from klayout.antcore import * -from klayout.edtcore import * -from klayout.imgcore import * + from klayout.laycore import * -__all__ = klayout.laycore.__all__ + klayout.antcore.__all__ + klayout.edtcore.__all__ + klayout.imgcore.__all__ + klayout.laycore.__all__ +__all__ = klayout.laycore.__all__ diff --git a/src/pymod/lay/layMain.cc b/src/pymod/lay/layMain.cc index 1e1de16bc..0547098ca 100644 --- a/src/pymod/lay/layMain.cc +++ b/src/pymod/lay/layMain.cc @@ -31,4 +31,12 @@ # include "../../laybasic/laybasic/laybasicForceLink.h" #endif +// Force-include other dependencies +// NOTE: these libraries contribute to the "lay" module space. Hence we have to include them. +#include "../../ant/ant/antForceLink.h" +#include "../../img/img/imgForceLink.h" +#include "../../edt/edt/edtForceLink.h" +#include "../../lym/lym/lymForceLink.h" + DEFINE_PYMOD(laycore, "lay", "KLayout core module 'lay'") +