summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2023-03-02 17:18:13 (GMT)
committerGitHub <noreply@github.com>2023-03-02 17:18:13 (GMT)
commit7b833f04b5146bdad339ff10d42aadc416fb2f00 (patch)
tree7992f9f6504caf167e460abf3c987ca0f6be64c3 /config
parentb16ec83d4bd79f9ffaad85de16056419f3532887 (diff)
downloadhdf5-7b833f04b5146bdad339ff10d42aadc416fb2f00.zip
hdf5-7b833f04b5146bdad339ff10d42aadc416fb2f00.tar.gz
hdf5-7b833f04b5146bdad339ff10d42aadc416fb2f00.tar.bz2
Update cross compile checks and files (#2497)
Diffstat (limited to 'config')
-rw-r--r--config/cmake/ConfigureChecks.cmake110
-rw-r--r--config/toolchain/aarch64.cmake1
2 files changed, 57 insertions, 54 deletions
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake
index 70a2104..b535396 100644
--- a/config/cmake/ConfigureChecks.cmake
+++ b/config/cmake/ConfigureChecks.cmake
@@ -768,56 +768,57 @@ if (HDF5_BUILD_FORTRAN)
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.
-#-----------------------------------------------------------------------------
- set (RUN_OUTPUT_PATH_DEFAULT ${CMAKE_BINARY_DIR})
- macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR RETURN_OUTPUT_VAR)
- message (VERBOSE "Detecting C ${FUNCTION_NAME}")
- 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
- )
+ if (NOT CMAKE_CROSSCOMPILING)
+ #-----------------------------------------------------------------------------
+ # The provided CMake C macros don't provide a general compile/run function
+ # so this one is used.
+ #-----------------------------------------------------------------------------
+ set (RUN_OUTPUT_PATH_DEFAULT ${CMAKE_BINARY_DIR})
+ macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR RETURN_OUTPUT_VAR)
+ message (VERBOSE "Detecting C ${FUNCTION_NAME}")
+ 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_OUTPUT_VAR} ${OUTPUT_VAR})
-
- 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 "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
-
- if (COMPILE_RESULT_VAR)
- if (RUN_RESULT_VAR EQUAL "0")
- set (${RETURN_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION_NAME}")
- message (VERBOSE "Testing C ${FUNCTION_NAME} - OK")
- 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"
- )
+ set (${RETURN_OUTPUT_VAR} ${OUTPUT_VAR})
+
+ 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 "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
+
+ if (COMPILE_RESULT_VAR)
+ if (RUN_RESULT_VAR EQUAL "0")
+ set (${RETURN_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION_NAME}")
+ message (VERBOSE "Testing C ${FUNCTION_NAME} - OK")
+ 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 ()
+ message (VERBOSE "Testing C ${FUNCTION_NAME} - Fail")
+ set (${RETURN_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 (VERBOSE "Testing C ${FUNCTION_NAME} - Fail")
- set (${RETURN_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")
+ message (FATAL_ERROR "Compilation of C ${FUNCTION_NAME} - Failed")
endif ()
- else ()
- message (FATAL_ERROR "Compilation of C ${FUNCTION_NAME} - Failed")
- endif ()
- endmacro ()
+ endmacro ()
- set (PROG_SRC
- "
+ set (PROG_SRC
+ "
#include <float.h>\n\
#include <stdio.h>\n\
#define CHECK_FLOAT128 _SIZEOF___FLOAT128\n\
@@ -838,17 +839,18 @@ if (HDF5_BUILD_FORTRAN)
#else\n\
#define C_LDBL_DIG LDBL_DIG\n\
#endif\n\nint main() {\nprintf(\"\\%d\\\;\\%d\\\;\", C_LDBL_DIG, C_FLT128_DIG)\\\;\n\nreturn 0\\\;\n}\n
- "
- )
+ "
+ )
- C_RUN ("maximum decimal precision for C" ${PROG_SRC} PROG_RES PROG_OUTPUT4)
- message (STATUS "Testing maximum decimal precision for C - ${PROG_OUTPUT4}")
+ C_RUN ("maximum decimal precision for C" ${PROG_SRC} PROG_RES 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
+ # 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)
+ list (GET PROG_OUTPUT4 0 H5_LDBL_DIG)
+ list (GET PROG_OUTPUT4 1 H5_FLT128_DIG)
+ endif ()
if (${HDF_PREFIX}_SIZEOF___FLOAT128 EQUAL "0" OR FLT128_DIG EQUAL "0")
set (${HDF_PREFIX}_HAVE_FLOAT128 0)
diff --git a/config/toolchain/aarch64.cmake b/config/toolchain/aarch64.cmake
index aa84a74..b050482 100644
--- a/config/toolchain/aarch64.cmake
+++ b/config/toolchain/aarch64.cmake
@@ -11,6 +11,7 @@ set (CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set (CMAKE_CROSSCOMPILING_EMULATOR qemu-aarch64)
include_directories(/usr/${TOOLCHAIN_PREFIX}/include)