fixed: don't link python module to flow_libblackoil

this leads to ODR violations which causes all sorts
of havoc. this was done to reuse a trivial method,
duplicate it in the python source instead.
This commit is contained in:
Arne Morten Kvarving 2024-02-29 09:24:07 +01:00
parent 3087950c35
commit f8b22631b0
2 changed files with 18 additions and 8 deletions

View File

@ -9,17 +9,14 @@
# https://pybind11.readthedocs.io/en/stable/compiling.html
#
pybind11_add_module(simulators ${PYBIND11_SYSTEM}
$<TARGET_OBJECTS:moduleVersion>
Pybind11Exporter.cpp
PyBlackOilSimulator.cpp
Pybind11Exporter.cpp)
)
set(PYTHON_OPM_SIMULATORS_PACKAGE_PATH ${PROJECT_BINARY_DIR}/python/opm/simulators)
set_target_properties( simulators PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PYTHON_OPM_SIMULATORS_PACKAGE_PATH} )
target_sources(simulators
PRIVATE
$<TARGET_OBJECTS:moduleVersion>
$<TARGET_OBJECTS:flow_libblackoil>)
target_link_libraries( simulators PRIVATE opmsimulators )
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "

View File

@ -27,13 +27,26 @@
//#include <opm/simulators/flow/python/PyFluidState.hpp>
#include <opm/simulators/flow/python/PyMaterialState.hpp>
#include <opm/simulators/flow/python/PyBlackOilSimulator.hpp>
#include <flow/flow_ebos_blackoil.hpp>
// NOTE: EXIT_SUCCESS, EXIT_FAILURE is defined in cstdlib
#include <cstdlib>
#include <iostream>
#include <stdexcept>
#include <string>
namespace Opm {
std::unique_ptr<FlowMain<Properties::TTag::FlowProblemTPFA>>
flowEbosBlackoilTpfaMainInit(int argc, char** argv, bool outputCout, bool outputFiles)
{
// we always want to use the default locale, and thus spare us the trouble
// with incorrect locale settings.
resetLocale();
return std::make_unique<FlowMain<Properties::TTag::FlowProblemTPFA>>(
argc, argv, outputCout, outputFiles);
}
}
namespace py = pybind11;
namespace Opm::Pybind {