diff --git a/dune/xt/CMakeLists.txt b/dune/xt/CMakeLists.txt index 527d79fb015838660c10eed156703235b233eb2c..59ba06247d98eceb8eb98e78916d9dd900824844 100644 --- a/dune/xt/CMakeLists.txt +++ b/dune/xt/CMakeLists.txt @@ -6,3 +6,9 @@ # Felix Schindler (2016) add_subdirectory(la) + +if(dune-pybindxi_FOUND) + dune_pybindxi_add_module(la la/bindings.cc) + target_link_dune_default_libraries(la) +endif() + diff --git a/dune/xt/la/bindings.cc b/dune/xt/la/bindings.cc new file mode 100644 index 0000000000000000000000000000000000000000..0e65fb0216a8c168468ca4484bd339490af4fe4b --- /dev/null +++ b/dune/xt/la/bindings.cc @@ -0,0 +1,40 @@ +// This file is part of the dune-xt-la project: +// https://github.com/dune-community/dune-xt-la +// The copyright lies with the authors of this file (see below). +// License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause) +// or GPL-2.0+ (http://opensource.org/licenses/gpl-license) +// with "runtime exception" (http://www.dune-project.org/license.html) +// Authors: +// Felix Schindler (2016) + +#include "config.h" + +#if HAVE_DUNE_PYBINDXI + +#include <string> +#include <vector> + +#include <dune/pybindxi/pybind11.h> +//#include <dune/pybindxi/stl_bind.h> // <- see dune/xt/common/bindings.cc + +#include <dune/xt/la/container/vector-interface.pbh> + +#include <dune/xt/la/container.hh> + + +namespace py = pybind11; + + +PYBIND11_PLUGIN(la) +{ + py::module m("la", "dune-xt-la"); + + py::module::import("common"); + + Dune::XT::LA::bind_Backends(m); + Dune::XT::LA::bind_Vector<Dune::XT::LA::CommonDenseVector<double>>(m, "CommonDenseVector_double"); + + return m.ptr(); +} // PYBIND11_PLUGIN(la) + +#endif // HAVE_DUNE_PYBINDXI