Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmakedefine macro uses C comments with "#undef" #3845

Merged
merged 3 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion fortran/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,25 @@ if (H5_HAVE_PARALLEL)
endif ()

set (CMAKE_H5_HAVE_FLOAT128 0)
if (HAVE_FLOAT128)
if (H5_HAVE_FLOAT128)
set (CMAKE_H5_HAVE_FLOAT128 1)
endif ()

set (CMAKE_H5_FORTRAN_HAVE_STORAGE_SIZE 0)
if (H5_FORTRAN_HAVE_STORAGE_SIZE)
set (CMAKE_H5_FORTRAN_HAVE_STORAGE_SIZE 1)
endif ()

set (CMAKE_H5_FORTRAN_HAVE_SIZEOF 0)
if (H5_FORTRAN_HAVE_SIZEOF)
set (CMAKE_H5_FORTRAN_HAVE_SIZEOF 1)
endif ()

set (CMAKE_H5_FORTRAN_HAVE_C_SIZEOF 0)
if (H5_FORTRAN_HAVE_C_SIZEOF)
set (CMAKE_H5_FORTRAN_HAVE_C_SIZEOF 1)
endif ()

configure_file (${HDF5_F90_SRC_SOURCE_DIR}/H5config_f.inc.cmake ${HDF5_F90_BINARY_DIR}/H5config_f.inc @ONLY)
configure_file (${HDF5_F90_SRC_SOURCE_DIR}/H5fort_type_defines.h.cmake ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h @ONLY)

Expand Down
2 changes: 1 addition & 1 deletion fortran/src/H5_ff.F90
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ INTEGER(HID_T) FUNCTION h5kind_to_type(ikind, flag) RESULT(h5_type)
h5_type = H5T_NATIVE_REAL_C_LONG_DOUBLE
#endif
#if H5_PAC_FC_MAX_REAL_PRECISION > 28
#if H5_HAVE_FLOAT128 == 1
#ifdef H5_HAVE_FLOAT128
ELSE
h5_type = H5T_NATIVE_FLOAT_128
#endif
Expand Down
28 changes: 24 additions & 4 deletions fortran/src/H5config_f.inc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,28 @@
#endif

! Define if the intrinsic function STORAGE_SIZE exists
#cmakedefine H5_FORTRAN_HAVE_STORAGE_SIZE @H5_FORTRAN_HAVE_STORAGE_SIZE@
#cmakedefine01 CMAKE_H5_FORTRAN_HAVE_STORAGE_SIZE
#if CMAKE_H5_FORTRAN_HAVE_STORAGE_SIZE == 0
#undef H5_FORTRAN_HAVE_STORAGE_SIZE
#else
#define H5_FORTRAN_HAVE_STORAGE_SIZE
#endif

! Define if the intrinsic function SIZEOF exists
#cmakedefine H5_FORTRAN_HAVE_SIZEOF @H5_FORTRAN_HAVE_SIZEOF@
#cmakedefine01 CMAKE_H5_FORTRAN_HAVE_SIZEOF
#if CMAKE_H5_FORTRAN_HAVE_SIZEOF == 0
#undef H5_FORTRAN_HAVE_SIZEOF
#else
#define H5_FORTRAN_HAVE_SIZEOF
#endif

! Define if the intrinsic function C_SIZEOF exists
#cmakedefine H5_FORTRAN_HAVE_C_SIZEOF @H5_FORTRAN_HAVE_C_SIZEOF@
#cmakedefine01 CMAKE_H5_FORTRAN_HAVE_C_SIZEOF
#if CMAKE_H5_FORTRAN_HAVE_C_SIZEOF == 0
#undef H5_FORTRAN_HAVE_C_SIZEOF
#else
#define H5_FORTRAN_HAVE_C_SIZEOF
#endif

! Define if the intrinsic function C_LONG_DOUBLE exists
#define H5_FORTRAN_HAVE_C_LONG_DOUBLE @H5_FORTRAN_HAVE_C_LONG_DOUBLE@
Expand All @@ -63,7 +78,12 @@
#define H5_PAC_FC_MAX_REAL_PRECISION @H5_PAC_FC_MAX_REAL_PRECISION@

! If C has quad precision
#cmakedefine H5_HAVE_FLOAT128 @H5_HAVE_FLOAT128@
#cmakedefine01 CMAKE_H5_HAVE_FLOAT128
#if CMAKE_H5_HAVE_FLOAT128 == 0
#undef H5_HAVE_FLOAT128
#else
#define H5_HAVE_FLOAT128
#endif

! Define if INTEGER*16 is available
#define H5_HAVE_Fortran_INTEGER_SIZEOF_16 @H5_HAVE_Fortran_INTEGER_SIZEOF_16@
Expand Down