Skip to content

Commit

Permalink
Do not create an opm_embedded library as embedded anymore, this is au…
Browse files Browse the repository at this point in the history
…tomatically taken from the globally installed python
  • Loading branch information
lisajulia committed Apr 26, 2024
1 parent e5f7026 commit e519ef9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 87 deletions.
17 changes: 12 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ if (OPM_ENABLE_PYTHON)
# setup.py install manually - optionally with the generated script
# setup-install.sh - and completely bypass cmake in the installation phase.
# If OPM_ENABLE_EMBEDDED_PYTHON, we also install opmcommon_python,
# to make it available in a Python console.
# to make it available in a Python console and for e.g. opm-simulators
if (OPM_INSTALL_PYTHON OR OPM_ENABLE_EMBEDDED_PYTHON)
include(PyInstallPrefix)
install(TARGETS opmcommon_python DESTINATION ${DEST_PREFIX}${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX}/opm)
Expand All @@ -442,11 +442,18 @@ if (OPM_ENABLE_PYTHON)
python/install.py
${PROJECT_BINARY_DIR}/python/opm
${DEST_PREFIX}${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX} 1)")

## Need to install this Python script such that it can be used by opm-simulators when building against an installed
## opm-common
install( PROGRAMS "python/install.py" DESTINATION "${OPM_PYTHON_COMMON_DIR}" )
endif()
if (OPM_ENABLE_EMBEDDED_PYTHON)
install(
CODE "execute_process(
COMMAND ${PYTHON_EXECUTABLE}
python/install.py
${PROJECT_BINARY_DIR}/python/opm_embedded
${DEST_PREFIX}${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX} 1)")
endif()
## Need to install this Python script such that it can be used by opm-simulators when building against an installed
## opm-common
install( PROGRAMS "python/install.py" DESTINATION "${OPM_PYTHON_COMMON_DIR}" )
endif()

# Observe that if the opmcommon library has been built as a shared library the
Expand Down
69 changes: 0 additions & 69 deletions opm/input/eclipse/Python/EmbedModule.hpp

This file was deleted.

13 changes: 0 additions & 13 deletions opm/input/eclipse/Python/PythonInterp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,10 @@

#include "python/cxx/export.hpp"
#include "PythonInterp.hpp"
#include "EmbedModule.hpp"

namespace py = pybind11;
namespace Opm {


/*
OPM_EMBEDDED_MODULE create a Python of all the Python/C++ classes which are
generated in the python::common::export_all_opm_embedded() function in the wrapping code.
The same module is created as a Pybind 11 module in export.cpp
*/

OPM_EMBEDDED_MODULE(opm_embedded, module) {
python::common::export_all(module);
}


bool PythonInterp::exec(const std::string& python_code, py::module& context) {
py::bool_ def_result = false;
context.attr("result") = &def_result;
Expand Down

0 comments on commit e519ef9

Please sign in to comment.