diff --git a/Applications/Python/ogs.mesh/CMakeLists.txt b/Applications/Python/ogs.mesh/CMakeLists.txt index 4cdc635a427c001851ee54c3c4b5c009b3f69e40..5b5704a8dacde5f8b10ea7d54601b5f02718dc3f 100644 --- a/Applications/Python/ogs.mesh/CMakeLists.txt +++ b/Applications/Python/ogs.mesh/CMakeLists.txt @@ -1,6 +1,12 @@ -# Create OpenGeoSys python module -# https://pybind11.readthedocs.io/en/stable/compiling.html#building-with-cmake -pybind11_add_module(mesh MODULE ogs_mesh_python_module.cpp OGSMesh.cpp) +# Helper library which provides a better view on the mesh data. This allows to +# be used by several modules, e.g. this and the simulator module. +add_library(_python_mesh STATIC OGSMesh.cpp) +target_link_libraries( + _python_mesh PUBLIC MeshLib BaseLib GitInfoLib pybind11::pybind11 +) + +# The actual Python module should only contain the binding code. +pybind11_add_module(mesh MODULE ogs_mesh_python_module.cpp) # lld linker strips out PyInit_OpenGeoSys symbol. Use standard linker. get_target_property(_link_options mesh LINK_OPTIONS) @@ -9,9 +15,7 @@ if(_link_options) set_target_properties(mesh PROPERTIES LINK_OPTIONS "${_link_options}") endif() -target_link_libraries( - mesh PRIVATE MeshLib BaseLib CMakeInfoLib GitInfoLib tclap -) +target_link_libraries(mesh PRIVATE _python_mesh) -# Install into Python module root dir (enables 'import ogs.simulator') +# Install into Python module root dir (enables 'import ogs.mesh') install(TARGETS mesh LIBRARY DESTINATION ogs) diff --git a/Applications/Python/ogs.simulator/CMakeLists.txt b/Applications/Python/ogs.simulator/CMakeLists.txt index daf04fcd5e2867b54a536b20dcbbd7137dc8f4a6..c87b10ad6ea246c54d3c5e8f47e6f1c541c634df 100644 --- a/Applications/Python/ogs.simulator/CMakeLists.txt +++ b/Applications/Python/ogs.simulator/CMakeLists.txt @@ -14,6 +14,7 @@ endif() target_link_libraries( simulator PRIVATE ApplicationsLib BaseLib CMakeInfoLib GitInfoLib tclap + _python_mesh ) target_include_directories(simulator PRIVATE ../../CLI)