WIP remove pybind11 sources from dune-common
restructure python bindings so that no module is compiled during the build of dune-common:
-
_common.soand_typeregistry.soare build withindune-pyduring import ofdune.common/dune.typeregistry(if required) - no additional build time required with activated python bindings - so default can be
TRUE -
pybind11is not needed during build ofdune-commonso we can simply addpybind11as
required package tosetup.pyand have it pip installed during the installation of the dune bindings - we can then remove the
pybind11sources 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.commonseems to be working but more tests needed -
Question: at the moment
DuneAddPybind11Moduleis still indune-commonbut 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-pyinvolved importing anything fromdune.commonsince_common.soneeds to be build as soon asdune.commonis imported. Thus lead to a lot of changes in the commit that don't really do much:- moved dune module build code from
dune.commontodune.project - needed some changes also in
dune.generatorand in thedune-common/binscripts
- moved dune module build code from
- all C++ header files for the bindings needed include statements changed
Edited by Simon Praetorius