Skip to content

Commit

Permalink
Merge branch 'FixLinkingOrderOfProcessLibAndPythonBC' into 'master'
Browse files Browse the repository at this point in the history
[PL] Fix linking order of python BCs

See merge request ogs/ogs!5108
  • Loading branch information
bilke committed Sep 20, 2024
2 parents 424e889 + cda071d commit f7ba307
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Applications/ApplicationsLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ target_link_libraries(
GeoLib
NumLib
$<$<AND:$<BOOL:${OGS_USE_PETSC}>,$<TARGET_EXISTS:VTK::ParallelMPI>>:VTK::ParallelMPI>
$<$<AND:$<NOT:$<BOOL:${OGS_BUILD_WHEEL}>>,$<BOOL:${OGS_BUILD_CLI}>>:ogs_embedded_python>
PRIVATE CMakeInfoLib
MathLib
MeshLib
MeshGeoToolsLib
MeshToolsLib
pybind11::pybind11
$<$<BOOL:${OGS_USE_PETSC}>:PkgConfig::PETSC>
pybind11::module
)

if(OGS_BUILD_CLI OR OGS_BUILD_UTILS OR OGS_BUILD_TESTING)
Expand Down Expand Up @@ -46,7 +47,6 @@ target_compile_definitions(
# see https://pybind11.readthedocs.io/en/stable/faq.html#someclass-declared-with-greater-visibility-than-the-type-of-its-field-someclass-member-wattributes
# ~~~
if(NOT OGS_BUILD_WHEEL AND OGS_BUILD_CLI)
target_link_libraries(ApplicationsLib PRIVATE ogs_embedded_python)
set_target_properties(
ApplicationsLib PROPERTIES CXX_VISIBILITY_PRESET hidden
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ if(OGS_USE_MPI)
target_link_libraries(
binaryToPVTU
GitInfoLib
ProcessLib
MeshLib
MeshToolsLib
tclap
Expand Down
16 changes: 3 additions & 13 deletions ProcessLib/BoundaryConditionAndSourceTerm/Python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,15 @@ target_compile_definitions(
$<$<BOOL:${OGS_ENABLE_ELEMENT_PYRAMID}>:OGS_ENABLE_ELEMENT_PYRAMID>
)

# TODO there is an ugly cyclic dependency between ProcessLib and the Python BCs
# and STs. We need to include ProcessLib's build dir such that ProcessLib's
# export header, which is autogenerated by cmake in the build dir, can be found.
target_include_directories(
ProcessLibBoundaryConditionAndSourceTermPython
PRIVATE $<TARGET_PROPERTY:ProcessLib,BINARY_DIR>
)

target_link_libraries(
ProcessLibBoundaryConditionAndSourceTermPython
PUBLIC BaseLib MathLib MeshLib NumLib
$<IF:$<BOOL:${OGS_BUILD_WHEEL}>,pybind11::module,pybind11::embed>
PUBLIC BaseLib MathLib MeshLib NumLib pybind11::module
)

if(BUILD_SHARED_LIBS AND (MSVC OR APPLE))
if(BUILD_SHARED_LIBS AND MSVC)
target_link_options(
ProcessLibBoundaryConditionAndSourceTermPython PRIVATE
$<$<PLATFORM_ID:Darwin>:-undefined dynamic_lookup>
$<$<CXX_COMPILER_ID:MSVC>:/FORCE:UNRESOLVED>
/FORCE:UNRESOLVED
)
endif()

Expand Down
2 changes: 1 addition & 1 deletion ProcessLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ target_link_libraries(
NumLib
Boost::boost
range-v3
$<$<TARGET_EXISTS:ProcessLibBoundaryConditionAndSourceTermPython>:ProcessLibBoundaryConditionAndSourceTermPython>
$<$<TARGET_EXISTS:petsc>:petsc>
ProcessLibBoundaryConditionAndSourceTermPython
PRIVATE ParameterLib GitInfoLib $<$<TARGET_EXISTS:InSituLib>:InSituLib>
)

Expand Down
2 changes: 1 addition & 1 deletion ProcessLib/HeatTransportBHE/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ogs_add_library(HeatTransportBHE ${SOURCES})
target_link_libraries(
HeatTransportBHE PUBLIC ProcessLib
PRIVATE ParameterLib
$<$<TARGET_EXISTS:pybind11::pybind11>:pybind11::pybind11>
$<$<TARGET_EXISTS:pybind11::pybind11>:pybind11::module>
)

target_precompile_headers(HeatTransportBHE PRIVATE [["BaseLib/Error.h"]]
Expand Down

0 comments on commit f7ba307

Please sign in to comment.