Skip to content

Commit

Permalink
Fix PIO dep on mpi-serial
Browse files Browse the repository at this point in the history
PIO needs to depend on mpi-serial in order for the link
order to be correct.

[BFB]
  • Loading branch information
jgfouca committed Oct 9, 2023
1 parent 589f08c commit 05cbb2e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 1 addition & 6 deletions components/cmake/build_model.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,6 @@ function(build_model COMP_CLASS COMP_NAME)
# build rules:
#-------------------------------------------------------------------------------

if (MPILIB STREQUAL "mpi-serial")
set(MPISERIAL "${INSTALL_SHAREDPATH}/lib/libmpi-serial.a")
set(MLIBS "${MLIBS} ${MPISERIAL}")
endif()

foreach(ITEM IN LISTS SOURCES)
if (ITEM MATCHES "${CMAKE_BINARY_DIR}/.*") # is generated
list(APPEND REAL_SOURCES ${ITEM})
Expand All @@ -225,7 +220,7 @@ function(build_model COMP_CLASS COMP_NAME)
add_executable(${TARGET_NAME})
target_sources(${TARGET_NAME} PRIVATE ${REAL_SOURCES})

set(ALL_LIBS "${GPTLLIB} ${SLIBS} ${MLIBS}")
set(ALL_LIBS "${GPTLLIB} ${SLIBS}")
separate_arguments(ALL_LIBS_LIST UNIX_COMMAND "${ALL_LIBS}")

foreach(ITEM IN LISTS COMP_CLASSES)
Expand Down
6 changes: 5 additions & 1 deletion components/cmake/modules/FindPIO.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,18 @@ find_package(NETCDF REQUIRED)
# Not all machines/PIO installations use ADIOS but, for now,
# we can assume that an MPI case with ADIOS2_ROOT set is probably
# using adios.
if (NOT MPILIB STREQUAL mpi-serial AND DEFINED ENV{ADIOS2_ROOT})
if (NOT MPILIB STREQUAL "mpi-serial" AND DEFINED ENV{ADIOS2_ROOT})
find_package(MPI REQUIRED COMPONENTS C)
find_package(ADIOS2 REQUIRED COMPONENTS C)
list(APPEND PIOLIBS adios2::adios2)
endif()

list(APPEND PIOLIBS netcdf)

if (MPILIB STREQUAL "mpi-serial")
list(APPEND PIOLIBS "${INSTALL_SHAREDPATH}/lib/libmpi-serial.a")
endif()

# Create the interface library, and set target properties
add_library(spio INTERFACE)
target_link_libraries(spio INTERFACE ${PIOLIBS})

0 comments on commit 05cbb2e

Please sign in to comment.