summaryrefslogtreecommitdiffstats
path: root/config/cmake/ConfigureChecks.cmake
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2021-06-07 22:59:47 (GMT)
committerGitHub <noreply@github.com>2021-06-07 22:59:47 (GMT)
commit47c7bd983473cabb854483954ead6ee400009df1 (patch)
treefa266a446afdcc620e992f1cd12b8f1dfb227f6e /config/cmake/ConfigureChecks.cmake
parent62ddef9758585ec5556b7ff2465ecae75013322d (diff)
downloadhdf5-47c7bd983473cabb854483954ead6ee400009df1.zip
hdf5-47c7bd983473cabb854483954ead6ee400009df1.tar.gz
hdf5-47c7bd983473cabb854483954ead6ee400009df1.tar.bz2
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>
Diffstat (limited to 'config/cmake/ConfigureChecks.cmake')
-rw-r--r--config/cmake/ConfigureChecks.cmake115
1 files changed, 111 insertions, 4 deletions
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake
index 19e7dce..0717628 100644
--- a/config/cmake/ConfigureChecks.cmake
+++ b/config/cmake/ConfigureChecks.cmake
@@ -213,18 +213,125 @@ endif()
# Check if C has __float128 extension
#-----------------------------------------------------------------------------
-CHECK_TYPE_SIZE("__float128" ${HDF_PREFIX}_SIZEOF___FLOAT128)
-if (${${HDF_PREFIX}_SIZEOF___FLOAT128})
+HDF_CHECK_TYPE_SIZE(__float128 _SIZEOF___FLOAT128)
+if (${_SIZEOF___FLOAT128})
set (${HDF_PREFIX}_HAVE_FLOAT128 1)
+ set (${HDF_PREFIX}_SIZEOF___FLOAT128 ${_SIZEOF___FLOAT128})
else ()
set (${HDF_PREFIX}_HAVE_FLOAT128 0)
set (${HDF_PREFIX}_SIZEOF___FLOAT128 0)
endif ()
-CHECK_TYPE_SIZE("_Quad" ${HDF_PREFIX}_SIZEOF__QUAD)
-if (NOT ${${HDF_PREFIX}_SIZEOF__QUAD})
+HDF_CHECK_TYPE_SIZE(_Quad _SIZEOF__QUAD)
+if (NOT ${_SIZEOF__QUAD})
set (${HDF_PREFIX}_SIZEOF__QUAD 0)
+else ()
+ set (${HDF_PREFIX}_SIZEOF__QUAD ${_SIZEOF__QUAD})
+endif ()
+
+#-----------------------------------------------------------------------------
+# 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 ()
+ 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
+ COMPILE_DEFINITIONS "-D_SIZEOF___FLOAT128=${H5_SIZEOF___FLOAT128};-D_HAVE_QUADMATH_H=${H5_HAVE_QUADMATH_H}"
+ COMPILE_OUTPUT_VARIABLE COMPILEOUT
+ RUN_OUTPUT_VARIABLE OUTPUT_VAR
+ )
+
+ set (${RETURN_VAR} ${OUTPUT_VAR})
+
+ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
+ message (VERBOSE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
+ message (VERBOSE "Test COMPILE_RESULT_VAR ${COMPILE_RESULT_VAR} ")
+ message (VERBOSE "Test COMPILE_OUTPUT ${COMPILEOUT} ")
+ message (VERBOSE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
+ message (VERBOSE "Test RUN_RESULT_VAR ${RUN_RESULT_VAR} ")
+ message (VERBOSE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
+ endif ()
+
+ if (${COMPILE_RESULT_VAR})
+ if (${RUN_RESULT_VAR} MATCHES 0)
+ 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 ()
+
+set (PROG_SRC
+ "
+#include <float.h>\n\
+#include <stdio.h>\n\
+#define CHECK_FLOAT128 _SIZEOF___FLOAT128\n\
+#if CHECK_FLOAT128!=0\n\
+#if _HAVE_QUADMATH_H!=0\n\
+#include <quadmath.h>\n\
+#endif\n\
+#ifdef FLT128_DIG\n\
+#define C_FLT128_DIG FLT128_DIG\n\
+#else\n\
+#define C_FLT128_DIG 0\n\
+#endif\n\
+#else\n\
+#define C_FLT128_DIG 0\n\
+#endif\n\
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L\n\
+#define C_LDBL_DIG DECIMAL_DIG\n\
+#else\n\
+#define C_LDBL_DIG LDBL_DIG\n\
+#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
+ "
+)
+
+C_RUN ("maximum decimal precision for C" ${PROG_SRC} PROG_RES)
+file (READ "${CMAKE_BINARY_DIR}/pac_Cconftest.out" PROG_OUTPUT4)
+message (STATUS "Testing maximum decimal precision for C - ${PROG_OUTPUT4}")
+
+# dnl The output from the above program will be:
+# dnl -- long double decimal precision -- __float128 decimal precision
+
+list (GET PROG_OUTPUT4 0 H5_LDBL_DIG)
+list (GET PROG_OUTPUT4 1 H5_FLT128_DIG)
+
+if (${HDF_PREFIX}_SIZEOF___FLOAT128 EQUAL 0 OR FLT128_DIG EQUAL 0)
+ set (${HDF_PREFIX}_HAVE_FLOAT128 0)
+ set (${HDF_PREFIX}_SIZEOF___FLOAT128 0)
+ set (_PAC_C_MAX_REAL_PRECISION ${H5_LDBL_DIG})
+else ()
+ set (_PAC_C_MAX_REAL_PRECISION ${H5_FLT128_DIG})
+endif ()
+if (NOT ${_PAC_C_MAX_REAL_PRECISION})
+ set (${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION 0)
+else ()
+ set (${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION ${_PAC_C_MAX_REAL_PRECISION})
endif ()
+message (STATUS "maximum decimal precision for C var - ${${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION}")
#-----------------------------------------------------------------------------
# Macro to determine the various conversion capabilities