Debian Codegraph @

examples/simulations/heatTransfer/write/CMakeLists.txt

raw
1 # SPDX-FileCopyrightText: 2026 Oak Ridge National Laboratory and Contributors
2 #
3 # SPDX-License-Identifier: Apache-2.0
4
5 #------------------------------------------------------------------------------#
6 # Distributed under the OSI-approved Apache License, Version 2.0. See
7 # accompanying file Copyright.txt for details.
8 #------------------------------------------------------------------------------#
9
10 cmake_minimum_required(VERSION 3.12)
11 project(ADIOS2SimulationsHeatTransferWriteExample)
12
13 set(maybe_standalone_project OFF)
14 if(NOT TARGET adios2_core)
15 set(maybe_standalone_project ON)
16 set(_components C CXX)
17
18 find_package(MPI COMPONENTS ${_components})
19 if(MPI_FOUND)
20 # Workaround for various MPI implementations forcing the link of C++ bindings
21 add_definitions(-DOMPI_SKIP_MPICXX -DMPICH_SKIP_MPICXX)
22
23 list(APPEND _components MPI)
24 endif()
25
26 find_package(Threads QUIET)
27
28 find_package(ADIOS2 REQUIRED COMPONENTS ${_components})
29 endif()
30
31 if (ADIOS2_HAVE_MPI AND Threads_FOUND)
32 add_executable(adios2_simulations_heatTransferWrite
33 main.cpp
34 HeatTransfer.cpp
35 Settings.cpp
36 IO_adios2.cpp
37 )
38 add_executable(adios2_simulations_heatTransferWrite_ascii
39 main.cpp
40 HeatTransfer.cpp
41 Settings.cpp
42 IO_ascii.cpp
43 )
44
45 target_link_libraries(adios2_simulations_heatTransferWrite adios2::cxx_mpi MPI::MPI_CXX ${CMAKE_THREAD_LIBS_INIT})
46 target_link_libraries(adios2_simulations_heatTransferWrite_ascii MPI::MPI_CXX ${CMAKE_THREAD_LIBS_INIT})
47
48 if (maybe_standalone_project)
49 install(TARGETS adios2_simulations_heatTransferWrite RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
50 install(TARGETS adios2_simulations_heatTransferWrite_ascii RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
51 endif()
52 if(ADIOS2_HAVE_HDF5)
53 add_executable(adios2_simulations_heatTransferWrite_hdf5
54 main.cpp
55 HeatTransfer.cpp
56 Settings.cpp
57 IO_hdf5_a.cpp
58 )
59 target_include_directories(adios2_simulations_heatTransferWrite_hdf5 PRIVATE ${HDF5_C_INCLUDE_DIRS})
60 target_link_libraries(adios2_simulations_heatTransferWrite_hdf5
61 ${HDF5_C_LIBRARIES} MPI::MPI_CXX ${CMAKE_THREAD_LIBS_INIT})
62 if (maybe_standalone_project)
63 install(TARGETS adios2_simulations_heatTransferWrite_hdf5 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
64 endif()
65
66 if(HDF5_IS_PARALLEL)
67 add_executable(adios2_simulations_heatTransferWrite_ph5
68 main.cpp
69 HeatTransfer.cpp
70 Settings.cpp
71 IO_ph5.cpp
72 )
73 target_include_directories(adios2_simulations_heatTransferWrite_ph5 PRIVATE ${HDF5_C_INCLUDE_DIRS})
74 target_link_libraries(adios2_simulations_heatTransferWrite_ph5
75 ${HDF5_C_LIBRARIES} MPI::MPI_CXX ${CMAKE_THREAD_LIBS_INIT})
76 if (maybe_standalone_project)
77 install(TARGETS adios2_simulations_heatTransferWrite_ph5 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
78 endif()
79 endif()
80
81 if(NOT (HDF5_VERSION VERSION_LESS 1.11))
82 add_executable(adios2_simulations_heatTransferWrite_h5mixer
83 main.cpp
84 HeatTransfer.cpp
85 Settings.cpp
86 IO_h5mixer.cpp
87 )
88 target_link_libraries(adios2_simulations_heatTransferWrite_h5mixer
89 adios2::cxx_mpi MPI::MPI_CXX ${CMAKE_THREAD_LIBS_INIT})
90 if (maybe_standalone_project)
91 install(TARGETS adios2_simulations_heatTransferWrite_h5mixer RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
92 endif()
93 endif()
94 endif()
95 endif()