diff --git a/Applications/Python/CMakeLists.txt b/Applications/Python/CMakeLists.txt index 667d1aff7032bbd09a365db27bfb44d5d29c591d..0d09ceb00e7c630ee250011ec537539b94ff1542 100644 --- a/Applications/Python/CMakeLists.txt +++ b/Applications/Python/CMakeLists.txt @@ -1 +1,2 @@ add_subdirectory(ogs.simulator) +add_subdirectory(ogs.callbacks) diff --git a/Applications/Python/ogs.callbacks/CMakeLists.txt b/Applications/Python/ogs.callbacks/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b81612a5a8a326ef48c306c7fee8511c13e2010 --- /dev/null +++ b/Applications/Python/ogs.callbacks/CMakeLists.txt @@ -0,0 +1,18 @@ +pybind11_add_module( + callbacks MODULE ogs_callbacks_module.cpp +) + +# lld linker strips out PyInit_OpenGeoSys symbol. Use standard linker. +get_target_property(_link_options callbacks LINK_OPTIONS) +if(_link_options) + list(REMOVE_ITEM _link_options -fuse-ld=lld) + set_target_properties(callbacks PROPERTIES LINK_OPTIONS "${_link_options}") +endif() + +target_link_libraries( + callbacks + PRIVATE ProcessLibBoundaryConditionAndSourceTermPythonModule +) + +# Install into root dir (in Python module, enables 'import ogs.callbacks') +install(TARGETS callbacks LIBRARY DESTINATION .) diff --git a/Applications/Python/ogs.callbacks/ogs_callbacks_module.cpp b/Applications/Python/ogs.callbacks/ogs_callbacks_module.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4fe341651a8dc0a9738bbb0c39f03012980bc272 --- /dev/null +++ b/Applications/Python/ogs.callbacks/ogs_callbacks_module.cpp @@ -0,0 +1,22 @@ +/** + * \copyright + * Copyright (c) 2012-2022, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#include <pybind11/pybind11.h> + +#include "ProcessLib/BoundaryConditionAndSourceTerm/Python/BHEInflowPythonBoundaryConditionModule.h" +#include "ProcessLib/BoundaryConditionAndSourceTerm/Python/PythonBoundaryConditionModule.h" +#include "ProcessLib/BoundaryConditionAndSourceTerm/Python/PythonSourceTermModule.h" + +PYBIND11_MODULE(callbacks, m) +{ + m.attr("__name__") = "ogs.callbacks"; + ProcessLib::pythonBindBoundaryCondition(m); + ProcessLib::bheInflowpythonBindBoundaryCondition(m); + ProcessLib::SourceTerms::Python::pythonBindSourceTerm(m); +}