Skip to content

Commit

Permalink
Hdf5 1 8 CMake changes from develop (#739)
Browse files Browse the repository at this point in the history
* Update supported platforms

* Merge PR#3 changes from develop

* # WARNING: head commit changed in the meantime

Merge gcc 10 diagnostics option from develop

Merge CMake changes from develop
Merge warnings from develop
Merge #318 OSX changes from develop
Merge tools changes from develop
Merge test macros from develop

* Format updates

* Fix missing semicolon and format fix

* Format update

* Correct actions, remove java option

* Update autotools build files

* Add testfiles

* Fix configure issue with make flags

* Init fapls to default

* Update generated files and fix h5repack id closure

* update format

* Merges from develop

#358 patches from vtk
#361 fix header guard spelling

* Merges from develop

#340 clang -Wformat-security warnings
#360 Fixed uninitialized warnings
header guard underscore cleanup
whitespace cleanup
tools sync

* format alignment

* initialize vars

* revert H5private change

* Merge #380 from develop

* Split format source and commit changes on repo push

* Change windows TS to use older VS.

* HDFFV-11229 merge dev changes for long double display in tools

* Committing clang-format changes

* Update unsupported types with precision

* Add "option" command for clang options

* CMake merges from develop h5cc scripts

* Updates from develop and printf formatters

* Committing clang-format changes

* Issue #669 remove version from pkgcfg filename

* remove version from h5cc script

* doxygen changes merged from develop

* Committing clang-format changes

* Enable fortran for gcc action

* Refactor Fortran CMake config tests and CMake test args

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
byrnHDF and github-actions[bot] authored Jun 8, 2021
1 parent 221fb01 commit 749c219
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 198 deletions.
6 changes: 3 additions & 3 deletions config/cmake/H5pubconf.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
/* Define the default plugins path to compile */
#cmakedefine H5_DEFAULT_PLUGINDIR "@H5_DEFAULT_PLUGINDIR@"

/* Define if `dev_t' is a scalar */
/* Define if dev_t is a scalar */
#cmakedefine H5_DEV_T_IS_SCALAR @H5_DEV_T_IS_SCALAR@

/* Define to dummy `main' function (if any) required to link to the Fortran
Expand Down Expand Up @@ -240,10 +240,10 @@
/* Define to 1 if you have the <mpe.h> header file. */
#cmakedefine H5_HAVE_MPE_H @H5_HAVE_MPE_H@

/* Define if MPI_Comm_c2f and MPI_Comm_f2c exists */
/* Define if MPI_Comm_c2f and MPI_Comm_f2c exist */
#cmakedefine H5_HAVE_MPI_MULTI_LANG_Comm @H5_HAVE_MPI_MULTI_LANG_Comm@

/* Define if MPI_Info_c2f and MPI_Info_f2c exists */
/* Define if MPI_Info_c2f and MPI_Info_f2c exist */
#cmakedefine H5_HAVE_MPI_MULTI_LANG_Info @H5_HAVE_MPI_MULTI_LANG_Info@

/* Define to 1 if you have the <openssl/evp.h> header file. */
Expand Down
170 changes: 21 additions & 149 deletions config/cmake/HDF5UseFortran.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -129,74 +129,12 @@ endif ()
# Determine the available KINDs for REALs and INTEGERs
#-----------------------------------------------------------------------------

#READ_SOURCE ("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" SOURCE_CODE)
set (PROG_SRC_CODE
"
PROGRAM FC_AVAIL_KINDS
IMPLICIT NONE
INTEGER :: ik, jk, k, max_decimal_prec
INTEGER :: num_rkinds = 1, num_ikinds = 1
INTEGER, DIMENSION(1:10) :: list_ikinds = -1
INTEGER, DIMENSION(1:10) :: list_rkinds = -1
OPEN(8, FILE='pac_fconftest.out', FORM='formatted')
! Find integer KINDs
list_ikinds(num_ikinds)=SELECTED_INT_KIND(1)
DO ik = 2, 36
k = SELECTED_INT_KIND(ik)
IF(k.LT.0) EXIT
IF(k.GT.list_ikinds(num_ikinds))THEN
num_ikinds = num_ikinds + 1
list_ikinds(num_ikinds) = k
ENDIF
ENDDO
DO k = 1, num_ikinds
WRITE(8,'(I0)', ADVANCE='NO') list_ikinds(k)
IF(k.NE.num_ikinds)THEN
WRITE(8,'(A)',ADVANCE='NO') ','
ELSE
WRITE(8,'()')
ENDIF
ENDDO
! Find real KINDs
list_rkinds(num_rkinds)=SELECTED_REAL_KIND(1)
max_decimal_prec = 1
prec: DO ik = 2, 36
exp: DO jk = 1, 17000
k = SELECTED_REAL_KIND(ik,jk)
IF(k.LT.0) EXIT exp
IF(k.GT.list_rkinds(num_rkinds))THEN
num_rkinds = num_rkinds + 1
list_rkinds(num_rkinds) = k
ENDIF
max_decimal_prec = ik
ENDDO exp
ENDDO prec
DO k = 1, num_rkinds
WRITE(8,'(I0)', ADVANCE='NO') list_rkinds(k)
IF(k.NE.num_rkinds)THEN
WRITE(8,'(A)',ADVANCE='NO') ','
ELSE
WRITE(8,'()')
ENDIF
ENDDO
WRITE(8,'(I0)') max_decimal_prec
WRITE(8,'(I0)') num_ikinds
WRITE(8,'(I0)') num_rkinds
END PROGRAM FC_AVAIL_KINDS
"
)
READ_SOURCE ("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" SOURCE_CODE)
if (NOT CMAKE_VERSION VERSION_LESS "3.14.0")
check_fortran_source_runs (${PROG_SRC_CODE} FC_AVAIL_KINDS_RESULT SRC_EXT f90)
check_fortran_source_runs (${SOURCE_CODE} FC_AVAIL_KINDS_RESULT SRC_EXT f90)
else ()
FORTRAN_RUN ("REAL and INTEGER KINDs"
"${PROG_SRC_CODE}"
"${SOURCE_CODE}"
XX
YY
FC_AVAIL_KINDS_RESULT
Expand Down Expand Up @@ -260,7 +198,7 @@ foreach (KIND ${VAR})
USE ISO_C_BINDING
IMPLICIT NONE
INTEGER (KIND=${KIND}) a
OPEN(8,FILE='pac_validIntKinds.out',FORM='formatted')
OPEN(8,FILE='pac_validIntKinds.${KIND}.out',FORM='formatted')
WRITE(8,'(I0)') ${FC_SIZEOF_A}
CLOSE(8)
END
Expand All @@ -271,7 +209,7 @@ foreach (KIND ${VAR})
else ()
FORTRAN_RUN("INTEGER KIND SIZEOF" ${PROG_SRC_${KIND}} XX YY VALIDINTKINDS_RESULT_${KIND})
endif ()
file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_validIntKinds.out" PROG_OUTPUT1)
file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_validIntKinds.${KIND}.out" PROG_OUTPUT1)
string (REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}")
set (pack_int_sizeof "${pack_int_sizeof} ${PROG_OUTPUT1},")
endforeach ()
Expand Down Expand Up @@ -309,7 +247,7 @@ foreach (KIND ${VAR} )
USE ISO_C_BINDING
IMPLICIT NONE
REAL (KIND=${KIND}) a
OPEN(8,FILE='pac_validRealKinds.out',FORM='formatted')
OPEN(8,FILE='pac_validRealKinds.${KIND}.out',FORM='formatted')
WRITE(8,'(I0)') ${FC_SIZEOF_A}
CLOSE(8)
END
Expand All @@ -320,7 +258,7 @@ foreach (KIND ${VAR} )
else ()
FORTRAN_RUN ("REAL KIND SIZEOF" ${PROG_SRC2_${KIND}} XX YY VALIDREALKINDS_RESULT_${KIND})
endif ()
file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_validRealKinds.out" PROG_OUTPUT1)
file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_validRealKinds.${KIND}.out" PROG_OUTPUT1)
string (REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}")
set (pack_real_sizeof "${pack_real_sizeof} ${PROG_OUTPUT1},")
endforeach ()
Expand Down Expand Up @@ -375,7 +313,7 @@ if (NOT CMAKE_VERSION VERSION_LESS "3.14.0")
else ()
FORTRAN_RUN ("SIZEOF NATIVE KINDs" ${PROG_SRC3} XX YY PAC_SIZEOF_NATIVE_KINDS_RESULT)
endif ()
file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_sizeof_native_kinds.out" PROG_OUTPUT)
file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_sizeof_native_kinds.out" PROG_OUTPUT3)
# dnl The output from the above program will be:
# dnl -- LINE 1 -- sizeof INTEGER
# dnl -- LINE 2 -- kind of INTEGER
Expand All @@ -385,14 +323,14 @@ file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_sizeof_native_kinds.out" PROG_OUTPUT)
# dnl -- LINE 6 -- kind of DOUBLE PRECISION

# Convert the string to a list of strings by replacing the carriage return with a semicolon
string (REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}")
string (REGEX REPLACE "\n" ";" PROG_OUTPUT3 "${PROG_OUTPUT3}")

list (GET PROG_OUTPUT 0 PAC_FORTRAN_NATIVE_INTEGER_SIZEOF)
list (GET PROG_OUTPUT 1 PAC_FORTRAN_NATIVE_INTEGER_KIND)
list (GET PROG_OUTPUT 2 PAC_FORTRAN_NATIVE_REAL_SIZEOF)
list (GET PROG_OUTPUT 3 PAC_FORTRAN_NATIVE_REAL_KIND)
list (GET PROG_OUTPUT 4 PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF)
list (GET PROG_OUTPUT 5 PAC_FORTRAN_NATIVE_DOUBLE_KIND)
list (GET PROG_OUTPUT3 0 PAC_FORTRAN_NATIVE_INTEGER_SIZEOF)
list (GET PROG_OUTPUT3 1 PAC_FORTRAN_NATIVE_INTEGER_KIND)
list (GET PROG_OUTPUT3 2 PAC_FORTRAN_NATIVE_REAL_SIZEOF)
list (GET PROG_OUTPUT3 3 PAC_FORTRAN_NATIVE_REAL_KIND)
list (GET PROG_OUTPUT3 4 PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF)
list (GET PROG_OUTPUT3 5 PAC_FORTRAN_NATIVE_DOUBLE_KIND)

if (NOT PAC_FORTRAN_NATIVE_INTEGER_SIZEOF)
message (FATAL_ERROR "Failed to find SIZEOF NATIVE INTEGER KINDs for Fortran")
Expand All @@ -418,79 +356,13 @@ set (${HDF_PREFIX}_FORTRAN_SIZEOF_LONG_DOUBLE ${${HDF_PREFIX}_SIZEOF_LONG_DOUBLE

set (${HDF_PREFIX}_H5CONFIG_F_NUM_RKIND "INTEGER, PARAMETER :: num_rkinds = ${NUM_RKIND}")

string (REGEX REPLACE "{" "" OUT_VAR ${PAC_FC_ALL_REAL_KINDS})
string (REGEX REPLACE "}" "" OUT_VAR ${OUT_VAR})
set (${HDF_PREFIX}_H5CONFIG_F_RKIND "INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/${OUT_VAR}/)")

string (REGEX REPLACE "{" "" OUT_VAR ${PAC_FC_ALL_REAL_KINDS_SIZEOF})
string (REGEX REPLACE "}" "" OUT_VAR ${OUT_VAR})
set (${HDF_PREFIX}_H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${OUT_VAR}/)")

ENABLE_LANGUAGE (C)

if (NOT CMAKE_VERSION VERSION_LESS "3.14.0")
include (CheckCSourceRuns)
else ()
#-----------------------------------------------------------------------------
# The provided CMake C macros don't provide a general compile/run function
# so this one is used.
#-----------------------------------------------------------------------------
macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR)
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
message (VERBOSE "Detecting C ${FUNCTION_NAME}")
endif ()
if (HDF5_REQUIRED_LIBRARIES)
set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
"-DLINK_LIBRARIES:STRING=${HDF5_REQUIRED_LIBRARIES}")
else ()
set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES)
endif ()
file (WRITE
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c
${SOURCE_CODE}
)
TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c
CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}"
RUN_OUTPUT_VARIABLE OUTPUT_VAR
)

set (${RETURN_VAR} ${OUTPUT_VAR})

#if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
# message (TRACE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
# message (TRACE "Test COMPILE_RESULT_VAR ${COMPILE_RESULT_VAR} ")
# message (TRACE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
# message (TRACE "Test RUN_RESULT_VAR ${RUN_RESULT_VAR} ")
# message (TRACE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
#endif ()

if (${COMPILE_RESULT_VAR})
if (${RUN_RESULT_VAR} MATCHES 1)
set (${RUN_RESULT_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION_NAME}")
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
message (VERBOSE "Testing C ${FUNCTION_NAME} - OK")
endif ()
file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the C ${FUNCTION_NAME} exists passed with the following output:\n"
"${OUTPUT_VAR}\n\n"
)
else ()
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
message (VERBOSE "Testing C ${FUNCTION_NAME} - Fail")
endif ()
set (${RUN_RESULT_VAR} 0 CACHE INTERNAL "Have C function ${FUNCTION_NAME}")
file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the C ${FUNCTION_NAME} exists failed with the following output:\n"
"${OUTPUT_VAR}\n\n")
endif ()
else ()
message (FATAL_ERROR "Compilation of C ${FUNCTION_NAME} - Failed")
endif ()
endmacro ()
endif ()
string (REGEX REPLACE "{" "" OUT_VAR1 ${PAC_FC_ALL_REAL_KINDS})
string (REGEX REPLACE "}" "" OUT_VAR1 ${OUT_VAR1})
set (${HDF_PREFIX}_H5CONFIG_F_RKIND "INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/${OUT_VAR1}/)")

string (REGEX REPLACE "{" "" OUT_VAR2 ${PAC_FC_ALL_REAL_KINDS_SIZEOF})
string (REGEX REPLACE "}" "" OUT_VAR2 ${OUT_VAR2})
set (${HDF_PREFIX}_H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${OUT_VAR2}/)")

# Setting definition if there is a 16 byte fortran integer
string (FIND ${PAC_FC_ALL_INTEGER_KINDS_SIZEOF} "16" pos)
Expand Down
18 changes: 7 additions & 11 deletions config/cmake/HDFCXXCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ endif ()
# HDF5 library compile options
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# CDash is configured to only allow 3000 warnings, so
# break into groups (from the config/gnu-flags file)
#-----------------------------------------------------------------------------
if (NOT MSVC AND NOT MINGW)
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
list (APPEND HDF5_CMAKE_CXX_FLAGS "-erroff=%none -DBSD_COMP")
Expand Down Expand Up @@ -147,7 +143,7 @@ if (NOT MSVC AND NOT MINGW)
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8-4.last")
endif ()

# Append more extra warning flags that only gcc 4.8+ know about
# Append more extra warning flags that only gcc 4.8+ knows about
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8")
if (HDF5_ENABLE_DEV_WARNINGS)
Expand All @@ -157,14 +153,14 @@ if (NOT MSVC AND NOT MINGW)
endif ()
endif ()

# Append more extra warning flags that only gcc 4.9+ know about
# Append more extra warning flags that only gcc 4.9+ knows about
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
# autotools always add the C flags with the CXX flags
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9")
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-4.9")
endif ()

# Append more extra warning flags that only gcc 5.1+ know about
# Append more extra warning flags that only gcc 5.1+ knows about
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
# autotools always add the C flags with the CXX flags
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-5")
Expand All @@ -175,13 +171,13 @@ if (NOT MSVC AND NOT MINGW)
endif ()
endif ()

# Append more extra warning flags that only gcc 6.x+ know about
# Append more extra warning flags that only gcc 6.x+ knows about
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
# autotools always add the C flags with the CXX flags
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/6")
endif ()

# Append more extra warning flags that only gcc 7.x+ know about
# Append more extra warning flags that only gcc 7.x+ knows about
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
# autotools always add the C flags with the CXX flags
ADD_H5_FLAGS (H5_CXxFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/7")
Expand All @@ -193,7 +189,7 @@ if (NOT MSVC AND NOT MINGW)
endif ()
endif ()

# Append more extra warning flags that only gcc 8.x+ know about
# Append more extra warning flags that only gcc 8.x+ knows about
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
# autotools always add the C flags with the CXX flags
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/8")
Expand All @@ -211,7 +207,7 @@ if (NOT MSVC AND NOT MINGW)
endif ()
endif ()

# Append more extra warning flags that only gcc 9.x+ know about
# Append more extra warning flags that only gcc 9.x+ knows about
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
# autotools always add the C flags with the CXX flags
ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/9")
Expand Down
Loading

0 comments on commit 749c219

Please sign in to comment.