Skip to content

Commit

Permalink
ci: sync upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoklee committed Mar 26, 2024
2 parents d62184a + 724eaaf commit f3deb31
Show file tree
Hide file tree
Showing 23 changed files with 925 additions and 432 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/main-auto-spc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,10 @@ jobs:
sh ./autogen.sh
mkdir "${{ runner.workspace }}/build"
cd "${{ runner.workspace }}/build"
CFLAGS=-Werror $GITHUB_WORKSPACE/configure \
CFLAGS=-Werror JAVACFLAGS=-Werror JNIFLAGS=-Werror \
$GITHUB_WORKSPACE/configure \
--enable-build-mode=debug \
--enable-warnings-as-errors \
--enable-deprecated-symbols \
--with-default-api-version=v114 \
--enable-shared \
Expand Down Expand Up @@ -478,8 +480,10 @@ jobs:
sh ./autogen.sh
mkdir "${{ runner.workspace }}/build"
cd "${{ runner.workspace }}/build"
CFLAGS=-Werror $GITHUB_WORKSPACE/configure \
CFLAGS=-Werror JAVACFLAGS=-Werror JNIFLAGS=-Werror \
$GITHUB_WORKSPACE/configure \
--enable-build-mode=production \
--enable-warnings-as-errors \
--enable-deprecated-symbols \
--with-default-api-version=v114 \
--enable-shared \
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/main-cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ jobs:

# CMake gets libaec from fetchcontent

- name: Install Dependencies (Windows)
run: choco install ninja
if: matrix.os == 'windows-latest'

- name: Install Dependencies (macOS)
run: brew install ninja
if: matrix.os == 'macos-13'
Expand Down
12 changes: 0 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1072,8 +1072,6 @@ set (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) name ## _")
if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran")
option (HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF)
if (HDF5_BUILD_FORTRAN)
include (${HDF_RESOURCES_DIR}/HDFUseFortran.cmake)

message (VERBOSE "Fortran compiler ID is ${CMAKE_Fortran_COMPILER_ID}")
include (${HDF_RESOURCES_DIR}/HDFFortranCompilerFlags.cmake)
include (${HDF_RESOURCES_DIR}/HDF5UseFortran.cmake)
Expand Down Expand Up @@ -1147,16 +1145,6 @@ if (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++")
endif ()
endif ()

#-----------------------------------------------------------------------------
# Check if Fortran's default real is double precision. If it is and HL is
# being built then configure should fail due to bug HDFFV-889.
#-----------------------------------------------------------------------------
if (HDF5_BUILD_FORTRAN AND HDF5_BUILD_HL_LIB)
if (NOT H5_FORTRAN_DEFAULT_REAL_NOT_DOUBLE)
message (FATAL_ERROR " **** Fortran high-level routines are not supported when the default REAL is DOUBLE PRECISION, use HDF5_BUILD_HL_LIB:BOOL=OFF **** ")
endif ()
endif ()

#-----------------------------------------------------------------------------
# Option to build HDF5 Java Library
#-----------------------------------------------------------------------------
Expand Down
48 changes: 33 additions & 15 deletions HDF5Examples/C/H5T/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ if (HDF5_BUILD_TOOLS)
if (NOT ${example_name} STREQUAL "h5ex_t_convert")
if (${example_name} STREQUAL "h5ex_t_vlen" OR ${example_name} STREQUAL "h5ex_t_vlenatt")
if (HDF5_VERSION_STRING VERSION_GREATER_EQUAL "1.14.3")
if (${H5_LIBVER_DIR} EQUAL 16 AND ${example_name} STREQUAL "h5ex_t_vlenatt")
if ((${EXAMPLE_VARNAME}_USE_16_API OR ${H5_LIBVER_DIR} EQUAL 16) AND ${example_name} STREQUAL "h5ex_t_vlenatt")
add_custom_command (
TARGET ${EXAMPLE_VARNAME}_${example_name}
POST_BUILD
Expand All @@ -130,7 +130,7 @@ if (HDF5_BUILD_TOOLS)
ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/114/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl
)
endif ()
elseif (${H5_LIBVER_DIR} EQUAL 16)
elseif (${EXAMPLE_VARNAME}_USE_16_API OR ${H5_LIBVER_DIR} EQUAL 16)
add_custom_command (
TARGET ${EXAMPLE_VARNAME}_${example_name}
POST_BUILD
Expand Down Expand Up @@ -180,7 +180,7 @@ if (HDF5_BUILD_TOOLS)
)
endif ()
elseif (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.12")
if (${H5_LIBVER_DIR} EQUAL 16)
if (${EXAMPLE_VARNAME}_USE_16_API OR ${H5_LIBVER_DIR} EQUAL 16)
add_custom_command (
TARGET ${EXAMPLE_VARNAME}_${example_name}
POST_BUILD
Expand All @@ -196,12 +196,21 @@ if (HDF5_BUILD_TOOLS)
)
endif ()
else ()
add_custom_command (
TARGET ${EXAMPLE_VARNAME}_${example_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl
)
if (${EXAMPLE_VARNAME}_USE_16_API OR ${H5_LIBVER_DIR} EQUAL 16)
add_custom_command (
TARGET ${EXAMPLE_VARNAME}_${example_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/16/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl
)
else ()
add_custom_command (
TARGET ${EXAMPLE_VARNAME}_${example_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl
)
endif ()
endif ()
else ()
if (HDF5_VERSION_MAJOR VERSION_EQUAL "1.8")
Expand Down Expand Up @@ -260,12 +269,21 @@ if (HDF5_BUILD_TOOLS)
ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/16/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl
)
else ()
add_custom_command (
TARGET ${EXAMPLE_VARNAME}_${example_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl
)
if (${EXAMPLE_VARNAME}_USE_16_API)
add_custom_command (
TARGET ${EXAMPLE_VARNAME}_${example_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/16/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl
)
else ()
add_custom_command (
TARGET ${EXAMPLE_VARNAME}_${example_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl
)
endif ()
endif ()
endif ()
endforeach ()
Expand Down
75 changes: 59 additions & 16 deletions config/cmake/HDF5UseFortran.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,15 @@
# This file provides functions for HDF5 specific Fortran support.
#
#-------------------------------------------------------------------------------
enable_language (Fortran)
include (${HDF_RESOURCES_DIR}/HDFUseFortran.cmake)

set (HDF_PREFIX "H5")
include (CheckFortranFunctionExists)

# Force lowercase Fortran module file names
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Cray")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ef")
endif ()

include (CheckFortranFunctionExists)

include (CheckFortranSourceRuns)
include (CheckFortranSourceCompiles)

# Read source line beginning at the line matching Input:"START" and ending at the line matching Input:"END"
macro (READ_SOURCE SOURCE_START SOURCE_END RETURN_VAR)
file (READ "${HDF5_SOURCE_DIR}/m4/aclocal_fc.f90" SOURCE_MASTER)
string (REGEX MATCH "${SOURCE_START}[\\\t\\\n\\\r[].+]*${SOURCE_END}" SOURCE_CODE ${SOURCE_MASTER})
set (RETURN_VAR "${SOURCE_CODE}")
endmacro ()

set (RUN_OUTPUT_PATH_DEFAULT ${CMAKE_BINARY_DIR})
# The provided CMake Fortran macros don't provide a general compile/run function
# so this one is used.
Expand Down Expand Up @@ -152,8 +140,12 @@ endif ()
#-----------------------------------------------------------------------------
# Determine the available KINDs for REALs and INTEGERs
#-----------------------------------------------------------------------------
if (${HAVE_ISO_FORTRAN_ENV})
READ_SOURCE ("PROGRAM FC08_AVAIL_KINDS" "END PROGRAM FC08_AVAIL_KINDS" SOURCE_CODE)
else ()
READ_SOURCE ("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" SOURCE_CODE)
endif ()

READ_SOURCE ("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" SOURCE_CODE)
FORTRAN_RUN ("REAL and INTEGER KINDs"
"${SOURCE_CODE}"
XX
Expand All @@ -167,6 +159,9 @@ FORTRAN_RUN ("REAL and INTEGER KINDs"
# dnl -- LINE 3 -- max decimal precision for reals
# dnl -- LINE 4 -- number of valid integer kinds
# dnl -- LINE 5 -- number of valid real kinds
# dnl -- LINE 6 -- number of valid logical kinds
# dnl -- LINE 7 -- valid logical kinds (comma separated list)

#
# Convert the string to a list of strings by replacing the carriage return with a semicolon
string (REGEX REPLACE "[\r\n]+" ";" PROG_OUTPUT "${PROG_OUTPUT}")
Expand Down Expand Up @@ -202,6 +197,55 @@ message (STATUS "....REAL KINDS FOUND ${PAC_FC_ALL_REAL_KINDS}")
message (STATUS "....INTEGER KINDS FOUND ${PAC_FC_ALL_INTEGER_KINDS}")
message (STATUS "....MAX DECIMAL PRECISION ${${HDF_PREFIX}_PAC_FC_MAX_REAL_PRECISION}")

if (${HAVE_ISO_FORTRAN_ENV})

list (GET PROG_OUTPUT 5 NUM_LKIND)
set (PAC_FORTRAN_NUM_LOGICAL_KINDS "${NUM_LKIND}")

list (GET PROG_OUTPUT 6 pac_validLogicalKinds)
# If the list is empty then something went wrong.
if (NOT pac_validLogicalKinds)
message (FATAL_ERROR "Failed to find available LOGICAL KINDs for Fortran")
endif ()

set (PAC_FC_ALL_LOGICAL_KINDS "\{${pac_validLogicalKinds}\}")
message (STATUS "....LOGICAL KINDS FOUND ${PAC_FC_ALL_LOGICAL_KINDS}")

# ********************
# LOGICAL KIND FOR MPI
# ********************
if (HDF5_ENABLE_PARALLEL AND BUILD_TESTING)
string (REGEX REPLACE "," ";" VAR "${pac_validLogicalKinds}")

set(CMAKE_REQUIRED_QUIET TRUE)
foreach (KIND ${VAR})
unset(MPI_LOGICAL_KIND CACHE)
set (PROG_SRC
"
PROGRAM main
USE MPI
IMPLICIT NONE
LOGICAL(KIND=${KIND}) :: flag
INTEGER(KIND=MPI_INTEGER_KIND) :: info_ret, mpierror
CHARACTER(LEN=3) :: info_val
CALL mpi_info_get(info_ret,\"foo\", 3_MPI_INTEGER_KIND, info_val, flag, mpierror)
END
"
)
check_fortran_source_compiles (${PROG_SRC} MPI_LOGICAL_KIND SRC_EXT f90)

if (MPI_LOGICAL_KIND)
set (${HDF_PREFIX}_MPI_LOGICAL_KIND ${KIND})
message (STATUS "....FORTRAN LOGICAL KIND for MPI is ${KIND}")
endif ()
endforeach ()
if (${HDF_PREFIX}_MPI_LOGICAL_KIND STREQUAL "")
message (FATAL_ERROR "Failed to determine LOGICAL KIND for MPI")
endif ()
set(CMAKE_REQUIRED_QUIET FALSE)
endif()
endif()

#-----------------------------------------------------------------------------
# Determine the available KINDs for REALs and INTEGERs
#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -350,7 +394,6 @@ if (NOT PAC_FORTRAN_NATIVE_DOUBLE_KIND)
message (FATAL_ERROR "Failed to find KIND of NATIVE DOUBLE for Fortran")
endif ()


set (${HDF_PREFIX}_FORTRAN_SIZEOF_LONG_DOUBLE ${${HDF_PREFIX}_SIZEOF_LONG_DOUBLE})

# remove the invalid kind from the list
Expand Down
95 changes: 19 additions & 76 deletions config/cmake/HDFUseFortran.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,73 +43,26 @@ file (STRINGS ${CMAKE_BINARY_DIR}/FCMangle.h CONTENTS REGEX "H5_FC_GLOBAL_\\(.*,
string (REGEX MATCH "H5_FC_GLOBAL_\\(.*,.*\\) +(.*)" RESULT ${CONTENTS})
set (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) ${CMAKE_MATCH_1}")

# Read source line beginning at the line matching Input:"START" and ending at the line matching Input:"END"
macro (READ_SOURCE SOURCE_START SOURCE_END RETURN_VAR)
file (READ "${HDF5_SOURCE_DIR}/m4/aclocal_fc.f90" SOURCE_MASTER)
string (REGEX MATCH "${SOURCE_START}[\\\t\\\n\\\r[].+]*${SOURCE_END}" SOURCE_CODE ${SOURCE_MASTER})
set (RETURN_VAR "${SOURCE_CODE}")
endmacro ()

if (HDF5_REQUIRED_LIBRARIES)
set (CMAKE_REQUIRED_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}")
endif ()

READ_SOURCE("PROGRAM PROG_FC_SIZEOF" "END PROGRAM PROG_FC_SIZEOF" SOURCE_CODE)
check_fortran_source_compiles (${SOURCE_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_SIZEOF SRC_EXT f90)

READ_SOURCE("PROGRAM PROG_FC_C_SIZEOF" "END PROGRAM PROG_FC_C_SIZEOF" SOURCE_CODE)
check_fortran_source_compiles (${SOURCE_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_C_SIZEOF SRC_EXT f90)

READ_SOURCE("PROGRAM PROG_FC_STORAGE_SIZE" "END PROGRAM PROG_FC_STORAGE_SIZE" SOURCE_CODE)
check_fortran_source_compiles (${SOURCE_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_STORAGE_SIZE SRC_EXT f90)

#test code source
set (SIZEOF_CODE
"
PROGRAM main
i = sizeof(x)
END PROGRAM
"
)
set (C_SIZEOF_CODE
"
PROGRAM main
USE ISO_C_BINDING
INTEGER(C_INT) :: a
INTEGER(C_SIZE_T) :: result
result = c_sizeof(a)
END PROGRAM
"
)
set (STORAGE_SIZE_CODE
"
PROGRAM main
INTEGER :: a
INTEGER :: result
result = storage_size(a)
END PROGRAM
"
)
set (CHAR_ALLOC
"
PROGRAM main
CHARACTER(:), ALLOCATABLE :: str
END PROGRAM
"
)
set (ISO_FORTRAN_ENV_CODE
"
PROGRAM main
USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : atomic_logical_kind
LOGICAL(KIND=atomic_logical_kind) :: state
END PROGRAM
"
)
set (REALISNOTDOUBLE_CODE
"
MODULE type_mod
INTERFACE h5t
MODULE PROCEDURE h5t_real
MODULE PROCEDURE h5t_dble
END INTERFACE
CONTAINS
SUBROUTINE h5t_real(r)
REAL :: r
END SUBROUTINE h5t_real
SUBROUTINE h5t_dble(d)
DOUBLE PRECISION :: d
END SUBROUTINE h5t_dble
END MODULE type_mod
PROGRAM main
USE type_mod
REAL :: r
DOUBLE PRECISION :: d
CALL h5t(r)
CALL h5t(d)
END PROGRAM main
"
)
set (ISO_C_BINDING_CODE
"
PROGRAM main
Expand All @@ -123,17 +76,7 @@ set (ISO_C_BINDING_CODE
END PROGRAM
"
)

if (HDF5_REQUIRED_LIBRARIES)
set (CMAKE_REQUIRED_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}")
endif ()
check_fortran_source_compiles (${SIZEOF_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_SIZEOF SRC_EXT f90)
check_fortran_source_compiles (${C_SIZEOF_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_C_SIZEOF SRC_EXT f90)
check_fortran_source_compiles (${STORAGE_SIZE_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_STORAGE_SIZE SRC_EXT f90)
check_fortran_source_compiles (${ISO_FORTRAN_ENV_CODE} ${HDF_PREFIX}_HAVE_ISO_FORTRAN_ENV SRC_EXT f90)
check_fortran_source_compiles (${REALISNOTDOUBLE_CODE} ${HDF_PREFIX}_FORTRAN_DEFAULT_REAL_NOT_DOUBLE SRC_EXT f90)
check_fortran_source_compiles (${ISO_C_BINDING_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_ISO_C_BINDING SRC_EXT f90)
check_fortran_source_compiles (${CHAR_ALLOC} ${HDF_PREFIX}_FORTRAN_HAVE_CHAR_ALLOC SRC_EXT f90)

#-----------------------------------------------------------------------------
# Add debug information (intel Fortran : JB)
Expand Down
1 change: 0 additions & 1 deletion config/gnu-warnings/8
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
-Wattribute-alias
-Wcast-align=strict
-Wshift-overflow=2
11 changes: 11 additions & 0 deletions config/gnu-warnings/error-8
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,14 @@
# that GCC 8 only performs that analysis at -O3, though.
#
-Werror=maybe-uninitialized
# Ask GCC to warn about cast-align problems, even on platforms where
# it normally wouldn't (because those platforms don't require alignment).
# While this flag doesn't follow the -Werror format like above, it's
# placed here to make sure that it comes after the -Werror=cast-align
# line from error-general in the list of flags. Otherwise, if the
# '--enable-warnings-as-errors' flag isn't passed at configure time,
# the logic in config/gnu-flags that demotes these errors to their
# normal warning form will cause -Wcast-align to come after
# -Wcast-align=strict in the list of flags, causing it to take
# precedence and mask cast-align warnings from GCC on certain platforms.
-Wcast-align=strict
Loading

0 comments on commit f3deb31

Please sign in to comment.