summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2018-02-01 17:05:59 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2018-02-01 17:05:59 (GMT)
commit74cef485ae8026403a660308495fc364523c5f93 (patch)
treef49d62ed12e220d7e9e1e95c57e62fc5c2ba43c0
parentf939e28561c292bf3ab9b3aef472d6617ab9110c (diff)
downloadhdf5-74cef485ae8026403a660308495fc364523c5f93.zip
hdf5-74cef485ae8026403a660308495fc364523c5f93.tar.gz
hdf5-74cef485ae8026403a660308495fc364523c5f93.tar.bz2
HDFFV-10398 Merge from develop
-rw-r--r--CMakeLists.txt32
-rw-r--r--MANIFEST1
-rw-r--r--c++/CMakeLists.txt6
-rw-r--r--config/cmake/ConfigureChecks.cmake17
-rw-r--r--config/cmake/ConversionTests.c167
-rw-r--r--config/cmake/HDFCompilerFlags.cmake4
-rw-r--r--config/cmake_ext_mod/CheckTypeSize.cmake61
-rw-r--r--config/cmake_ext_mod/ConfigureChecks.cmake28
-rw-r--r--config/cmake_ext_mod/HDFTests.c14
-rw-r--r--fortran/CMakeLists.txt8
-rw-r--r--fortran/src/CMakeLists.txt12
-rw-r--r--hl/CMakeLists.txt8
-rw-r--r--hl/c++/CMakeLists.txt6
-rw-r--r--hl/fortran/CMakeLists.txt6
-rw-r--r--hl/tools/CMakeLists.txt2
-rw-r--r--release_docs/RELEASE.txt10
-rw-r--r--src/CMakeLists.txt12
-rw-r--r--tools/CMakeLists.txt22
18 files changed, 189 insertions, 227 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 11bd2e8..e44b90f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -446,9 +446,13 @@ endif ()
#-----------------------------------------------------------------------------
# Option to embed library info into executables
#-----------------------------------------------------------------------------
-option (HDF5_ENABLE_EMBEDDED_LIBINFO "embed library info into executables" ON)
-if (HDF5_ENABLE_EMBEDDED_LIBINFO)
- set (H5_HAVE_EMBEDDED_LIBINFO 1)
+if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
+ set (H5_HAVE_EMBEDDED_LIBINFO 0)
+else ()
+ option (HDF5_ENABLE_EMBEDDED_LIBINFO "embed library info into executables" ON)
+ if (HDF5_ENABLE_EMBEDDED_LIBINFO)
+ set (H5_HAVE_EMBEDDED_LIBINFO 1)
+ endif ()
endif ()
include (${HDF_RESOURCES_DIR}/HDFCompilerFlags.cmake)
@@ -578,7 +582,7 @@ endif ()
#-----------------------------------------------------------------------------
# Add the HDF5 Library Target to the build
#-----------------------------------------------------------------------------
-add_subdirectory (${HDF5_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/src)
+add_subdirectory (src)
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
if (ZLIB_FOUND AND ZLIB_USE_EXTERNAL)
@@ -626,12 +630,12 @@ if (BUILD_TESTING)
if (NOT HDF5_EXTERNALLY_CONFIGURED)
if (EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test")
- add_subdirectory (${HDF5_SOURCE_DIR}/tools/lib ${PROJECT_BINARY_DIR}/tools/lib)
- add_subdirectory (${HDF5_SOURCE_DIR}/test ${PROJECT_BINARY_DIR}/test)
+ add_subdirectory (tools/lib)
+ add_subdirectory (test)
endif ()
if (H5_HAVE_PARALLEL)
if (EXISTS "${HDF5_SOURCE_DIR}/testpar" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/testpar")
- add_subdirectory (${HDF5_SOURCE_DIR}/testpar ${PROJECT_BINARY_DIR}/testpar)
+ add_subdirectory (testpar)
endif ()
endif ()
endif ()
@@ -643,7 +647,7 @@ endif ()
if (EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools")
option (HDF5_BUILD_TOOLS "Build HDF5 Tools" ON)
if (HDF5_BUILD_TOOLS)
- add_subdirectory (${HDF5_SOURCE_DIR}/tools ${PROJECT_BINARY_DIR}/tools)
+ add_subdirectory (tools)
endif ()
endif ()
@@ -653,7 +657,7 @@ endif ()
if (EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples")
option (HDF5_BUILD_EXAMPLES "Build HDF5 Library Examples" ON)
if (HDF5_BUILD_EXAMPLES)
- add_subdirectory (${HDF5_SOURCE_DIR}/examples ${PROJECT_BINARY_DIR}/examples)
+ add_subdirectory (examples)
endif ()
endif ()
@@ -664,7 +668,7 @@ if (EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl")
option (HDF5_BUILD_HL_LIB "Build HIGH Level HDF5 Library" ON)
if (HDF5_BUILD_HL_LIB)
set (H5_INCLUDE_HL 1)
- add_subdirectory (${HDF5_SOURCE_DIR}/hl ${PROJECT_BINARY_DIR}/hl)
+ add_subdirectory (hl)
endif ()
endif ()
@@ -708,11 +712,11 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for
endif ()
endif ()
- add_subdirectory (${HDF5_SOURCE_DIR}/fortran ${PROJECT_BINARY_DIR}/fortran)
+ add_subdirectory (fortran)
if (HDF5_BUILD_HL_LIB)
if (EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran")
#-- Build the High Level Fortran source codes
- add_subdirectory (${HDF5_SOURCE_DIR}/hl/fortran ${PROJECT_BINARY_DIR}/hl/fortran)
+ add_subdirectory (hl/fortran)
endif ()
endif ()
endif ()
@@ -735,11 +739,11 @@ if (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++")
if (CMAKE_NO_STD_NAMESPACE)
set (H5_NO_STD 1)
endif ()
- add_subdirectory (${HDF5_SOURCE_DIR}/c++ ${PROJECT_BINARY_DIR}/c++)
+ add_subdirectory (c++)
if (HDF5_BUILD_HL_LIB)
if (EXISTS "${HDF5_SOURCE_DIR}/hl/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/c++")
#-- Build the High Level Fortran source codes
- add_subdirectory (${HDF5_SOURCE_DIR}/hl/c++ ${PROJECT_BINARY_DIR}/hl/c++)
+ add_subdirectory (hl/c++)
endif ()
endif ()
endif ()
diff --git a/MANIFEST b/MANIFEST
index ff188d1..d1a0f7f 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -2339,7 +2339,6 @@
./config/cmake/userblockTest.cmake
./config/cmake/vfdTest.cmake
-./config/cmake_ext_mod/CheckTypeSize.cmake
./config/cmake_ext_mod/ConfigureChecks.cmake
./config/cmake_ext_mod/CTestCustom.cmake
./config/cmake_ext_mod/FindMPI.cmake
diff --git a/c++/CMakeLists.txt b/c++/CMakeLists.txt
index c9c4815..adbf1a4 100644
--- a/c++/CMakeLists.txt
+++ b/c++/CMakeLists.txt
@@ -27,18 +27,18 @@ if (H5_HAVE_PARALLEL)
add_definitions ("-DMPICH_IGNORE_CXX_SEEK")
endif ()
-add_subdirectory (${HDF5_CPP_SOURCE_DIR}/src ${HDF5_CPP_BINARY_DIR}/src)
+add_subdirectory (src)
#-----------------------------------------------------------------------------
# Build the CPP Examples
#-----------------------------------------------------------------------------
if (HDF5_BUILD_EXAMPLES)
- add_subdirectory (${HDF5_CPP_SOURCE_DIR}/examples ${HDF5_CPP_BINARY_DIR}/examples)
+ add_subdirectory (examples)
endif ()
#-----------------------------------------------------------------------------
# Build the CPP unit tests
#-----------------------------------------------------------------------------
if (BUILD_TESTING)
- add_subdirectory (${HDF5_CPP_SOURCE_DIR}/test ${HDF5_CPP_BINARY_DIR}/test)
+ add_subdirectory (test)
endif ()
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake
index 77918a4..85e0492 100644
--- a/config/cmake/ConfigureChecks.cmake
+++ b/config/cmake/ConfigureChecks.cmake
@@ -173,7 +173,7 @@ endif ()
# Macro to determine the various conversion capabilities
#-----------------------------------------------------------------------------
macro (H5ConversionTests TEST msg)
- if ("${TEST}" MATCHES "^${TEST}$")
+ if (NOT DEFINED ${TEST})
# message (STATUS "===> ${TEST}")
TRY_RUN (${TEST}_RUN ${TEST}_COMPILE
${CMAKE_BINARY_DIR}
@@ -204,21 +204,6 @@ macro (H5ConversionTests TEST msg)
endmacro ()
#-----------------------------------------------------------------------------
-# Macro to make some of the conversion tests easier to write/read
-#-----------------------------------------------------------------------------
-macro (H5MiscConversionTest VAR TEST msg)
- if ("${TEST}" MATCHES "^${TEST}$")
- if (${VAR})
- set (${TEST} 1 CACHE INTERNAL ${msg})
- message (STATUS "${msg}... yes")
- else ()
- set (${TEST} "" CACHE INTERNAL ${msg})
- message (STATUS "${msg}... no")
- endif ()
- endif ()
-endmacro ()
-
-#-----------------------------------------------------------------------------
# Check various conversion capabilities
#-----------------------------------------------------------------------------
diff --git a/config/cmake/ConversionTests.c b/config/cmake/ConversionTests.c
index 082dbd4..002bc88 100644
--- a/config/cmake/ConversionTests.c
+++ b/config/cmake/ConversionTests.c
@@ -9,12 +9,23 @@
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
++
+#if defined(__has_attribute)
+#if __has_attribute(no_sanitize)
+#define HDF_NO_UBSAN __attribute__((no_sanitize("undefined")))
+#else
+#define HDF_NO_UBSAN
+#endif
+#else
+#define HDF_NO_UBSAN
+#endif
+
#ifdef H5_LDOUBLE_TO_LONG_SPECIAL_TEST
#include <string.h>
#include <stdlib.h>
-int main(void)
+int main(void) HDF_NO_UBSAN
{
long double ld = 20041683600089727.779961L;
long ll;
@@ -24,44 +35,44 @@ int main(void)
int ret = 1;
if(sizeof(long double) == 16 && sizeof(long) == 8) {
- /*make sure the long double type has 16 bytes in size and
- * 11 bits of exponent. If it is,
- *the bit sequence should be like below. It's not
- *a decent way to check but this info isn't available. */
- memcpy(s, &ld, 16);
- if(s[0]==0x43 && s[1]==0x51 && s[2]==0xcc && s[3]==0xf3 &&
- s[4]==0x85 && s[5]==0xeb && s[6]==0xc8 && s[7]==0xa0 &&
- s[8]==0xbf && s[9]==0xcc && s[10]==0x2a && s[11]==0x3c) {
-
- /* Assign the hexadecimal value of long double type. */
- s[0]=0x43; s[1]=0x51; s[2]=0xcc; s[3]=0xf3;
- s[4]=0x85; s[5]=0xeb; s[6]=0xc8; s[7]=0xa0;
- s[8]=0xbf; s[9]=0xcc; s[10]=0x2a; s[11]=0x3c;
- s[12]=0x3d; s[13]=0x85; s[14]=0x56; s[15]=0x20;
-
- memcpy(&ld, s, 16);
-
- ll = (long)ld;
- memcpy(s2, &ll, 8);
-
- /* The library's algorithm converts it to 0x 00 47 33 ce 17 af 22 82
- * and gets wrong value 20041683600089730 on the IBM Power6 Linux.
- * But the IBM Power6 Linux converts it to 0x00 47 33 ce 17 af 22 7f
- * and gets the correct value 20041683600089727. It uses some special
- * algorithm. We're going to define the macro and skip the test until
- * we can figure out how they do it. */
- if(s2[0]==0x00 && s2[1]==0x47 && s2[2]==0x33 && s2[3]==0xce &&
- s2[4]==0x17 && s2[5]==0xaf && s2[6]==0x22 && s2[7]==0x7f)
- ret = 0;
-
- ull = (unsigned long)ld;
- memcpy(s2, &ull, 8);
-
- /* The unsigned long is the same as signed long. */
- if(s2[0]==0x00 && s2[1]==0x47 && s2[2]==0x33 && s2[3]==0xce &&
- s2[4]==0x17 && s2[5]==0xaf && s2[6]==0x22 && s2[7]==0x7f)
- ret = 0;
- }
+ /*make sure the long double type has 16 bytes in size and
+ * 11 bits of exponent. If it is,
+ *the bit sequence should be like below. It's not
+ *a decent way to check but this info isn't available. */
+ memcpy(s, &ld, 16);
+ if(s[0]==0x43 && s[1]==0x51 && s[2]==0xcc && s[3]==0xf3 &&
+ s[4]==0x85 && s[5]==0xeb && s[6]==0xc8 && s[7]==0xa0 &&
+ s[8]==0xbf && s[9]==0xcc && s[10]==0x2a && s[11]==0x3c) {
+
+ /* Assign the hexadecimal value of long double type. */
+ s[0]=0x43; s[1]=0x51; s[2]=0xcc; s[3]=0xf3;
+ s[4]=0x85; s[5]=0xeb; s[6]=0xc8; s[7]=0xa0;
+ s[8]=0xbf; s[9]=0xcc; s[10]=0x2a; s[11]=0x3c;
+ s[12]=0x3d; s[13]=0x85; s[14]=0x56; s[15]=0x20;
+
+ memcpy(&ld, s, 16);
+
+ ll = (long)ld;
+ memcpy(s2, &ll, 8);
+
+ /* The library's algorithm converts it to 0x 00 47 33 ce 17 af 22 82
+ * and gets wrong value 20041683600089730 on the IBM Power6 Linux.
+ * But the IBM Power6 Linux converts it to 0x00 47 33 ce 17 af 22 7f
+ * and gets the correct value 20041683600089727. It uses some special
+ * algorithm. We're going to define the macro and skip the test until
+ * we can figure out how they do it. */
+ if(s2[0]==0x00 && s2[1]==0x47 && s2[2]==0x33 && s2[3]==0xce &&
+ s2[4]==0x17 && s2[5]==0xaf && s2[6]==0x22 && s2[7]==0x7f)
+ ret = 0;
+
+ ull = (unsigned long)ld;
+ memcpy(s2, &ull, 8);
+
+ /* The unsigned long is the same as signed long. */
+ if(s2[0]==0x00 && s2[1]==0x47 && s2[2]==0x33 && s2[3]==0xce &&
+ s2[4]==0x17 && s2[5]==0xaf && s2[6]==0x22 && s2[7]==0x7f)
+ ret = 0;
+ }
}
done:
@@ -75,7 +86,7 @@ done:
#include <string.h>
#include <stdlib.h>
-int main(void)
+int main(void) HDF_NO_UBSAN
{
long double ld;
long ll;
@@ -86,46 +97,46 @@ int main(void)
/*Determine if long double has 16 byte in size, 11 bit exponent, and
*the bias is 0x3ff */
if(sizeof(long double) == 16) {
- ld = 1.0L;
- memcpy(s, &ld, 16);
- if(s[0]==0x3f && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 &&
- s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00)
- flag = 1;
+ ld = 1.0L;
+ memcpy(s, &ld, 16);
+ if(s[0]==0x3f && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 &&
+ s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00)
+ flag = 1;
}
if(flag==1 && sizeof(long)==8) {
- ll = 0x003fffffffffffffL;
- ld = (long double)ll;
- memcpy(s, &ld, 16);
- /* The library converts the value to 0x434fffffffffffff8000000000000000.
- * In decimal it is 18014398509481982.000000, one value short of the original.
- * The IBM Power6 Linux converts it to 0x4350000000000000bff0000000000000.
- * The value is correct in decimal. It uses some special
- * algorithm. We're going to define the macro and skip the test until
- * we can figure out how they do it. */
- if(s[0]==0x43 && s[1]==0x50 && s[2]==0x00 && s[3]==0x00 &&
- s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00 &&
- s[8]==0xbf && s[9]==0xf0 && s[10]==0x00 && s[11]==0x00 &&
- s[12]==0x00 && s[13]==0x00 && s[14]==0x00 && s[15]==0x00)
- ret = 0;
+ ll = 0x003fffffffffffffL;
+ ld = (long double)ll;
+ memcpy(s, &ld, 16);
+ /* The library converts the value to 0x434fffffffffffff8000000000000000.
+ * In decimal it is 18014398509481982.000000, one value short of the original.
+ * The IBM Power6 Linux converts it to 0x4350000000000000bff0000000000000.
+ * The value is correct in decimal. It uses some special
+ * algorithm. We're going to define the macro and skip the test until
+ * we can figure out how they do it. */
+ if(s[0]==0x43 && s[1]==0x50 && s[2]==0x00 && s[3]==0x00 &&
+ s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00 &&
+ s[8]==0xbf && s[9]==0xf0 && s[10]==0x00 && s[11]==0x00 &&
+ s[12]==0x00 && s[13]==0x00 && s[14]==0x00 && s[15]==0x00)
+ ret = 0;
}
if(flag==1 && sizeof(unsigned long)==8) {
- ull = 0xffffffffffffffffUL;
- ld = (long double)ull;
- memcpy(s, &ld, 16);
- /* Use a different value from signed long to test. The problem is the same
- * for both long and unsigned long. The value is 18446744073709551615.
- * The library converts the value to 0x43effffffffffffffe000000000000000.
- * In decimal it's 18446744073709548544.000000, very different from the original.
- * The IBM Power6 Linux converts it to 0x43f0000000000000bff0000000000000.
- * The value is correct in decimal. It uses some special
- * algorithm. We're going to define the macro and skip the test until
- * we can figure out how they do it. */
- if(s[0]==0x43 && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 &&
- s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00 &&
- s[8]==0xbf && s[9]==0xf0 && s[10]==0x00 && s[11]==0x00 &&
- s[12]==0x00 && s[13]==0x00 && s[14]==0x00 && s[15]==0x00)
- ret = 0;
+ ull = 0xffffffffffffffffUL;
+ ld = (long double)ull;
+ memcpy(s, &ld, 16);
+ /* Use a different value from signed long to test. The problem is the same
+ * for both long and unsigned long. The value is 18446744073709551615.
+ * The library converts the value to 0x43effffffffffffffe000000000000000.
+ * In decimal it's 18446744073709548544.000000, very different from the original.
+ * The IBM Power6 Linux converts it to 0x43f0000000000000bff0000000000000.
+ * The value is correct in decimal. It uses some special
+ * algorithm. We're going to define the macro and skip the test until
+ * we can figure out how they do it. */
+ if(s[0]==0x43 && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 &&
+ s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00 &&
+ s[8]==0xbf && s[9]==0xf0 && s[10]==0x00 && s[11]==0x00 &&
+ s[12]==0x00 && s[13]==0x00 && s[14]==0x00 && s[15]==0x00)
+ ret = 0;
}
done:
exit(ret);
@@ -138,7 +149,7 @@ done:
#include <string.h>
#include <stdlib.h>
-int main(void)
+int main(void) HDF_NO_UBSAN
{
long double ld = 20041683600089727.779961L;
long long ll;
@@ -181,7 +192,7 @@ done:
#include <string.h>
#include <stdlib.h>
-int main(void)
+int main(void) HDF_NO_UBSAN
{
long double ld;
long long ll;
@@ -243,7 +254,7 @@ int FC_DUMMY_MAIN()
#endif
#endif
int
-main ()
+main () HDF_NO_UBSAN
{
char *chp = "beefs";
diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake
index a414cea..56277fa 100644
--- a/config/cmake/HDFCompilerFlags.cmake
+++ b/config/cmake/HDFCompilerFlags.cmake
@@ -49,9 +49,9 @@ if (HDF5_DISABLE_COMPILER_WARNINGS)
if (MSVC)
set (HDF5_WARNINGS_BLOCKED 1)
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /w")
+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W0")
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /w")
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W0")
endif ()
if (WIN32)
add_definitions (-D_CRT_SECURE_NO_WARNINGS)
diff --git a/config/cmake_ext_mod/CheckTypeSize.cmake b/config/cmake_ext_mod/CheckTypeSize.cmake
deleted file mode 100644
index c14c2f2..0000000
--- a/config/cmake_ext_mod/CheckTypeSize.cmake
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# Copyright by The HDF Group.
-# All rights reserved.
-#
-# This file is part of HDF5. The full HDF5 copyright notice, including
-# terms governing use, modification, and redistribution, is contained in
-# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
-# If you do not have access to either file, you may request a copy from
-# help@hdfgroup.org.
-#
-#
-# Check if the type exists and determine size of type. if the type
-# exists, the size will be stored to the variable.
-#
-# CHECK_TYPE_SIZE - macro which checks the size of type
-# VARIABLE - variable to store size if the type exists.
-# HAVE_${VARIABLE} - does the variable exists or not
-#
-
-macro (HDF_CHECK_TYPE_SIZE TYPE VARIABLE)
- set (CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS 1)
- if ("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
- set (MACRO_CHECK_TYPE_SIZE_FLAGS
- "-DCHECK_TYPE_SIZE_TYPE=\"${TYPE}\" ${CMAKE_REQUIRED_FLAGS}"
- )
- foreach (def HAVE_SYS_TYPES_H HAVE_STDINT_H HAVE_STDDEF_H HAVE_INTTYPES_H)
- if ("${def}")
- set (MACRO_CHECK_TYPE_SIZE_FLAGS "${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}")
- endif ()
- endforeach ()
-
- message (STATUS "Check size of ${TYPE}")
- if (CMAKE_REQUIRED_LIBRARIES)
- set (CHECK_TYPE_SIZE_ADD_LIBRARIES
- "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}"
- )
- endif ()
- try_run (${VARIABLE} HAVE_${VARIABLE}
- ${CMAKE_BINARY_DIR}
- ${HDF_RESOURCES_EXT_DIR}/CheckTypeSize.c
- CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS}
- "${CHECK_TYPE_SIZE_ADD_LIBRARIES}"
- OUTPUT_VARIABLE OUTPUT
- )
- if (HAVE_${VARIABLE})
- message (STATUS "Check size of ${TYPE} - done")
- file (APPEND
- ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log
- "Determining size of ${TYPE} passed with the following output:\n${OUTPUT}\n\n"
- )
- else ()
- message (STATUS "Check size of ${TYPE} - failed")
- file (APPEND
- ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
- "Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\n\n"
- )
- endif ()
- endif ()
- set (CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS)
-endmacro ()
diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake
index 56d45f9..3797768 100644
--- a/config/cmake_ext_mod/ConfigureChecks.cmake
+++ b/config/cmake_ext_mod/ConfigureChecks.cmake
@@ -12,18 +12,18 @@
#-----------------------------------------------------------------------------
# Include all the necessary files for macros
#-----------------------------------------------------------------------------
-include (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
-include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
-include (${CMAKE_ROOT}/Modules/CheckIncludeFileCXX.cmake)
-include (${CMAKE_ROOT}/Modules/CheckIncludeFiles.cmake)
-include (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake)
-include (${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake)
-include (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
-include (${CMAKE_ROOT}/Modules/CheckVariableExists.cmake)
-include (${CMAKE_ROOT}/Modules/CheckFortranFunctionExists.cmake)
-include (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
+include (CheckFunctionExists)
+include (CheckIncludeFile)
+include (CheckIncludeFileCXX)
+include (CheckIncludeFiles)
+include (CheckLibraryExists)
+include (CheckSymbolExists)
+include (CheckTypeSize)
+include (CheckVariableExists)
+include (CheckFortranFunctionExists)
+include (TestBigEndian)
if (CMAKE_CXX_COMPILER AND CMAKE_CXX_COMPILER_LOADED)
- include (${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake)
+ include (TestForSTDNamespace)
endif ()
#-----------------------------------------------------------------------------
@@ -145,7 +145,7 @@ endif ()
# For other specific tests, use this MACRO.
macro (HDF_FUNCTION_TEST OTHER_TEST)
- if ("${HDF_PREFIX}_${OTHER_TEST}" MATCHES "^${HDF_PREFIX}_${OTHER_TEST}$")
+ if (NOT DEFINED ${HDF_PREFIX}_${OTHER_TEST})
set (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}")
set (OTHER_TEST_ADD_LIBRARIES)
if (CMAKE_REQUIRED_LIBRARIES)
@@ -587,7 +587,7 @@ endif ()
# For other CXX specific tests, use this MACRO.
macro (HDF_CXX_FUNCTION_TEST OTHER_TEST)
- if ("${OTHER_TEST}" MATCHES "^${OTHER_TEST}$")
+ if (NOT DEFINED ${OTHER_TEST})
set (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}")
set (OTHER_TEST_ADD_LIBRARIES)
if (CMAKE_REQUIRED_LIBRARIES)
@@ -656,7 +656,7 @@ endif ()
if (WINDOWS)
if (NOT HDF_NO_IOEO_TEST)
message (STATUS "Checking for InitOnceExecuteOnce:")
- if ("${${HDF_PREFIX}_HAVE_IOEO}" MATCHES "^${${HDF_PREFIX}_HAVE_IOEO}$")
+ if (NOT DEFINED ${${HDF_PREFIX}_HAVE_IOEO})
if (LARGEFILE)
set (CMAKE_REQUIRED_DEFINITIONS
"${CURRENT_TEST_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE"
diff --git a/config/cmake_ext_mod/HDFTests.c b/config/cmake_ext_mod/HDFTests.c
index 60ac744..320fd5b 100644
--- a/config/cmake_ext_mod/HDFTests.c
+++ b/config/cmake_ext_mod/HDFTests.c
@@ -222,12 +222,26 @@ SIMPLE_TEST(struct stat sb; sb.st_blocks=0);
#include <stdlib.h>
#include <string.h>
+#if defined(_MSC_VER) && defined(_DEBUG)
+# include <crtdbg.h>
+int DebugReport(int reportType, char* message, int* returnValue)
+{
+ (void)reportType;
+ (void)message;
+ (void)returnValue;
+ return 1; /* no further handling required */
+}
+#endif
+
int main(void)
{
char *llwidthArgs[] = { "I64", "l64", "l", "L", "q", "ll", NULL };
char *s = malloc(128);
char **currentArg = NULL;
LL_TYPE x = (LL_TYPE)1048576 * (LL_TYPE)1048576;
+ #if defined(_MSC_VER) && defined(_DEBUG)
+ _CrtSetReportHook(DebugReport);
+ #endif
for (currentArg = llwidthArgs; *currentArg != NULL; currentArg++)
{
char formatString[64];
diff --git a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt
index 075e1da..a0f92d3 100644
--- a/fortran/CMakeLists.txt
+++ b/fortran/CMakeLists.txt
@@ -10,21 +10,21 @@ endif ()
#-----------------------------------------------------------------------------
# Traverse source subdirectory
#-----------------------------------------------------------------------------
-add_subdirectory (${HDF5_F90_SOURCE_DIR}/src ${HDF5_F90_BINARY_DIR}/src)
+add_subdirectory (src)
#-----------------------------------------------------------------------------
# Build the Fortran Examples
#-----------------------------------------------------------------------------
if (HDF5_BUILD_EXAMPLES)
- add_subdirectory (${HDF5_F90_SOURCE_DIR}/examples ${HDF5_F90_BINARY_DIR}/examples)
+ add_subdirectory (examples)
endif ()
#-----------------------------------------------------------------------------
# Testing
#-----------------------------------------------------------------------------
if (BUILD_TESTING)
- add_subdirectory (${HDF5_F90_SOURCE_DIR}/test ${HDF5_F90_BINARY_DIR}/test)
+ add_subdirectory (test)
if (MPI_Fortran_FOUND)
- add_subdirectory (${HDF5_F90_SOURCE_DIR}/testpar ${HDF5_F90_BINARY_DIR}/testpar)
+ add_subdirectory (testpar)
endif ()
endif ()
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt
index 59acaf0..f094b47 100644
--- a/fortran/src/CMakeLists.txt
+++ b/fortran/src/CMakeLists.txt
@@ -80,10 +80,9 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
)
endif ()
-set (CMD $<TARGET_FILE:H5test_FortranHavekind>)
add_custom_command (
OUTPUT ${HDF5_F90_BINARY_DIR}/H5fortran_detect.f90
- COMMAND ${CMD}
+ COMMAND $<TARGET_FILE:H5test_FortranHavekind>
ARGS > ${HDF5_F90_BINARY_DIR}/H5fortran_detect.f90
WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}
DEPENDS H5test_FortranHavekind
@@ -106,10 +105,9 @@ if (WIN32 AND MSVC)
endif ()
set_target_properties (H5fortran_detect PROPERTIES LINKER_LANGUAGE Fortran)
-set (CMD $<TARGET_FILE:H5fortran_detect>)
add_custom_command (
OUTPUT ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h
- COMMAND ${CMD}
+ COMMAND $<TARGET_FILE:H5fortran_detect>
ARGS > ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h
WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}
DEPENDS H5fortran_detect
@@ -129,22 +127,20 @@ add_executable (H5match_types
${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h
${HDF5_F90_SRC_SOURCE_DIR}/H5match_types.c
)
-set (CMD $<TARGET_FILE:H5match_types>)
add_custom_command (
OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h
${HDF5_F90_BINARY_DIR}/static/H5fortran_types.f90
- COMMAND ${CMD}
+ COMMAND $<TARGET_FILE:H5match_types>
WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static
DEPENDS H5match_types
)
set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h PROPERTIES GENERATED TRUE)
set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5fortran_types.f90 PROPERTIES GENERATED TRUE)
if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
- set (CMDSH $<TARGET_FILE:H5match_types>)
add_custom_command (
OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h
${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.f90
- COMMAND ${CMDSH}
+ COMMAND $<TARGET_FILE:H5match_types>
WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared
DEPENDS H5match_types
)
diff --git a/hl/CMakeLists.txt b/hl/CMakeLists.txt
index a47e023..d80b4f9 100644
--- a/hl/CMakeLists.txt
+++ b/hl/CMakeLists.txt
@@ -12,21 +12,21 @@ add_definitions (${HDF_EXTRA_C_FLAGS})
#-----------------------------------------------------------------------------
INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src )
-add_subdirectory (${HDF5_HL_SOURCE_DIR}/src ${HDF5_HL_BINARY_DIR}/src)
+add_subdirectory (src)
#-- Build the High level Tools
if (HDF5_BUILD_TOOLS)
- add_subdirectory (${HDF5_HL_SOURCE_DIR}/tools ${HDF5_HL_BINARY_DIR}/tools)
+ add_subdirectory (tools)
endif ()
#-- Add High Level Examples
if (HDF5_BUILD_EXAMPLES)
- add_subdirectory (${HDF5_HL_SOURCE_DIR}/examples ${HDF5_HL_BINARY_DIR}/examples)
+ add_subdirectory (examples)
endif ()
#-- Build the Unit testing if requested
if (NOT HDF5_EXTERNALLY_CONFIGURED)
if (BUILD_TESTING)
- add_subdirectory (${HDF5_HL_SOURCE_DIR}/test ${HDF5_HL_BINARY_DIR}/test)
+ add_subdirectory (test)
endif ()
endif ()
diff --git a/hl/c++/CMakeLists.txt b/hl/c++/CMakeLists.txt
index 91bfa14..9a1d059 100644
--- a/hl/c++/CMakeLists.txt
+++ b/hl/c++/CMakeLists.txt
@@ -4,13 +4,13 @@ PROJECT (HDF5_HL_CPP)
#-----------------------------------------------------------------------------
# Main HL lib is in /src
#-----------------------------------------------------------------------------
-add_subdirectory (${HDF5_HL_CPP_SOURCE_DIR}/src ${HDF5_HL_CPP_BINARY_DIR}/src)
+add_subdirectory (src)
# --------------------------------------------------------------------
# Add in the examples for the Packet Table codes
# --------------------------------------------------------------------
if (HDF5_BUILD_EXAMPLES)
- add_subdirectory (${HDF5_HL_CPP_SOURCE_DIR}/examples ${HDF5_HL_CPP_BINARY_DIR}/examples)
+ add_subdirectory (examples)
endif ()
# --------------------------------------------------------------------
@@ -18,5 +18,5 @@ endif ()
# --------------------------------------------------------------------
if (BUILD_TESTING)
- add_subdirectory (${HDF5_HL_CPP_SOURCE_DIR}/test ${HDF5_HL_CPP_BINARY_DIR}/test)
+ add_subdirectory (test)
endif ()
diff --git a/hl/fortran/CMakeLists.txt b/hl/fortran/CMakeLists.txt
index c651ce9..00d7517 100644
--- a/hl/fortran/CMakeLists.txt
+++ b/hl/fortran/CMakeLists.txt
@@ -4,18 +4,18 @@ PROJECT (HDF5_HL_F90 C CXX Fortran)
#-----------------------------------------------------------------------------
# List Source files
#-----------------------------------------------------------------------------
-add_subdirectory (${HDF5_HL_F90_SOURCE_DIR}/src ${HDF5_HL_F90_BINARY_DIR}/src)
+add_subdirectory (src)
#-----------------------------------------------------------------------------
# Build the HL Fortran Examples
#-----------------------------------------------------------------------------
if (HDF5_BUILD_EXAMPLES)
- add_subdirectory (${HDF5_HL_F90_SOURCE_DIR}/examples ${HDF5_HL_F90_BINARY_DIR}/examples)
+ add_subdirectory (examples)
endif ()
#-----------------------------------------------------------------------------
# Testing
#-----------------------------------------------------------------------------
if (BUILD_TESTING)
- add_subdirectory (${HDF5_HL_F90_SOURCE_DIR}/test ${HDF5_HL_F90_BINARY_DIR}/test)
+ add_subdirectory (test)
endif ()
diff --git a/hl/tools/CMakeLists.txt b/hl/tools/CMakeLists.txt
index 482bf91..5503f41 100644
--- a/hl/tools/CMakeLists.txt
+++ b/hl/tools/CMakeLists.txt
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.2.2)
PROJECT (HDF5_HL_TOOLS C CXX)
-add_subdirectory (${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5 ${HDF5_HL_TOOLS_BINARY_DIR}/gif2h5)
+add_subdirectory (gif2h5)
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index ff16bb6..3e20248 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -116,6 +116,16 @@ Bug Fixes since HDF5-1.8.20
-------------
- CMake
+ Update CMake commands configuration.
+
+ A number of improvements were made to the CMake commands. Most
+ changes simplify usage or eliminate unused constructs. Also,
+ some changes support better cross-platform support.
+
+ (ADB - 2018/02/01, HDFFV-10398)
+
+ - CMake
+
Correct usage of CMAKE_BUILD_TYPE variable.
The use of the CMAKE_BUILD_TYPE is incorrect for multi-config
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index dc180c3..1593466 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -616,11 +616,13 @@ TARGET_C_PROPERTIES (H5detect STATIC " " " ")
if (MSVC OR MINGW)
target_link_libraries (H5detect "ws2_32.lib")
endif ()
+if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
+ set_property(TARGET H5detect PROPERTY LINK_FLAGS "-O0")
+endif ()
-set (CMD $<TARGET_FILE:H5detect>)
add_custom_command (
OUTPUT ${HDF5_BINARY_DIR}/H5Tinit.c
- COMMAND ${CMD}
+ COMMAND $<TARGET_FILE:H5detect>
ARGS > ${HDF5_BINARY_DIR}/H5Tinit.c
DEPENDS H5detect
)
@@ -630,11 +632,13 @@ TARGET_C_PROPERTIES (H5make_libsettings STATIC " " " ")
if (MSVC OR MINGW)
target_link_libraries (H5make_libsettings "ws2_32.lib")
endif ()
+if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
+ set_property(TARGET H5make_libsettings PROPERTY LINK_FLAGS "-O0")
+endif ()
-set (CMD $<TARGET_FILE:H5make_libsettings>)
add_custom_command (
OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c
- COMMAND ${CMD}
+ COMMAND $<TARGET_FILE:H5make_libsettings>
ARGS > ${HDF5_BINARY_DIR}/H5lib_settings.c
DEPENDS H5make_libsettings
WORKING_DIRECTORY ${HDF5_BINARY_DIR}
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index c9cc21b..8f4372a 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -15,35 +15,35 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
# If testing was NOT enabled, then we need to build the tools library
# --------------------------------------------------------------------
if (NOT BUILD_TESTING)
- add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/lib)
+ add_subdirectory (lib)
endif ()
#-- Add the h5diff and test executables
-add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/h5diff)
+add_subdirectory (h5diff)
#-- Add the h5ls executable
-add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/h5ls)
+add_subdirectory (h5ls)
#-- Misc Executables
-add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/misc)
+add_subdirectory (misc)
#-- Add the h5import and test executables
-add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/h5import)
+add_subdirectory (h5import)
#-- h5Repack executables
-add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/h5repack)
+add_subdirectory (h5repack)
#-- Add the h5dump and test executables
-add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/h5jam)
+add_subdirectory (h5jam)
#-- Add the h5copy and test executables
-add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/h5copy)
+add_subdirectory (h5copy)
#-- Add the h5stat and test executables
-add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/h5stat)
+add_subdirectory (h5stat)
#-- Add the h5dump and test executables
-add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/h5dump)
+add_subdirectory (h5dump)
#-- Add the perform and test executables
-add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/perform)
+add_subdirectory (perform)