Merge pull request #255 from KLayout/issue-252

Issue 252
This commit is contained in:
Matthias Köfferlein 2019-04-04 07:31:51 +02:00 committed by GitHub
commit 6be05609e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 90 additions and 6 deletions

View File

@ -555,6 +555,7 @@ script:
python testdata/pymod/import_db.py;
python testdata/pymod/import_rdb.py;
python testdata/pymod/import_tl.py;
python testdata/pymod/import_lib.py;
python testdata/pymod/pya_tests.py;
fi
fi
@ -565,6 +566,7 @@ script:
python testdata/pymod/import_db.py;
python testdata/pymod/import_rdb.py;
python testdata/pymod/import_tl.py;
python testdata/pymod/import_lib.py;
python testdata/pymod/pya_tests.py;
klayout_version=$(python -c 'import setup; print(setup.Config().version())');
mkdir -p deploy/dist-pymod/$klayout_version;

View File

@ -84,6 +84,7 @@ jobs:
python testdata/pymod/import_db.py
python testdata/pymod/import_rdb.py
python testdata/pymod/import_tl.py
python testdata/pymod/import_lib.py
python testdata/pymod/pya_tests.py
displayName: 'Test KLayout pymod'

View File

@ -403,6 +403,22 @@ _db = Library(config.root + '._db',
sources=list(_db_sources))
config.add_extension(_db)
# ------------------------------------------------------------------
# _lib dependency library
_lib_path = os.path.join("src", "lib", "lib")
_lib_sources = set(glob.glob(os.path.join(_lib_path, "*.cc")))
_lib = Library(config.root + '._lib',
define_macros=config.macros() + [('MAKE_LIB_LIBRARY', 1)],
include_dirs=[_tl_path, _gsi_path, _db_path, _lib_path],
extra_objects=[config.path_of('_tl', _tl_path), config.path_of('_gsi', _gsi_path), config.path_of('_db', _db_path)],
language='c++',
extra_link_args=config.link_args('_lib'),
extra_compile_args=config.compile_args('_lib'),
sources=list(_lib_sources))
config.add_extension(_lib)
# ------------------------------------------------------------------
# _rdb dependency library
@ -472,6 +488,19 @@ db = Extension(config.root + '.dbcore',
extra_link_args=config.link_args('dbcore'),
sources=list(db_sources))
# ------------------------------------------------------------------
# lib extension library
lib_path = os.path.join("src", "pymod", "lib")
lib_sources = set(glob.glob(os.path.join(lib_path, "*.cc")))
lib = Extension(config.root + '.libcore',
define_macros=config.macros(),
include_dirs=[_lib_path, _tl_path, _gsi_path, _pya_path],
extra_objects=[config.path_of('_lib', _lib_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('libcore'),
sources=list(lib_sources))
# ------------------------------------------------------------------
# rdb extension library
@ -481,7 +510,7 @@ rdb_sources = set(glob.glob(os.path.join(rdb_path, "*.cc")))
rdb = Extension(config.root + '.rdbcore',
define_macros=config.macros(),
include_dirs=[_rdb_path, _db_path, _tl_path, _gsi_path, _pya_path],
include_dirs=[_rdb_path, _tl_path, _gsi_path, _pya_path],
extra_objects=[config.path_of('_rdb', _rdb_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('rdbcore'),
sources=list(rdb_sources))
@ -511,4 +540,4 @@ if __name__ == '__main__':
url='https://github.com/klayoutmatthias/klayout',
packages=find_packages('src/pymod/distutils_src'),
package_dir={'': 'src/pymod/distutils_src'}, # https://github.com/pypa/setuptools/issues/230
ext_modules=[_tl, _gsi, _pya, _db, _rdb] + db_plugins + [tl, db, rdb])
ext_modules=[_tl, _gsi, _pya, _db, _lib, _rdb] + db_plugins + [tl, db, lib, rdb])

View File

@ -1,5 +1,5 @@
# klayout library definition file
__all__ = [ "tl", "db", "lay", "rdb" ]
__all__ = [ "tl", "db", "lib", "lay", "rdb" ]

View File

@ -1,5 +1,5 @@
# klayout library definition file
__all__ = [ "tl", "db", "rdb", "QtCore", "QtGui", "QtXml", "QtSql", "QtNetwork", "QtDesigner", "lay" ]
__all__ = [ "tl", "db", "lib", "rdb", "QtCore", "QtGui", "QtXml", "QtSql", "QtNetwork", "QtDesigner", "lay" ]

View File

@ -1,7 +1,7 @@
# klayout library definition file
__all__ = [ "tl", "db", "rdb",
__all__ = [ "tl", "db", "lib", "rdb",
"QtCore", "QtGui", "QtNetwork", "QtSql", "QtWidgets", "QtDesigner",
"QtMultimedia", "QtPrintSupport", "QtSvg", "QtXmlPatterns", "QtXml",
"lay" ]

View File

@ -1,4 +1,4 @@
# klayout library definition file
__all__ = [ "tl", "db", "rdb" ]
__all__ = [ "tl", "db", "lib", "rdb" ]

View File

@ -0,0 +1,4 @@
import klayout.libcore
from klayout.libcore import *
__all__ = klayout.libcore.__all__

View File

@ -3,5 +3,6 @@
# TODO: We need a specification document explaining what should go into pya
from klayout.db import * # noqa
from klayout.lib import * # noqa
from klayout.tl import * # noqa
from klayout.rdb import * # noqa

13
src/pymod/lib/lib.pro Normal file
View File

@ -0,0 +1,13 @@
TARGET = libcore
REALMODULE = lib
include($$PWD/../pymod.pri)
SOURCES = \
libMain.cc \
HEADERS += \
LIBS += -lklayout_lib

33
src/pymod/lib/libMain.cc Normal file
View File

@ -0,0 +1,33 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2019 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "../pymodHelper.h"
// to force linking of the lib module
#include "../../lib/lib/libForceLink.h"
static PyObject *lib_module_init (const char *pymod_name, const char *mod_name, const char *mod_description)
{
return module_init (pymod_name, mod_name, mod_description);
}
DEFINE_PYMOD_WITH_INIT(libcore, "lib", "KLayout core module 'lib'", lib_module_init)

View File

@ -4,6 +4,7 @@ SUBDIRS = \
db \
tl \
rdb \
lib \
!equals(HAVE_QT, "0") {