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 476030a commit cd99c27
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 90 deletions.
27 changes: 19 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -430,16 +430,27 @@ if (OPM_ENABLE_PYTHON)
# extra cmake switch, OPM_INSTALL_PYTHON. If you prefer you can still invoke
# setup.py install manually - optionally with the generated script
# setup-install.sh - and completely bypass cmake in the installation phase.
if (OPM_INSTALL_PYTHON)
# If OPM_ENABLE_EMBEDDED_PYTHON is turned on, then we install the
# opm_embedded module, to make it available 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)
install(
CODE "execute_process(
COMMAND ${PYTHON_EXECUTABLE}
python/install.py
${PROJECT_BINARY_DIR}/python/opm
${DEST_PREFIX}${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX} 1)")

if (OPM_INSTALL_PYTHON)
install(
CODE "execute_process(
COMMAND ${PYTHON_EXECUTABLE}
python/install.py
${PROJECT_BINARY_DIR}/python/opm
${DEST_PREFIX}${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX} 1)")
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}" )
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_opm_embedded(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 cd99c27

Please sign in to comment.