Skip to content

Commit

Permalink
Use CMake features; add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
vicentebolea committed Aug 2, 2023
1 parent b9dec1e commit 6c4c723
Show file tree
Hide file tree
Showing 10 changed files with 185 additions and 187 deletions.
2 changes: 2 additions & 0 deletions cmake/ADIOSFunctions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,12 @@ function(GenerateADIOSHeaderConfig)
")
if(ADIOS2_HAVE_${OPT})
set(ADIOS2_HAVE_${OPT_UPPER} 1)
string(APPEND ADIOS2_CONFIG_FEATURE_LIST "\"${OPT_UPPER}\",")
else()
set(ADIOS2_HAVE_${OPT_UPPER})
endif()
endforeach()
string(APPEND ADIOS2_CONFIG_FEATURE_LIST "nullptr")

configure_file(
${ADIOS2_SOURCE_DIR}/source/adios2/common/ADIOSConfig.h.in
Expand Down
6 changes: 3 additions & 3 deletions source/adios2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ add_library(adios2_core
core/VariableBase.cpp
core/Span.cpp core/Span.tcc
core/Group.cpp core/Group.tcc
core/adios2_libinfo.cpp
core/Info.cpp

#operator
operator/callback/Signature1.cpp
Expand Down Expand Up @@ -405,10 +405,10 @@ install(FILES common/ADIOSMacros.h common/ADIOSTypes.h common/ADIOSTypes.inl
install(DIRECTORY core/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/adios2/core COMPONENT adios2_core-development
FILES_MATCHING PATTERN "*.h"
PATTERN "adios2_libinfo.h" EXCLUDE
PATTERN "Info.h" EXCLUDE
)

install(FILES core/adios2_libinfo.h
install(FILES core/Info.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT adios2_core-development
)

Expand Down
2 changes: 2 additions & 0 deletions source/adios2/common/ADIOSConfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

@ADIOS2_CONFIG_DEFINES@

#define ADIOS2_FEATURE_LIST @ADIOS2_CONFIG_FEATURE_LIST@

/* Everything between here and the note above is programatically generated */

#ifndef ADIOS2_USE_MPI
Expand Down
113 changes: 113 additions & 0 deletions source/adios2/core/Info.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
* Distributed under the OSI-approved Apache License, Version 2.0. See
* accompanying file Copyright.txt for details.
*
* Info.h
*
* Created on: June 22, 2023
* Author: Norbert Podhorszki [email protected]
*/

#include "Info.h"
#include "adios2/common/ADIOSConfig.h"

#include <stdio.h>
#include <stdlib.h>

#ifdef __cplusplus
extern "C" {
#endif

const int adios2_version_major = ADIOS2_VERSION_MAJOR;
const int adios2_version_minor = ADIOS2_VERSION_MINOR;
const int adios2_version_patch = ADIOS2_VERSION_PATCH;
const char adios2_version_str[] = ADIOS2_VERSION_STR;

static const char *const engines[] = {"BP3",
"BP4",
#ifdef ADIOS2_HAVE_BP5
"BP5",
#endif
#ifdef ADIOS2_HAVE_HDF5
"HDF5",
#endif
#ifdef ADIOS2_HAVE_SST
"SST",
#endif
#ifdef ADIOS2_HAVE_MPI
"SSC",
#endif
#ifdef ADIOS2_HAVE_DataMan
"DataMan",
#endif
#ifdef ADIOS2_HAVE_DataSpaces
"DataSpaces",
#endif
"Inline",
#ifdef ADIOS2_HAVE_DAOS
"DAOS",
#endif
#ifdef ADIOS2_HAVE_MHS
"MHS",
#endif
#ifdef ADIOS2_HAVE_CATALYST
"ParaViewADIOSInSituEngine",
#endif
"Null",
"Skeleton",
nullptr};

void adios2_available_engines(size_t *nentries, const char *const **list)
{
*nentries = (sizeof(engines) / sizeof(const char *)) - 1;
*list = engines;
}

static const char *const operators[] = {
#ifdef ADIOS2_HAVE_BZIP2
"BZip2",
#endif
#ifdef ADIOS2_HAVE_BLOSC2
"Blosc",
#endif
#ifdef ADIOS2_HAVE_MGARD
"MGARD",
"MGARDPlus",
#endif
#ifdef ADIOS2_HAVE_SZ
"SZ",
#endif
#ifdef ADIOS2_HAVE_ZFP
"ZFP",
#endif
#ifdef ADIOS2_HAVE_PNG
"PNG",
#endif
#ifdef ADIOS2_HAVE_SIRIUS
"Sirius",
#endif
#ifdef ADIOS2_HAVE_LIBPRESSIO
"libpressio",
#ifdef ADIOS2_HAVE_SODIUM
"Sodium plugin",
#endif
#endif
nullptr};

void adios2_available_operators(size_t *nentries, const char *const **list)
{
*nentries = (sizeof(operators) / sizeof(const char *)) - 1;
*list = operators;
}

const char *adios2_feature_list[] = {ADIOS2_FEATURE_LIST};

void adios2_available_features(size_t *nentries, const char *const **list)
{
*nentries = (sizeof(adios2_feature_list) / sizeof(const char *)) - 1;
*list = adios2_feature_list;
}

#ifdef __cplusplus
} // end extern C
#endif
18 changes: 10 additions & 8 deletions source/adios2/core/adios2_libinfo.h → source/adios2/core/Info.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
* Distributed under the OSI-approved Apache License, Version 2.0. See
* accompanying file Copyright.txt for details.
*
* adios2_libinfo.h
* Info.h
*
* Created on: June 22, 2023
* Author: Norbert Podhorszki [email protected]
*/

#ifndef ADIOS2_LIBINFO_H_
#define ADIOS2_LIBINFO_H_
#ifndef ADIOS2_INFO_H_
#define ADIOS2_INFO_H_

#include <stddef.h>

#ifdef __cplusplus
extern "C" {
Expand All @@ -18,19 +20,19 @@ extern "C" {
extern const int adios2_version_major;
extern const int adios2_version_minor;
extern const int adios2_version_patch;
extern const char *const adios2_version_str;
extern const char adios2_version_str[];

/** Return the list of available Engines in the installed adios2 library */
void adios2_available_engines(int *nentries, char const *const **list);
void adios2_available_engines(size_t *nentries, const char *const **list);

/** Return the list of available Engines in the installed adios2 library */
void adios2_available_operators(int *nentries, char const *const **list);
void adios2_available_operators(size_t *nentries, const char *const **list);

/** Return the list of available features in the installed adios2 library */
void adios2_available_features(int *nentries, char const *const **list);
void adios2_available_features(size_t *nentries, const char *const **list);

#ifdef __cplusplus
} // end extern C
#endif

#endif /* ADIOS2_LIBINFO_H_ */
#endif /* ADIOS2_INFO_H_ */
163 changes: 0 additions & 163 deletions source/adios2/core/adios2_libinfo.cpp

This file was deleted.

Loading

0 comments on commit 6c4c723

Please sign in to comment.