diff --git a/cmake/FindDataMan.cmake b/cmake/FindDataMan.cmake new file mode 100644 index 0000000000000000000000000000000000000000..14c0fe8378e343475a4a7d3c0956974216459bba --- /dev/null +++ b/cmake/FindDataMan.cmake @@ -0,0 +1,63 @@ +#------------------------------------------------------------------------------# +# Distributed under the OSI-approved Apache License, Version 2.0. See +# accompanying file Copyright.txt for details. +#------------------------------------------------------------------------------# + +# FindDataMan +# --------- +# +# Try to find the DataMan library from Jason Wang, ORNL +# https://github.com/JasonRuonanWang/DataMan +# +# This module defines the following variables: +# +# DataMan_FOUND - System has DataMan +# DataMan_INCLUDE_DIRS - The DataMan include directory +# DataMan_LIBRARIES - Link these to use DataMan +# +# and the following imported targets: +# DataMan::DataMan - The core DataMan library +# +# You can also set the following variable to help guide the search: +# DataMan_ROOT_DIR - The install prefix for DataMan containing the +# include and lib folders + +if(NOT DataMan_FOUND) + # Search for the core libraries + if(DataMan_ROOT_DIR) + # If a root directory is specified, then don't look anywhere else + find_path(DataMan_INCLUDE_DIR DataMan.h + HINTS ${DataMan_ROOT_DIR}/include + NO_DEFAULT_PATHS + ) + set(_DataMan_LIBRARY_HINT HINTS ${DataMan_ROOT_DIR}/lib NO_DEFAULT_PATHS) + else() + # Otherwise use the include dir as a basis to search for the lib + find_path(DataMan_INCLUDE_DIR DataMan.h) + if(DataMan_INCLUDE_DIR) + get_filename_component(_DataMan_PREFIX "${DataMan_INCLUDE_DIR}" PATH) + set(_DataMan_LIBRARY_HINT HINTS ${_DataMan_PREFIX}/lib) + unset(_DataMan_PREFIX) + endif() + endif() + find_library(DataMan_LIBRARY dataman ${_DataMan_LIBRARY_HINT}) + unset(_DataMan_LIBRARY_HINT) + + find_package_handle_standard_args(DataMan + FOUND_VAR DataMan_FOUND + REQUIRED_VARS + DataMan_INCLUDE_DIR + DataMan_LIBRARY + ) + if(DataMan_FOUND) + set(DataMan_INCLUDE_DIRS ${DataMan_INCLUDE_DIR}) + set(DataMan_LIBRARIES ${DataMan_LIBRARY}) + if(DataMan_FOUND AND NOT TARGET DataMan::DataMan) + add_library(DataMan::DataMan UNKNOWN IMPORTED) + set_target_properties(DataMan::DataMan PROPERTIES + IMPORTED_LOCATION "${DataMan_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${DataMan_INCLUDE_DIR}" + ) + endif() + endif() +endif() diff --git a/examples/hello/CMakeLists.txt b/examples/hello/CMakeLists.txt index de6811d5f2eda4d16f17411e02dbb874cc7d0d86..ad255d169bd9a50201a2a960de9018c0a71695da 100644 --- a/examples/hello/CMakeLists.txt +++ b/examples/hello/CMakeLists.txt @@ -6,5 +6,6 @@ if(ADIOS_USE_ADIOS1) endif() if(ADIOS_USE_DataMan) - add_subdirectory(dataman) + add_subdirectory(datamanReader) + add_subdirectory(datamanWriter) endif() diff --git a/examples/hello/datamanReader/CMakeLists.txt b/examples/hello/datamanReader/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..a634e730e59e0e4b0620c44ef81d1a5de652b52a --- /dev/null +++ b/examples/hello/datamanReader/CMakeLists.txt @@ -0,0 +1,5 @@ +add_executable(hello_datamanReader helloDataManReader.cpp) +target_link_libraries(hello_datamanReader adios2) + +add_executable(hello_datamanReader_nompi helloDataManReader_nompi.cpp) +target_link_libraries(hello_datamanReader_nompi adios2) diff --git a/examples/hello/datamanWriter/CMakeLists.txt b/examples/hello/datamanWriter/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..469ce1b25d639b93b091e69ee2ae8102cf9bfd3f --- /dev/null +++ b/examples/hello/datamanWriter/CMakeLists.txt @@ -0,0 +1,5 @@ +add_executable(hello_datamanWriter helloDataManWriter.cpp) +target_link_libraries(hello_datamanWriter adios2) + +add_executable(hello_datamanWriter_nompi helloDataManWriter_nompi.cpp) +target_link_libraries(hello_datamanWriter_nompi adios2) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index f57dc0afbb739e9e2d2dff5db4cb05dc1efadb11..1702afb29a77499f72912dee12e7d4f9aa75ff13 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -1,6 +1,29 @@ add_library(adios2 ADIOS.cpp #ADIOS_C.cpp + + capsule/heap/STLVector.cpp + capsule/shmem/ShmSystemV.cpp + + core/Capsule.cpp + core/Engine.cpp + core/Method.cpp + core/Support.cpp + core/Transform.cpp + core/Transport.cpp + + engine/bp/BPFileReader.cpp + engine/bp/BPFileWriter.cpp + + format/BP1.cpp + format/BP1Aggregator.cpp + format/BP1Writer.cpp + + functions/adiosFunctions.cpp + + transport/file/FStream.cpp + transport/file/FileDescriptor.cpp + transport/file/FilePointer.cpp ) target_include_directories(adios2 PUBLIC ${ADIOS_SOURCE_DIR}/include) @@ -9,14 +32,31 @@ if(ADIOS_USE_MPI) target_include_directories(adios2 PUBLIC ${MPI_C_INCLUDE_PATH}) target_link_libraries(adios2 PUBLIC ${MPI_C_LIBRARIES}) else() - target_sources(adios2 mpidummy.cpp) + target_sources(adios2 PRIVATE mpidummy.cpp) target_compile_definitions(adios2 PUBLIC ADIOS_NOMPI) endif() -add_subdirectory(capsule) -add_subdirectory(core) -add_subdirectory(engine) -add_subdirectory(format) -add_subdirectory(functions) -add_subdirectory(transport) -add_subdirectory(transform) +if(ADIOS_USE_ADIOS1) + find_package(ADIOS REQUIRED) + target_sources(adios2 PRIVATE + engine/adios1/ADIOS1Reader.cpp + engine/adios1/ADIOS1Writer.cpp + ) + target_link_libraries(adios2 PRIVATE adios::adios) +endif() + +if(ADIOS_USE_DataMan) + find_package(DataMan REQUIRED) + target_sources(adios2 PRIVATE + engine/dataman/DataManReader.cpp + engine/dataman/DataManWriter.cpp + transport/wan/MdtmMan.cpp + ) + target_link_libraries(adios2 PRIVATE DataMan::DataMan) +endif() + +if(ADIOS_USE_BZip2) + find_package(BZip2 REQUIRED) + target_sources(adios2 PRIVATE transform/BZip2.cpp) + target_link_libraries(adios2 PRIVATE BZip2::BZip2) +endif() diff --git a/source/capsule/CMakeLists.txt b/source/capsule/CMakeLists.txt deleted file mode 100644 index 8e8bff322a278d59b626a3470dfd1bbda2970645..0000000000000000000000000000000000000000 --- a/source/capsule/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -target_sources(adios2 PRIVATE - capsule/heap/STLVector.cpp - capsule/shmem/ShmSystemV.cpp -) diff --git a/source/core/CMakeLists.txt b/source/core/CMakeLists.txt deleted file mode 100644 index 8770dd9071342c4dc88cb45912d71c95fad20999..0000000000000000000000000000000000000000 --- a/source/core/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -target_sources(adios2 PRIVATE - core/Capsule.cpp - core/Engine.cpp - core/Method.cpp - core/Support.cpp - core/Transform.cpp - core/Transport.cpp -) diff --git a/source/engine/CMakeLists.txt b/source/engine/CMakeLists.txt deleted file mode 100644 index 5422483ca6584888882744858713c4542f0d43e7..0000000000000000000000000000000000000000 --- a/source/engine/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -target_sources(adios2 PRIVATE - engine/bp/BPFileReader.cpp - engine/bp/BPFileWriter.cpp -) - -if(ADIOS_USE_ADIOS1) - find_package(ADIOS REQUIRED) - target_sources(adios2 PRIVATE - adios1/ADIOS1Reader.cpp - adios1/ADIOS1Writer.cpp - ) - target_link_libraries(adios2 adios::adios) -endif() - -if(ADIOS_USE_DataMan) - find_pacakge(DataMan REQUIRED) - target_sources(adios2 PRIVATE - dataman/DataManReader.cpp - dataman/DataManWriter.cpp - ) - target_link_libraries(adios2 PRIVATE DataMan::DataMan) -endif() diff --git a/source/format/CMakeLists.txt b/source/format/CMakeLists.txt deleted file mode 100644 index e71f524c9eb69e7f2bc1511c25d2eefb54c12cae..0000000000000000000000000000000000000000 --- a/source/format/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -target_sources(adios2 PRIVATE - format/BP1.cpp - format/BP1Aggregator.cpp - format/BP1Writer.cpp -) diff --git a/source/functions/CMakeLists.txt b/source/functions/CMakeLists.txt deleted file mode 100644 index 2f06e58daf6f0c50fd317fa3dcc7a0d48348867e..0000000000000000000000000000000000000000 --- a/source/functions/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -target_sources(adios2 PRIVATE - functions/adiosFunctions.cpp -) diff --git a/source/transform/CMakeLists.txt b/source/transform/CMakeLists.txt deleted file mode 100644 index 762c372fe05ee73584973e359b027eac36844689..0000000000000000000000000000000000000000 --- a/source/transform/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -if(ADIOS_USE_BZIP2) - find_package(BZip REQUIRED) - target_sources(adios2 BZip2.cpp) - target_link_libraries(adios2 PRIVATE BZip2::BZip2) -endif() diff --git a/source/transport/CMakeLists.txt b/source/transport/CMakeLists.txt deleted file mode 100644 index e9b16abd93840d835b422ea72f58db0fd9057080..0000000000000000000000000000000000000000 --- a/source/transport/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -target_sources(adios2 PRIVATE - transport/file/FStream.cpp - transport/file/FileDescriptor.cpp - transport/file/FilePointer.cpp -) - -if(ADIOS_USE_DataMan) - find_pacakge(DataMan REQUIRED) - target_sources(adios2 PRIVATE - wan/MdtmMan.cpp - ) - target_link_libraries(adios2 PRIVATE DataMan::DataMan) -endif()