WIP remove pybind11 sources from dune-common
restructure python bindings so that no module is compiled during the build of dune-common
:
-
_common.so
and_typeregistry.so
are build withindune-py
during import ofdune.common
/dune.typeregistry
(if required) - no additional build time required with activated python bindings - so default can be
TRUE
-
pybind11
is not needed during build ofdune-common
so we can simply addpybind11
as
required package tosetup.py
and have it pip installed during the installation of the dune bindings - we can then remove the
pybind11
sources from dune-commom
Requires additional changes in all downstream modules with python bindings since
#include <dune/python/pybind11/...>
needs replacing with
#include <pybind11/...>
and any module now build during the configuration of a module (i.e. _grid
) needs to add
something like (should be simplified in some utility function)
try:
from dune.generated._grid import *
except ImportError:
from dune.utility import buildAndImportModule
buildAndImportModule(__file__,"_grid",globals())
to __init__.py
instead of
from ._grid import *
To Do
- The embedded tests are not yet working because the include path for pybind11 is missing
but we should now be able to use the cmake functions available in
pybind11
- everything else involving
dune.common
seems to be working but more tests needed -
Question: at the moment
DuneAddPybind11Module
is still indune-common
but could be generated while setting updune-py
(but perhaps its useful outside ofdune-py
?)
Changes
- removed
dune/python/pybind11
- made sure nothing needed to build
dune-py
involved importing anything fromdune.common
since_common.so
needs to be build as soon asdune.common
is imported. Thus lead to a lot of changes in the commit that don't really do much:- moved dune module build code from
dune.common
todune.project
- needed some changes also in
dune.generator
and in thedune-common/bin
scripts
- moved dune module build code from
- all C++ header files for the bindings needed include statements changed
Edited by Simon Praetorius