|
TJ has a branch that can be set to build the SMTK python bindings using [pybind11](https://pybind11.readthedocs.io/en/latest/) instead of the default shiboken tool chain. There are a number of motivations for this, for example, eliminating the Qt dependency, but the primary factor was the recent discovery of inconsistent output from the shiboken generator code.
|
|
|
|
|
|
|
|
In order to remain backward-compatible with the current (Shiboken-based) implementation, the new SMTK branch uses a cmake option (SMTK_USE_PYBIND11) to enable the use of pybind
|
|
|
|
|
|
|
|
To build SMTK with pybind11:
|
|
|
|
* Currently you must clone TJ's repository, which is at git@gitlab.kitware.com:tjcorona/smtk.git, and checkout the "pybind" branch. (At some point, this will be merged into smtk:master.)
|
|
|
|
* In the source directory, run "git submodule init" and "git submodule update" to pull the pybind11 source files into the local source tree.
|
|
|
|
* Run cmake and enable the option SMTK_USE_PYBIND11.
|
|
|
|
* Build SMTK and verify that all tests pass.
|
|
|
|
|
|
|
|
With the current implementation, all python bindings are specified in header files located in pybind folders under each SMTK namespace, for example smtk/common/pybind/ and smtk/attribute/pybind/. In the current implementation, these files must be updated manually in conjunction with each API change in the corresponding C++ class. To support this, there is a script file at utilites/python/generate_pybind11_bindings.py that can auto-generate the bindings source files. This script imports the python [pygccxml](https://github.com/gccxml/pygccxml) module, which in turn requires the [CastXML](https://github.com/CastXML/CastXML) library to be installed on your system.
|
|
With the current implementation, all python bindings are specified in header files located in pybind folders under each SMTK namespace, for example smtk/common/pybind/ and smtk/attribute/pybind/. In the current implementation, these files must be updated manually in conjunction with each API change in the corresponding C++ class. To support this, there is a script file at utilites/python/generate_pybind11_bindings.py that can auto-generate the bindings source files. This script imports the python [pygccxml](https://github.com/gccxml/pygccxml) module, which in turn requires the [CastXML](https://github.com/CastXML/CastXML) library to be installed on your system.
|
|
|
|
|
|
|
|
|