diff --git a/CMakeLists.txt b/CMakeLists.txt index 8db98953a..d4aa3d916 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -249,8 +249,8 @@ if (OPM_ENABLE_PYTHON) python/cxx/parsecontext.cpp python/cxx/parser.cpp python/cxx/schedule.cpp - python/cxx/common.cpp - python/cxx/common.hpp + python/cxx/export.cpp + python/cxx/export.hpp python/cxx/common_state.cpp python/cxx/common_state.hpp python/cxx/table_manager.cpp diff --git a/python/cxx/common.hpp b/python/cxx/common.hpp deleted file mode 100644 index 3223e7994..000000000 --- a/python/cxx/common.hpp +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef SUNBEAM_HPP -#define SUNBEAM_HPP - -#include - -namespace Opm { } -namespace py = pybind11; - -using namespace Opm; -const py::return_value_policy ref_internal = py::return_value_policy::reference_internal; -const py::return_value_policy python_owner = py::return_value_policy::take_ownership; -const py::return_value_policy move = py::return_value_policy::move; - -namespace python { -namespace common { - - void export_all(py::module& module); - void export_Connection(py::module& module); - void export_Deck(py::module& module); - void export_DeckKeyword(py::module& module); - void export_Eclipse3DProperties(py::module& module); - void export_EclipseConfig(py::module& module); - void export_EclipseGrid(py::module& module); - void export_EclipseState(py::module& module); - void export_Group(py::module& module); - void export_GroupTree(py::module& module); - void export_ParseContext(py::module& module); - void export_Parser(py::module& module); - void export_Schedule(py::module& module); - void export_TableManager(py::module& module); - void export_Well(py::module& module); - -} -} - -#endif //SUNBEAM_HPP diff --git a/python/cxx/connection.cpp b/python/cxx/connection.cpp index 2d58144fa..d187a8ca9 100644 --- a/python/cxx/connection.cpp +++ b/python/cxx/connection.cpp @@ -1,6 +1,6 @@ #include -#include "common.hpp" +#include "export.hpp" namespace { diff --git a/python/cxx/deck.cpp b/python/cxx/deck.cpp index 2aa049acd..27c0dc0ca 100644 --- a/python/cxx/deck.cpp +++ b/python/cxx/deck.cpp @@ -2,7 +2,7 @@ #include #include "converters.hpp" -#include "common.hpp" +#include "export.hpp" namespace { diff --git a/python/cxx/deck_keyword.cpp b/python/cxx/deck_keyword.cpp index 1931efc4f..2761ddc4a 100644 --- a/python/cxx/deck_keyword.cpp +++ b/python/cxx/deck_keyword.cpp @@ -5,7 +5,7 @@ #include #include -#include "common.hpp" +#include "export.hpp" #include "converters.hpp" diff --git a/python/cxx/eclipse_3d_properties.cpp b/python/cxx/eclipse_3d_properties.cpp index 1bf4158e8..9ce1a77ca 100644 --- a/python/cxx/eclipse_3d_properties.cpp +++ b/python/cxx/eclipse_3d_properties.cpp @@ -1,7 +1,7 @@ #include #include -#include "common.hpp" +#include "export.hpp" #include "converters.hpp" namespace { diff --git a/python/cxx/eclipse_config.cpp b/python/cxx/eclipse_config.cpp index bdeb764f7..52f27706b 100644 --- a/python/cxx/eclipse_config.cpp +++ b/python/cxx/eclipse_config.cpp @@ -5,7 +5,7 @@ #include #include -#include "common.hpp" +#include "export.hpp" void python::common::export_EclipseConfig(py::module& module) diff --git a/python/cxx/eclipse_grid.cpp b/python/cxx/eclipse_grid.cpp index 5e4aa8c94..7531b80a2 100644 --- a/python/cxx/eclipse_grid.cpp +++ b/python/cxx/eclipse_grid.cpp @@ -4,7 +4,7 @@ #include #include -#include "common.hpp" +#include "export.hpp" namespace { diff --git a/python/cxx/eclipse_state.cpp b/python/cxx/eclipse_state.cpp index 7f87029cc..0d0315d09 100644 --- a/python/cxx/eclipse_state.cpp +++ b/python/cxx/eclipse_state.cpp @@ -1,7 +1,7 @@ #include #include -#include "common.hpp" +#include "export.hpp" namespace { diff --git a/python/cxx/common.cpp b/python/cxx/export.cpp similarity index 96% rename from python/cxx/common.cpp rename to python/cxx/export.cpp index e6ef47ecf..5e3c8e0e6 100644 --- a/python/cxx/common.cpp +++ b/python/cxx/export.cpp @@ -1,6 +1,5 @@ #include -#include "common.hpp" - +#include "export.hpp" void python::common::export_all(py::module& module) { @@ -20,6 +19,7 @@ void python::common::export_all(py::module& module) { export_EclipseGrid(module); } + PYBIND11_MODULE(libopmcommon_python, module) { python::common::export_all(module); } diff --git a/python/cxx/export.hpp b/python/cxx/export.hpp new file mode 100644 index 000000000..3f1bb99a0 --- /dev/null +++ b/python/cxx/export.hpp @@ -0,0 +1,33 @@ +#ifndef SUNBEAM_HPP +#define SUNBEAM_HPP + +#include + +namespace Opm {} + +namespace py = pybind11; + +using namespace Opm; +const py::return_value_policy ref_internal = py::return_value_policy::reference_internal; +const py::return_value_policy python_owner = py::return_value_policy::take_ownership; +const py::return_value_policy move = py::return_value_policy::move; + +namespace python::common { +void export_all(py::module& module); +void export_Connection(py::module& module); +void export_Deck(py::module& module); +void export_DeckKeyword(py::module& module); +void export_Eclipse3DProperties(py::module& module); +void export_EclipseConfig(py::module& module); +void export_EclipseGrid(py::module& module); +void export_EclipseState(py::module& module); +void export_Group(py::module& module); +void export_GroupTree(py::module& module); +void export_ParseContext(py::module& module); +void export_Parser(py::module& module); +void export_Schedule(py::module& module); +void export_TableManager(py::module& module); +void export_Well(py::module& module); +} + +#endif //SUNBEAM_HPP diff --git a/python/cxx/group.cpp b/python/cxx/group.cpp index e52f8f25d..1ca02f9a6 100644 --- a/python/cxx/group.cpp +++ b/python/cxx/group.cpp @@ -1,6 +1,6 @@ #include #include -#include "common.hpp" +#include "export.hpp" namespace { diff --git a/python/cxx/group_tree.cpp b/python/cxx/group_tree.cpp index d58dad488..d14f06382 100644 --- a/python/cxx/group_tree.cpp +++ b/python/cxx/group_tree.cpp @@ -1,7 +1,7 @@ #include #include -#include "common.hpp" +#include "export.hpp" #include "converters.hpp" namespace { diff --git a/python/cxx/parsecontext.cpp b/python/cxx/parsecontext.cpp index 78300ab5b..1cb14de28 100644 --- a/python/cxx/parsecontext.cpp +++ b/python/cxx/parsecontext.cpp @@ -3,7 +3,7 @@ #include #include "common_state.hpp" -#include "common.hpp" +#include "export.hpp" namespace { diff --git a/python/cxx/parser.cpp b/python/cxx/parser.cpp index 502a46773..c89dac327 100644 --- a/python/cxx/parser.cpp +++ b/python/cxx/parser.cpp @@ -8,7 +8,7 @@ #include #include "common_state.hpp" -#include "common.hpp" +#include "export.hpp" namespace { diff --git a/python/cxx/schedule.cpp b/python/cxx/schedule.cpp index 55cc785e8..6d31fe369 100644 --- a/python/cxx/schedule.cpp +++ b/python/cxx/schedule.cpp @@ -4,7 +4,7 @@ #include #include -#include "common.hpp" +#include "export.hpp" namespace { diff --git a/python/cxx/table_manager.cpp b/python/cxx/table_manager.cpp index f378ec4f2..363c57f34 100644 --- a/python/cxx/table_manager.cpp +++ b/python/cxx/table_manager.cpp @@ -1,6 +1,6 @@ #include -#include "common.hpp" +#include "export.hpp" namespace { diff --git a/python/cxx/well.cpp b/python/cxx/well.cpp index b6f7750ee..a211dfcef 100644 --- a/python/cxx/well.cpp +++ b/python/cxx/well.cpp @@ -1,6 +1,6 @@ #include #include -#include "common.hpp" +#include "export.hpp" namespace { diff --git a/python/setup.py b/python/setup.py index 3d8eb68a1..8b18e2d73 100644 --- a/python/setup.py +++ b/python/setup.py @@ -65,7 +65,7 @@ ext_modules = [ 'cxx/common_state.cpp', 'cxx/table_manager.cpp', 'cxx/well.cpp', - 'cxx/common.cpp' + 'cxx/export.cpp' ], libraries=['opmcommon', 'boost_filesystem', 'boost_regex', 'ecl'], language='c++',