Skip to content

Commit

Permalink
Programatically generate ADIOSConfig.h contents
Browse files Browse the repository at this point in the history
Use a 2-pass approach to generate ADIOS2.config.  The first pass
generates the configurable options in the header and the second pass
configures them.  This allows for consistency in the options used and
thier ordering with respect to where they're used elsewhere.
  • Loading branch information
Chuck Atkins committed Oct 10, 2017
1 parent 7519303 commit 0f43bde
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 27 deletions.
9 changes: 9 additions & 0 deletions cmake/ADIOSFunctions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ function(python_add_test)
endfunction()

function(GenerateADIOSHeaderConfig)
set(ADIOS2_CONFIG_DEFINES)
foreach(OPT IN LISTS ARGN)
string(TOUPPER ${OPT} OPT_UPPER)
string(APPEND ADIOS2_CONFIG_DEFINES "
/* CMake Option: ADIOS_USE_${OPT}=OFF */
#cmakedefine ADIOS2_HAVE_${OPT_UPPER}
")
if(ADIOS2_HAVE_${OPT})
set(ADIOS2_HAVE_${OPT_UPPER} 1)
else()
Expand All @@ -51,6 +56,10 @@ function(GenerateADIOSHeaderConfig)

configure_file(
${ADIOS2_SOURCE_DIR}/source/adios2/ADIOSConfig.h.in
${ADIOS2_BINARY_DIR}/source/adios2/ADIOSConfig.h.in
)
configure_file(
${ADIOS2_BINARY_DIR}/source/adios2/ADIOSConfig.h.in
${ADIOS2_BINARY_DIR}/source/adios2/ADIOSConfig.h
)
endfunction()
Expand Down
29 changes: 2 additions & 27 deletions source/adios2/ADIOSConfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,8 @@
* Id: @CMAKE_Fortran_COMPILER_ID@ @CMAKE_CXX_COMPILER_VERSION@
*/

/* CMake Option: ADIOS_USE_MPI=OFF */
#cmakedefine ADIOS2_HAVE_MPI
/* Everything past this line is programatically generated */

/* CMake Option: ADIOS_USE_ZFP=ON */
#cmakedefine ADIOS2_HAVE_ZFP

/* CMake Option: ADIOS_USE_BZip2=ON */
#cmakedefine ADIOS2_HAVE_BZIP2

/* CMake Option: ADIOS_USE_ADIOS1=ON */
#cmakedefine ADIOS2_HAVE_ADIOS1

/* CMake Option: ADIOS_USE_HDF5=ON */
#cmakedefine ADIOS2_HAVE_HDF5

/* CMake Option: ADIOS_USE_ZeroMQ=ON */
#cmakedefine ADIOS2_HAVE_ZEROMQ

/* CMake Option: ADIOS_USE_SysVShMem=ON */
#cmakedefine ADIOS2_HAVE_SYSVSHMEM

/* Optional Language Bindings: */

/* CMake Option: ADIOS_USE_Python=ON */
#cmakedefine ADIOS2_HAVE_PYTHON

/* CMake Option: ADIOS_USE_Fortran=ON */
#cmakedefine ADIOS2_HAVE_FORTRAN
@ADIOS2_CONFIG_DEFINES@

#endif /* ADIOSCONFIG_H_ */

0 comments on commit 0f43bde

Please sign in to comment.