Skip to content
Snippets Groups Projects
Commit e73152ea authored by Atkins, Charles Vernon's avatar Atkins, Charles Vernon
Browse files

CMake: Port examples to use new FindMPI module

parent 422d4045
No related branches found
No related tags found
1 merge request!267Add upstream FindMPI
Showing
with 29 additions and 75 deletions
......@@ -7,6 +7,5 @@ add_executable(globalArray_write globalArray_write.cpp)
target_link_libraries(globalArray_write adios2)
if(ADIOS2_HAVE_MPI)
target_include_directories(globalArray_write PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(globalArray_write ${MPI_C_LIBRARIES})
target_link_libraries(globalArray_write MPI::MPI_C)
endif()
......@@ -7,6 +7,5 @@ add_executable(joinedArray_write joinedArray_write.cpp)
target_link_libraries(joinedArray_write adios2)
if(ADIOS2_HAVE_MPI)
target_include_directories(joinedArray_write PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(joinedArray_write ${MPI_C_LIBRARIES})
target_link_libraries(joinedArray_write MPI::MPI_C)
endif()
......@@ -7,6 +7,5 @@ add_executable(localArray_write localArray_write.cpp)
target_link_libraries(localArray_write adios2)
if(ADIOS2_HAVE_MPI)
target_include_directories(localArray_write PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(localArray_write ${MPI_C_LIBRARIES})
target_link_libraries(localArray_write MPI::MPI_C)
endif()
......@@ -7,6 +7,5 @@ add_executable(values_write values_write.cpp)
target_link_libraries(values_write adios2)
if(ADIOS2_HAVE_MPI)
target_include_directories(values_write PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(values_write ${MPI_C_LIBRARIES})
target_link_libraries(values_write MPI::MPI_C)
endif()
......@@ -3,15 +3,11 @@
# accompanying file Copyright.txt for details.
#------------------------------------------------------------------------------#
add_executable(writer_multistep writer_multistep.cpp)
add_executable(reader_stepping reader_stepping.cpp)
add_executable(reader_allsteps reader_allsteps.cpp)
foreach(tgt IN ITEMS writer_multistep reader_stepping reader_allsteps)
add_executable(${tgt} ${tgt}.cpp)
target_link_libraries(${tgt} adios2)
if(ADIOS2_HAVE_MPI)
target_include_directories(${tgt} PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(${tgt} ${MPI_C_LIBRARIES})
target_link_libraries(${tgt} MPI::MPI_C)
endif()
endforeach()
if(ADIOS2_HAVE_MPI)
add_executable(helloBPWriterXML helloBPWriterXML.cpp)
target_include_directories(helloBPWriterXML PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(helloBPWriterXML ${MPI_C_LIBRARIES})
target_link_libraries(helloBPWriterXML MPI::MPI_C)
else()
add_executable(helloBPWriterXML helloBPWriterXML_nompi.cpp)
endif()
......
......@@ -5,18 +5,10 @@
if(ADIOS2_HAVE_MPI)
add_executable(heatTransfer_read_adios2 heatRead_adios2.cpp PrintData.h)
target_include_directories(heatTransfer_read_adios2
PRIVATE ${MPI_C_INCLUDE_PATH}
)
target_link_libraries(heatTransfer_read_adios2 adios2 ${MPI_C_LIBRARIES})
target_link_libraries(heatTransfer_read_adios2 adios2 MPI::MPI_C)
if(ADIOS2_HAVE_ADIOS1)
add_executable(heatTransfer_read_adios1 heatRead_adios1.cpp PrintData.h)
target_include_directories(heatTransfer_read_adios1
PRIVATE ${MPI_C_INCLUDE_PATH}
)
target_link_libraries(heatTransfer_read_adios1
adios1::adios ${MPI_C_LIBRARIES}
)
target_link_libraries(heatTransfer_read_adios1 adios1::adios MPI::MPI_C)
endif()
endif()
......@@ -10,11 +10,8 @@ if(ADIOS2_HAVE_MPI)
Settings.cpp
IO_adios2.cpp
)
target_include_directories(heatTransfer_write_adios2
PRIVATE ${MPI_C_INCLUDE_PATH}
)
target_link_libraries(heatTransfer_write_adios2
adios2 ${MPI_C_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
adios2 MPI::MPI_C ${CMAKE_THREAD_LIBS_INIT}
)
target_compile_definitions(heatTransfer_write_adios2 PRIVATE
-DDEFAULT_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/config.xml
......@@ -27,11 +24,8 @@ if(ADIOS2_HAVE_MPI)
Settings.cpp
IO_adios1.cpp
)
target_include_directories(heatTransfer_write_adios1
PRIVATE ${MPI_C_INCLUDE_PATH}
)
target_link_libraries(heatTransfer_write_adios1
adios1::adios ${MPI_C_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
adios1::adios MPI::MPI_C ${CMAKE_THREAD_LIBS_INIT}
)
endif()
......@@ -43,10 +37,10 @@ if(ADIOS2_HAVE_MPI)
IO_hdf5_a.cpp
)
target_include_directories(heatTransfer_write_hdf5
PRIVATE ${MPI_C_INCLUDE_PATH} ${HDF5_C_INCLUDE_DIRS}
PRIVATE ${HDF5_C_INCLUDE_DIRS}
)
target_link_libraries(heatTransfer_write_hdf5
${HDF5_C_LIBRARIES} ${MPI_C_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
${HDF5_C_LIBRARIES} MPI::MPI_C ${CMAKE_THREAD_LIBS_INIT}
)
add_executable(heatTransfer_write_ph5
......@@ -56,10 +50,10 @@ if(ADIOS2_HAVE_MPI)
IO_ph5.cpp
)
target_include_directories(heatTransfer_write_ph5
PRIVATE ${MPI_C_INCLUDE_PATH} ${HDF5_C_INCLUDE_DIRS}
PRIVATE ${HDF5_C_INCLUDE_DIRS}
)
target_link_libraries(heatTransfer_write_ph5
${HDF5_C_LIBRARIES} ${MPI_C_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
${HDF5_C_LIBRARIES} MPI::MPI_C ${CMAKE_THREAD_LIBS_INIT}
)
add_executable(heatTransfer_write_a2h5
......@@ -69,11 +63,8 @@ if(ADIOS2_HAVE_MPI)
IO_ph5_adios2.cpp
)
target_include_directories(heatTransfer_write_a2h5
PRIVATE ${MPI_C_INCLUDE_PATH}
)
target_link_libraries(heatTransfer_write_a2h5
adios2 ${MPI_C_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
adios2 MPI::MPI_C ${CMAKE_THREAD_LIBS_INIT}
)
endif()
endif()
......@@ -5,8 +5,7 @@
if(ADIOS2_HAVE_MPI)
add_executable(hello_adios1Writer helloADIOS1Writer.cpp)
target_include_directories(hello_adios1Writer PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(hello_adios1Writer ${MPI_C_LIBRARIES})
target_link_libraries(hello_adios1Writer MPI::MPI_C)
else()
add_executable(hello_adios1Writer helloADIOS1Writer_nompi.cpp)
endif()
......
......@@ -7,8 +7,7 @@ if(ADIOS2_HAVE_MPI)
find_package(MPI COMPONENTS C REQUIRED)
add_executable(hello_bpAttributeWriter helloBPAttributeWriter.cpp)
target_include_directories(hello_bpAttributeWriter PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(hello_bpAttributeWriter ${MPI_C_LIBRARIES})
target_link_libraries(hello_bpAttributeWriter MPI::MPI_C)
else()
add_executable(hello_bpAttributeWriter helloBPAttributeWriter_nompi.cpp)
......
......@@ -5,8 +5,7 @@
if(ADIOS2_HAVE_MPI)
add_executable(hello_bpBZip2Wrapper helloBPBZip2Wrapper.cpp)
target_include_directories(hello_bpBZip2Wrapper PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(hello_bpBZip2Wrapper ${MPI_C_LIBRARIES})
target_link_libraries(hello_bpBZip2Wrapper MPI::MPI_C)
else()
add_executable(hello_bpBZip2Wrapper helloBPBZip2Wrapper_nompi.cpp)
endif()
......
......@@ -5,8 +5,7 @@
if(ADIOS2_HAVE_MPI)
add_executable(hello_bpFlushWriter helloBPFlushWriter.cpp)
target_include_directories(hello_bpFlushWriter PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(hello_bpFlushWriter ${MPI_C_LIBRARIES})
target_link_libraries(hello_bpFlushWriter MPI::MPI_C)
else()
add_executable(hello_bpFlushWriter helloBPFlushWriter_nompi.cpp)
endif()
......
......@@ -5,8 +5,7 @@
if(ADIOS2_HAVE_MPI)
add_executable(hello_bpTimeWriter helloBPTimeWriter.cpp)
target_include_directories(hello_bpTimeWriter PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(hello_bpTimeWriter ${MPI_C_LIBRARIES})
target_link_libraries(hello_bpTimeWriter MPI::MPI_C)
else()
add_executable(hello_bpTimeWriter helloBPTimeWriter_nompi.cpp)
endif()
......
......@@ -5,21 +5,14 @@
if(ADIOS2_HAVE_MPI)
add_executable(hello_bpWriter helloBPWriter.cpp)
target_include_directories(hello_bpWriter PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(hello_bpWriter ${MPI_C_LIBRARIES})
target_link_libraries(hello_bpWriter MPI::MPI_C)
add_executable(hello_bpWriter_c helloBPWriter.c)
target_include_directories(hello_bpWriter_c PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(hello_bpWriter_c ${MPI_C_LIBRARIES})
target_link_libraries(hello_bpWriter_c MPI::MPI_C)
if(ADIOS2_HAVE_Fortran)
add_executable(hello_bpWriter_f helloBPWriter.f90)
target_include_directories(hello_bpWriter_f
PRIVATE ${MPI_Fortran_INCLUDE_PATH}
${MPI_C_INCLUDE_PATH})
target_link_libraries(hello_bpWriter_f PRIVATE ${MPI_Fortran_LIBRARIES}
${MPI_C_LIBRARIES})
target_link_libraries(hello_bpWriter_f MPI::MPI_Fortran adios2_f)
endif()
else()
......@@ -28,13 +21,9 @@ else()
if(ADIOS2_HAVE_Fortran)
add_executable(hello_bpWriter_f helloBPWriter_nompi.f90)
target_link_libraries(hello_bpWriter_f adios2_f)
endif()
endif()
target_link_libraries(hello_bpWriter adios2)
target_link_libraries(hello_bpWriter_c adios2)
if(ADIOS2_HAVE_Fortran)
target_link_libraries(hello_bpWriter_f PRIVATE adios2_f)
endif()
......@@ -5,8 +5,7 @@
if(ADIOS2_HAVE_MPI)
add_executable(hello_bpZfpWrapper helloBPZfpWrapper.cpp)
target_include_directories(hello_bpZfpWrapper PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(hello_bpZfpWrapper ${MPI_C_LIBRARIES})
target_link_libraries(hello_bpZfpWrapper MPI::MPI_C)
else()
add_executable(hello_bpZfpWrapper helloBPZfpWrapper_nompi.cpp)
......
......@@ -5,8 +5,7 @@
if(ADIOS2_HAVE_MPI)
add_executable(hello_datamanReader helloDataManReader.cpp)
target_include_directories(hello_datamanReader PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(hello_datamanReader ${MPI_C_LIBRARIES})
target_link_libraries(hello_datamanReader MPI::MPI_C)
else()
add_executable(hello_datamanReader helloDataManReader_nompi.cpp)
endif()
......
......@@ -5,8 +5,7 @@
if(ADIOS2_HAVE_MPI)
add_executable(hello_datamanWriter helloDataManWriter.cpp)
target_include_directories(hello_datamanWriter PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(hello_datamanWriter ${MPI_C_LIBRARIES})
target_link_libraries(hello_datamanWriter MPI::MPI_C)
else()
add_executable(hello_datamanWriter helloDataManWriter_nompi.cpp)
endif()
......
......@@ -5,8 +5,7 @@
if(ADIOS2_HAVE_MPI)
add_executable(hello_hdf5Writer helloHDF5Writer.cpp)
target_include_directories(hello_hdf5Writer PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(hello_hdf5Writer ${MPI_C_LIBRARIES})
target_link_libraries(hello_hdf5Writer MPI::MPI_C)
else()
add_executable(hello_hdf5Writer helloHDF5Writer_nompi.cpp)
endif()
......
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