Skip to content
Snippets Groups Projects
Commit 704adf47 authored by Christoph Lehmann's avatar Christoph Lehmann
Browse files

[AppL] improved parsing and restructured CMakeLists

parent ca86963e
No related branches found
No related tags found
No related merge requests found
...@@ -10,10 +10,6 @@ target_link_libraries(ApplicationsLib ...@@ -10,10 +10,6 @@ target_link_libraries(ApplicationsLib
PRIVATE MathLib MeshLib MeshGeoToolsLib NumLib PRIVATE MathLib MeshLib MeshGeoToolsLib NumLib
) )
if(OGS_USE_PYTHON)
target_include_directories(ApplicationsLib PRIVATE ${PYTHON_INCLUDE_DIRS})
endif()
# Set cpp definitions if the cmake option is enabled for the given process. # Set cpp definitions if the cmake option is enabled for the given process.
foreach(process ${ProcessesList}) foreach(process ${ProcessesList})
if(OGS_BUILD_PROCESS_${process}) if(OGS_BUILD_PROCESS_${process})
...@@ -26,3 +22,7 @@ endforeach() ...@@ -26,3 +22,7 @@ endforeach()
if(OGS_USE_PCH) if(OGS_USE_PCH)
cotire(ApplicationsLib) cotire(ApplicationsLib)
endif() endif()
if(OGS_USE_PYTHON)
target_link_libraries(ApplicationsLib PRIVATE pybind11::pybind11)
endif()
...@@ -166,11 +166,11 @@ ProjectData::ProjectData(BaseLib::ConfigTree const& project_config, ...@@ -166,11 +166,11 @@ ProjectData::ProjectData(BaseLib::ConfigTree const& project_config,
{ {
_mesh_vec = readMeshes(project_config, project_directory); _mesh_vec = readMeshes(project_config, project_directory);
#ifdef OGS_USE_PYTHON
if (auto const python_script = if (auto const python_script =
project_config.getConfigParameterOptional<std::string>( //! \ogs_file_param{prj__python_script}
"python_script")) project_config.getConfigParameterOptional<std::string>("python_script"))
{ {
#ifdef OGS_USE_PYTHON
namespace py = pybind11; namespace py = pybind11;
auto const script_path = auto const script_path =
BaseLib::copyPathToFileName(*python_script, project_directory); BaseLib::copyPathToFileName(*python_script, project_directory);
...@@ -178,8 +178,10 @@ ProjectData::ProjectData(BaseLib::ConfigTree const& project_config, ...@@ -178,8 +178,10 @@ ProjectData::ProjectData(BaseLib::ConfigTree const& project_config,
// Evaluate in scope of main module // Evaluate in scope of main module
py::object scope = py::module::import("__main__").attr("__dict__"); py::object scope = py::module::import("__main__").attr("__dict__");
py::eval_file(script_path, scope); py::eval_file(script_path, scope);
} #else
OGS_FATAL("OpenGeoSys has not been built with Python support.");
#endif // OGS_USE_PYTHON #endif // OGS_USE_PYTHON
}
//! \ogs_file_param{prj__curves} //! \ogs_file_param{prj__curves}
parseCurves(project_config.getConfigSubtreeOptional("curves")); parseCurves(project_config.getConfigSubtreeOptional("curves"));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment