Skip to content

Commit 47c7bd9

Browse files
byrnHDFgithub-actions[bot]derobins
authored
Rework Fortran configure to allow multiple CMake reruns (#721)
* OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds * TRILAB-227 - fix indexing for h5diff selections * Correct location of pos to index function call * TRILAB-227 Enable test * Quote subset args * Use MATCHES because of AppleClang * if blocks needed for build modes * Update list of DT platforms * VS2019 correctly displays float values * revert VS2019 change * Issue #669 remove version from pkgcfg filename * remove version from h5cc script * Java reference functions updated enabled fortran in cmake gcc action yaml file java reference test changed to correctly test refs jni reference functions that create ids changed to use jni id logging * Correct BYPRODUCTS argument * Correct more genereated files BYPRODUCTS * BYPRODUCTS must have unique locations * Fix typo * Fix fortran configure checks * Rework H5_PAC_C_MAX_REAL_PRECISION setting logic * Add note about fortran configure change * Adds a quick for for some egregious chunk_info badness (#722) * Fixes issue with ccmake that prevents building Fortran (#723) ccmake runs iteratively, and the check_fortran_source_runs macros were clobbering a single output file that did not get updated on further configure iterations * Fix conflicts with merge * Move MAX_PRECISION back to HDF5UseFortran.cmake * Use STREQUAL to test macro argument * Move C language test to ConfigureChecks from HDF5UseFortran Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
1 parent 62ddef9 commit 47c7bd9

File tree

8 files changed

+167
-163
lines changed

8 files changed

+167
-163
lines changed

config/cmake/ConfigureChecks.cmake

+111-4
Original file line numberDiff line numberDiff line change
@@ -213,18 +213,125 @@ endif()
213213
# Check if C has __float128 extension
214214
#-----------------------------------------------------------------------------
215215

216-
CHECK_TYPE_SIZE("__float128" ${HDF_PREFIX}_SIZEOF___FLOAT128)
217-
if (${${HDF_PREFIX}_SIZEOF___FLOAT128})
216+
HDF_CHECK_TYPE_SIZE(__float128 _SIZEOF___FLOAT128)
217+
if (${_SIZEOF___FLOAT128})
218218
set (${HDF_PREFIX}_HAVE_FLOAT128 1)
219+
set (${HDF_PREFIX}_SIZEOF___FLOAT128 ${_SIZEOF___FLOAT128})
219220
else ()
220221
set (${HDF_PREFIX}_HAVE_FLOAT128 0)
221222
set (${HDF_PREFIX}_SIZEOF___FLOAT128 0)
222223
endif ()
223224

224-
CHECK_TYPE_SIZE("_Quad" ${HDF_PREFIX}_SIZEOF__QUAD)
225-
if (NOT ${${HDF_PREFIX}_SIZEOF__QUAD})
225+
HDF_CHECK_TYPE_SIZE(_Quad _SIZEOF__QUAD)
226+
if (NOT ${_SIZEOF__QUAD})
226227
set (${HDF_PREFIX}_SIZEOF__QUAD 0)
228+
else ()
229+
set (${HDF_PREFIX}_SIZEOF__QUAD ${_SIZEOF__QUAD})
230+
endif ()
231+
232+
#-----------------------------------------------------------------------------
233+
# The provided CMake C macros don't provide a general compile/run function
234+
# so this one is used.
235+
#-----------------------------------------------------------------------------
236+
macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR)
237+
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
238+
message (VERBOSE "Detecting C ${FUNCTION_NAME}")
239+
endif ()
240+
file (WRITE
241+
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c
242+
${SOURCE_CODE}
243+
)
244+
TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR
245+
${CMAKE_BINARY_DIR}
246+
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c
247+
COMPILE_DEFINITIONS "-D_SIZEOF___FLOAT128=${H5_SIZEOF___FLOAT128};-D_HAVE_QUADMATH_H=${H5_HAVE_QUADMATH_H}"
248+
COMPILE_OUTPUT_VARIABLE COMPILEOUT
249+
RUN_OUTPUT_VARIABLE OUTPUT_VAR
250+
)
251+
252+
set (${RETURN_VAR} ${OUTPUT_VAR})
253+
254+
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
255+
message (VERBOSE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
256+
message (VERBOSE "Test COMPILE_RESULT_VAR ${COMPILE_RESULT_VAR} ")
257+
message (VERBOSE "Test COMPILE_OUTPUT ${COMPILEOUT} ")
258+
message (VERBOSE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
259+
message (VERBOSE "Test RUN_RESULT_VAR ${RUN_RESULT_VAR} ")
260+
message (VERBOSE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
261+
endif ()
262+
263+
if (${COMPILE_RESULT_VAR})
264+
if (${RUN_RESULT_VAR} MATCHES 0)
265+
set (${RUN_RESULT_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION_NAME}")
266+
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
267+
message (VERBOSE "Testing C ${FUNCTION_NAME} - OK")
268+
endif ()
269+
file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
270+
"Determining if the C ${FUNCTION_NAME} exists passed with the following output:\n"
271+
"${OUTPUT_VAR}\n\n"
272+
)
273+
else ()
274+
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
275+
message (VERBOSE "Testing C ${FUNCTION_NAME} - Fail")
276+
endif ()
277+
set (${RUN_RESULT_VAR} 0 CACHE INTERNAL "Have C function ${FUNCTION_NAME}")
278+
file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
279+
"Determining if the C ${FUNCTION_NAME} exists failed with the following output:\n"
280+
"${OUTPUT_VAR}\n\n")
281+
endif ()
282+
else ()
283+
message (FATAL_ERROR "Compilation of C ${FUNCTION_NAME} - Failed")
284+
endif ()
285+
endmacro ()
286+
287+
set (PROG_SRC
288+
"
289+
#include <float.h>\n\
290+
#include <stdio.h>\n\
291+
#define CHECK_FLOAT128 _SIZEOF___FLOAT128\n\
292+
#if CHECK_FLOAT128!=0\n\
293+
#if _HAVE_QUADMATH_H!=0\n\
294+
#include <quadmath.h>\n\
295+
#endif\n\
296+
#ifdef FLT128_DIG\n\
297+
#define C_FLT128_DIG FLT128_DIG\n\
298+
#else\n\
299+
#define C_FLT128_DIG 0\n\
300+
#endif\n\
301+
#else\n\
302+
#define C_FLT128_DIG 0\n\
303+
#endif\n\
304+
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L\n\
305+
#define C_LDBL_DIG DECIMAL_DIG\n\
306+
#else\n\
307+
#define C_LDBL_DIG LDBL_DIG\n\
308+
#endif\n\nint main() {\nFILE *pFile = fopen(\"pac_Cconftest.out\",\"w\")\\\;\nfprintf(pFile, \"\\%d\\\;\\%d\\\;\", C_LDBL_DIG, C_FLT128_DIG)\\\;\n\nreturn 0\\\;\n}\n
309+
"
310+
)
311+
312+
C_RUN ("maximum decimal precision for C" ${PROG_SRC} PROG_RES)
313+
file (READ "${CMAKE_BINARY_DIR}/pac_Cconftest.out" PROG_OUTPUT4)
314+
message (STATUS "Testing maximum decimal precision for C - ${PROG_OUTPUT4}")
315+
316+
# dnl The output from the above program will be:
317+
# dnl -- long double decimal precision -- __float128 decimal precision
318+
319+
list (GET PROG_OUTPUT4 0 H5_LDBL_DIG)
320+
list (GET PROG_OUTPUT4 1 H5_FLT128_DIG)
321+
322+
if (${HDF_PREFIX}_SIZEOF___FLOAT128 EQUAL 0 OR FLT128_DIG EQUAL 0)
323+
set (${HDF_PREFIX}_HAVE_FLOAT128 0)
324+
set (${HDF_PREFIX}_SIZEOF___FLOAT128 0)
325+
set (_PAC_C_MAX_REAL_PRECISION ${H5_LDBL_DIG})
326+
else ()
327+
set (_PAC_C_MAX_REAL_PRECISION ${H5_FLT128_DIG})
328+
endif ()
329+
if (NOT ${_PAC_C_MAX_REAL_PRECISION})
330+
set (${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION 0)
331+
else ()
332+
set (${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION ${_PAC_C_MAX_REAL_PRECISION})
227333
endif ()
334+
message (STATUS "maximum decimal precision for C var - ${${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION}")
228335

229336
#-----------------------------------------------------------------------------
230337
# Macro to determine the various conversion capabilities

config/cmake/H5pubconf.h.in

+8-8
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
/* Define the default plugins path to compile */
3030
#cmakedefine H5_DEFAULT_PLUGINDIR "@H5_DEFAULT_PLUGINDIR@"
3131

32-
/* Define if `dev_t' is a scalar */
32+
/* Define if dev_t is a scalar */
3333
#cmakedefine H5_DEV_T_IS_SCALAR @H5_DEV_T_IS_SCALAR@
3434

3535
/* Define to dummy `main' function (if any) required to link to the Fortran
@@ -85,6 +85,9 @@
8585
/* Define to 1 if you have the `alarm' function. */
8686
#cmakedefine H5_HAVE_ALARM @H5_HAVE_ALARM@
8787

88+
/* Define to 1 if you have the <arpa/inet.h> header file. */
89+
#cmakedefine H5_HAVE_ARPA_INET_H @H5_HAVE_ARPA_INET_H@
90+
8891
/* Define to 1 if you have the `asprintf' function. */
8992
#cmakedefine H5_HAVE_ASPRINTF @H5_HAVE_ASPRINTF@
9093

@@ -98,9 +101,6 @@
98101
/* Define if the compiler understands the __func__ keyword */
99102
#cmakedefine H5_HAVE_C99_FUNC @H5_HAVE_C99_FUNC@
100103

101-
/* Define to 1 if you have the <arpa/inet.h> header file. */
102-
#cmakedefine H5_HAVE_ARPA_INET_H @H5_HAVE_ARPA_INET_H@
103-
104104
/* Define to 1 if you have the `clock_gettime' function. */
105105
#cmakedefine H5_HAVE_CLOCK_GETTIME @H5_HAVE_CLOCK_GETTIME@
106106

@@ -249,7 +249,7 @@
249249
/* Define to 1 if you have the <memory.h> header file. */
250250
#cmakedefine H5_HAVE_MEMORY_H @H5_HAVE_MEMORY_H@
251251

252-
/* Define if we can build the Mirror VFD */
252+
/* Define whether the Mirror virtual file driver (VFD) will be compiled */
253253
#cmakedefine H5_HAVE_MIRROR_VFD @H5_HAVE_MIRROR_VFD@
254254

255255
/* Define if we have MPE support */
@@ -258,10 +258,10 @@
258258
/* Define to 1 if you have the <mpe.h> header file. */
259259
#cmakedefine H5_HAVE_MPE_H @H5_HAVE_MPE_H@
260260

261-
/* Define if MPI_Comm_c2f and MPI_Comm_f2c exists */
261+
/* Define if MPI_Comm_c2f and MPI_Comm_f2c exist */
262262
#cmakedefine H5_HAVE_MPI_MULTI_LANG_Comm @H5_HAVE_MPI_MULTI_LANG_Comm@
263263

264-
/* Define if MPI_Info_c2f and MPI_Info_f2c exists */
264+
/* Define if MPI_Info_c2f and MPI_Info_f2c exist */
265265
#cmakedefine H5_HAVE_MPI_MULTI_LANG_Info @H5_HAVE_MPI_MULTI_LANG_Info@
266266

267267
/* Define to 1 if you have the <netdb.h> header file. */
@@ -450,7 +450,7 @@
450450
/* Define if the compiler understands __inline__ */
451451
#cmakedefine H5_HAVE___INLINE__ @H5_HAVE___INLINE__@
452452

453-
/* Define if the library will ignore file locks when disabled */
453+
/* Define if the library will ignore file locks when disabled */
454454
#cmakedefine H5_IGNORE_DISABLED_FILE_LOCKS @H5_IGNORE_DISABLED_FILE_LOCKS@
455455

456456
/* Define if the high-level library headers should be included in hdf5.h */

config/cmake/HDF5UseFortran.cmake

+14-133
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ if (NOT CMAKE_VERSION VERSION_LESS "3.14.0")
313313
else ()
314314
FORTRAN_RUN ("SIZEOF NATIVE KINDs" ${PROG_SRC3} XX YY PAC_SIZEOF_NATIVE_KINDS_RESULT)
315315
endif ()
316-
file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_sizeof_native_kinds.out" PROG_OUTPUT)
316+
file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_sizeof_native_kinds.out" PROG_OUTPUT3)
317317
# dnl The output from the above program will be:
318318
# dnl -- LINE 1 -- sizeof INTEGER
319319
# dnl -- LINE 2 -- kind of INTEGER
@@ -323,14 +323,14 @@ file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_sizeof_native_kinds.out" PROG_OUTPUT)
323323
# dnl -- LINE 6 -- kind of DOUBLE PRECISION
324324

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

328-
list (GET PROG_OUTPUT 0 PAC_FORTRAN_NATIVE_INTEGER_SIZEOF)
329-
list (GET PROG_OUTPUT 1 PAC_FORTRAN_NATIVE_INTEGER_KIND)
330-
list (GET PROG_OUTPUT 2 PAC_FORTRAN_NATIVE_REAL_SIZEOF)
331-
list (GET PROG_OUTPUT 3 PAC_FORTRAN_NATIVE_REAL_KIND)
332-
list (GET PROG_OUTPUT 4 PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF)
333-
list (GET PROG_OUTPUT 5 PAC_FORTRAN_NATIVE_DOUBLE_KIND)
328+
list (GET PROG_OUTPUT3 0 PAC_FORTRAN_NATIVE_INTEGER_SIZEOF)
329+
list (GET PROG_OUTPUT3 1 PAC_FORTRAN_NATIVE_INTEGER_KIND)
330+
list (GET PROG_OUTPUT3 2 PAC_FORTRAN_NATIVE_REAL_SIZEOF)
331+
list (GET PROG_OUTPUT3 3 PAC_FORTRAN_NATIVE_REAL_KIND)
332+
list (GET PROG_OUTPUT3 4 PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF)
333+
list (GET PROG_OUTPUT3 5 PAC_FORTRAN_NATIVE_DOUBLE_KIND)
334334

335335
if (NOT PAC_FORTRAN_NATIVE_INTEGER_SIZEOF)
336336
message (FATAL_ERROR "Failed to find SIZEOF NATIVE INTEGER KINDs for Fortran")
@@ -372,132 +372,13 @@ endif ()
372372

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

375-
string (REGEX REPLACE "{" "" OUT_VAR ${PAC_FC_ALL_REAL_KINDS})
376-
string (REGEX REPLACE "}" "" OUT_VAR ${OUT_VAR})
377-
set (${HDF_PREFIX}_H5CONFIG_F_RKIND "INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/${OUT_VAR}/)")
378-
379-
string (REGEX REPLACE "{" "" OUT_VAR ${PAC_FC_ALL_REAL_KINDS_SIZEOF})
380-
string (REGEX REPLACE "}" "" OUT_VAR ${OUT_VAR})
381-
set (${HDF_PREFIX}_H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${OUT_VAR}/)")
382-
383-
ENABLE_LANGUAGE (C)
384-
385-
if (NOT CMAKE_VERSION VERSION_LESS "3.14.0")
386-
include (CheckCSourceRuns)
387-
else ()
388-
#-----------------------------------------------------------------------------
389-
# The provided CMake C macros don't provide a general compile/run function
390-
# so this one is used.
391-
#-----------------------------------------------------------------------------
392-
macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR)
393-
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
394-
message (VERBOSE "Detecting C ${FUNCTION_NAME}")
395-
endif ()
396-
if (HDF5_REQUIRED_LIBRARIES)
397-
set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
398-
"-DLINK_LIBRARIES:STRING=${HDF5_REQUIRED_LIBRARIES}")
399-
else ()
400-
set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES)
401-
endif ()
402-
file (WRITE
403-
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c
404-
${SOURCE_CODE}
405-
)
406-
TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR
407-
${CMAKE_BINARY_DIR}
408-
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c
409-
CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}"
410-
RUN_OUTPUT_VARIABLE OUTPUT_VAR
411-
)
412-
413-
set (${RETURN_VAR} ${OUTPUT_VAR})
414-
415-
#if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
416-
# message (TRACE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
417-
# message (TRACE "Test COMPILE_RESULT_VAR ${COMPILE_RESULT_VAR} ")
418-
# message (TRACE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
419-
# message (TRACE "Test RUN_RESULT_VAR ${RUN_RESULT_VAR} ")
420-
# message (TRACE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
421-
#endif ()
422-
423-
if (${COMPILE_RESULT_VAR})
424-
if (${RUN_RESULT_VAR} MATCHES 1)
425-
set (${RUN_RESULT_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION_NAME}")
426-
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
427-
message (VERBOSE "Testing C ${FUNCTION_NAME} - OK")
428-
endif ()
429-
file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
430-
"Determining if the C ${FUNCTION_NAME} exists passed with the following output:\n"
431-
"${OUTPUT_VAR}\n\n"
432-
)
433-
else ()
434-
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
435-
message (VERBOSE "Testing C ${FUNCTION_NAME} - Fail")
436-
endif ()
437-
set (${RUN_RESULT_VAR} 0 CACHE INTERNAL "Have C function ${FUNCTION_NAME}")
438-
file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
439-
"Determining if the C ${FUNCTION_NAME} exists failed with the following output:\n"
440-
"${OUTPUT_VAR}\n\n")
441-
endif ()
442-
else ()
443-
message (FATAL_ERROR "Compilation of C ${FUNCTION_NAME} - Failed")
444-
endif ()
445-
endmacro ()
446-
endif ()
447-
448-
set (PROG_SRC
449-
"
450-
#include <float.h>
451-
#include <stdio.h>
452-
#define CHECK_FLOAT128 ${${HDF_PREFIX}_SIZEOF___FLOAT128}
453-
#if CHECK_FLOAT128!=0
454-
# if ${${HDF_PREFIX}_HAVE_QUADMATH_H}!=0
455-
#include <quadmath.h>
456-
# endif
457-
# ifdef FLT128_DIG
458-
#define C_FLT128_DIG FLT128_DIG
459-
# else
460-
#define C_FLT128_DIG 0
461-
# endif
462-
#else
463-
#define C_FLT128_DIG 0
464-
#endif
465-
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
466-
#define C_LDBL_DIG DECIMAL_DIG
467-
#else
468-
#define C_LDBL_DIG LDBL_DIG
469-
#endif
470-
int main() {
471-
printf(\"%d\\\\n%d\\\\n\", C_LDBL_DIG, C_FLT128_DIG)\\\;
472-
return 1\\\;
473-
}
474-
"
475-
)
476-
477-
if (NOT CMAKE_VERSION VERSION_LESS "3.14.0")
478-
check_c_source_runs (${PROG_SRC} PROG_OUTPUT)
479-
else ()
480-
C_RUN ("maximum decimal precision for C" ${PROG_SRC} PROG_OUTPUT)
481-
endif ()
482-
483-
# dnl The output from the above program will be:
484-
# dnl -- LINE 1 -- long double decimal precision
485-
# dnl -- LINE 2 -- __float128 decimal precision
486-
487-
# Convert the string to a list of strings by replacing the carriage return with a semicolon
488-
string (REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}")
489-
490-
list (GET PROG_OUTPUT 0 LDBL_DIG)
491-
list (GET PROG_OUTPUT 1 FLT128_DIG)
492-
493-
if (${HDF_PREFIX}_SIZEOF___FLOAT128 EQUAL 0 OR FLT128_DIG EQUAL 0)
494-
set (${HDF_PREFIX}_HAVE_FLOAT128 0)
495-
set (${HDF_PREFIX}_SIZEOF___FLOAT128 0)
496-
set (${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION ${LDBL_DIG})
497-
else ()
498-
set(${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION ${FLT128_DIG})
499-
endif ()
375+
string (REGEX REPLACE "{" "" OUT_VAR1 ${PAC_FC_ALL_REAL_KINDS})
376+
string (REGEX REPLACE "}" "" OUT_VAR1 ${OUT_VAR1})
377+
set (${HDF_PREFIX}_H5CONFIG_F_RKIND "INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/${OUT_VAR1}/)")
500378

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

502383
# Setting definition if there is a 16 byte fortran integer
503384
string (FIND ${PAC_FC_ALL_INTEGER_KINDS_SIZEOF} "16" pos)

0 commit comments

Comments
 (0)