From 0f43bdedac599c76a9b10fa9e42f27e72afb0a49 Mon Sep 17 00:00:00 2001 From: Chuck Atkins Date: Tue, 10 Oct 2017 10:55:32 -0400 Subject: [PATCH] Programatically generate ADIOSConfig.h contents 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. --- cmake/ADIOSFunctions.cmake | 9 +++++++++ source/adios2/ADIOSConfig.h.in | 29 ++--------------------------- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/cmake/ADIOSFunctions.cmake b/cmake/ADIOSFunctions.cmake index c6ad25a2af..8864a202fd 100644 --- a/cmake/ADIOSFunctions.cmake +++ b/cmake/ADIOSFunctions.cmake @@ -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() @@ -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() diff --git a/source/adios2/ADIOSConfig.h.in b/source/adios2/ADIOSConfig.h.in index b993cbaa48..5d1cdebd8f 100644 --- a/source/adios2/ADIOSConfig.h.in +++ b/source/adios2/ADIOSConfig.h.in @@ -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_ */