HDFFV-10398 merge from develop improve CMake code

This commit is contained in:
Allen Byrne 2018-01-30 16:30:17 -06:00
parent edb6fd0cf9
commit 16e649fa0d
26 changed files with 205 additions and 259 deletions

View File

@ -528,9 +528,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)
@ -676,7 +680,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)
@ -721,12 +725,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 ()
@ -738,7 +742,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 ()
@ -748,7 +752,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 ()
@ -759,7 +763,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 ()
@ -808,11 +812,11 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for
#
# set (FCFLAGS "${Fortran_DEFINES}")
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 ()
@ -835,11 +839,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 ()
@ -861,7 +865,7 @@ endif ()
if (EXISTS "${HDF5_SOURCE_DIR}/java" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/java")
option (HDF5_BUILD_JAVA "Build Java HDF5 Library" OFF)
if (HDF5_BUILD_JAVA)
add_subdirectory (${HDF5_SOURCE_DIR}/java ${PROJECT_BINARY_DIR}/java)
add_subdirectory (java)
endif ()
endif ()

View File

@ -3093,7 +3093,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

View File

@ -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 ()

View File

@ -179,7 +179,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}
@ -209,21 +209,6 @@ macro (H5ConversionTests TEST msg)
endif ()
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
#-----------------------------------------------------------------------------

View File

@ -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) {
/*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;
/* 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);
memcpy(&ld, s, 16);
ll = (long)ld;
memcpy(s2, &ll, 8);
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;
/* 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);
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;
}
/* 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";

View File

@ -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)

View File

@ -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 ()

View File

@ -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"

View File

@ -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];

View File

@ -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 ()

View File

@ -78,22 +78,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)
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
)
@ -171,10 +169,9 @@ set (f90_F_GEN_SOURCES
${HDF5_F90_SRC_SOURCE_DIR}/H5Dff.F90
${HDF5_F90_SRC_SOURCE_DIR}/H5Pff.F90
)
set (CMD $<TARGET_FILE:H5_buildiface>)
add_custom_command (
OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90
COMMAND ${CMD}
COMMAND $<TARGET_FILE:H5_buildiface>
WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static
DEPENDS ${f90_F_GEN_SOURCES}
COMMENT "Generating the H5_gen.F90 file"
@ -185,10 +182,9 @@ add_custom_target (H5gen ALL
set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 PROPERTIES GENERATED TRUE)
if (BUILD_SHARED_LIBS)
set (CMDSH $<TARGET_FILE:H5_buildiface>)
add_custom_command (
OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90
COMMAND ${CMDSH}
COMMAND $<TARGET_FILE:H5_buildiface>
WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared
DEPENDS ${f90_F_GEN_SOURCES}
COMMENT "Generating the H5_gen.F90 shared file"

View File

@ -74,10 +74,9 @@ if (BUILD_SHARED_LIBS)
)
endif ()
set (CMD $<TARGET_FILE:H5_test_buildiface>)
add_custom_command (
OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90
COMMAND ${CMD}
COMMAND $<TARGET_FILE:H5_test_buildiface>
WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static
DEPENDS H5_test_buildiface
COMMENT "Generating the tf_gen.F90 file"
@ -88,10 +87,9 @@ add_custom_target (H5testgen ALL
set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 PROPERTIES GENERATED TRUE)
if (BUILD_SHARED_LIBS)
set (CMDSH $<TARGET_FILE:H5_test_buildiface>)
add_custom_command (
OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90
COMMAND ${CMDSH}
COMMAND $<TARGET_FILE:H5_test_buildiface>
WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared
DEPENDS H5_test_buildiface
COMMENT "Generating the tf_gen.F90 shared file"

View File

@ -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 ()

View File

@ -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 ()

View File

@ -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 ()

View File

@ -109,10 +109,9 @@ set (HDF5_HL_F90_F_BASE_SOURCES
${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMff.F90
)
set (CMD $<TARGET_FILE:H5HL_buildiface>)
add_custom_command (
OUTPUT ${HDF5_HL_F90_SRC_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_SRC_BINARY_DIR}/H5TBff_gen.F90
COMMAND ${CMD}
COMMAND $<TARGET_FILE:H5HL_buildiface>
WORKING_DIRECTORY ${HDF5_HL_F90_SRC_BINARY_DIR}/static
DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES}
COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 files"
@ -126,10 +125,9 @@ set_source_files_properties (
PROPERTIES GENERATED TRUE
)
if (BUILD_SHARED_LIBS)
set (CMDSH $<TARGET_FILE:H5HL_buildiface>)
add_custom_command (
OUTPUT ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_SRC_BINARY_DIR}/shared/H5TBff_gen.F90
COMMAND ${CMD}
COMMAND $<TARGET_FILE:H5HL_buildiface>
WORKING_DIRECTORY ${HDF5_HL_F90_SRC_BINARY_DIR}/shared
DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES}
COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 shared files"

View File

@ -1,6 +1,6 @@
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)
add_subdirectory (${HDF5_HL_TOOLS_SOURCE_DIR}/h5watch ${HDF5_HL_TOOLS_BINARY_DIR}/h5watch)
add_subdirectory (h5watch)

View File

@ -36,20 +36,20 @@ set (CMAKE_JAVA_INCLUDE_PATH "")
#-----------------------------------------------------------------------------
# Traverse source subdirectory
#-----------------------------------------------------------------------------
add_subdirectory (${HDF5_JAVA_SOURCE_DIR}/src ${HDF5_JAVA_BINARY_DIR}/src)
add_subdirectory (src)
#-----------------------------------------------------------------------------
# Build the Java Examples
#-----------------------------------------------------------------------------
if (HDF5_BUILD_EXAMPLES)
add_subdirectory (${HDF5_JAVA_SOURCE_DIR}/examples ${HDF5_JAVA_BINARY_DIR}/examples)
add_subdirectory (examples)
endif ()
#-----------------------------------------------------------------------------
# Testing
#-----------------------------------------------------------------------------
if (BUILD_TESTING)
add_subdirectory (${HDF5_JAVA_SOURCE_DIR}/test ${HDF5_JAVA_BINARY_DIR}/test)
add_subdirectory (test)
endif ()
#-----------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
cmake_minimum_required (VERSION 3.2.2)
PROJECT (HDFJAVA_EXAMPLES)
add_subdirectory (${HDFJAVA_EXAMPLES_SOURCE_DIR}/datasets datasets)
add_subdirectory (${HDFJAVA_EXAMPLES_SOURCE_DIR}/datatypes datatypes)
add_subdirectory (${HDFJAVA_EXAMPLES_SOURCE_DIR}/groups groups)
add_subdirectory (${HDFJAVA_EXAMPLES_SOURCE_DIR}/intro intro)
add_subdirectory (datasets)
add_subdirectory (datatypes)
add_subdirectory (groups)
add_subdirectory (intro)

View File

@ -4,5 +4,5 @@ PROJECT ( HDF5_JAVA_SRC C Java )
#-----------------------------------------------------------------------------
# Traverse source subdirectory
#-----------------------------------------------------------------------------
add_subdirectory (${HDF5_JAVA_SRC_SOURCE_DIR}/jni ${HDF5_JAVA_SRC_BINARY_DIR}/jni)
add_subdirectory (${HDF5_JAVA_SRC_SOURCE_DIR}/hdf ${HDF5_JAVA_SRC_BINARY_DIR}/hdf)
add_subdirectory (jni)
add_subdirectory (hdf)

View File

@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.2.2)
PROJECT (HDF5_JAVA_HDF)
add_subdirectory (${HDF5_JAVA_HDF_SOURCE_DIR}/hdf5lib hdf5lib)
add_subdirectory (hdf5lib)

View File

@ -852,11 +852,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
)
@ -866,11 +868,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}
@ -905,18 +909,16 @@ set (install_targets ${HDF5_LIB_TARGET})
if (BUILD_SHARED_LIBS)
file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared")
set (CMD $<TARGET_FILE:H5detect>)
add_custom_command (
OUTPUT ${HDF5_BINARY_DIR}/shared/H5Tinit.c
COMMAND ${CMD}
COMMAND $<TARGET_FILE:H5detect>
ARGS > ${HDF5_BINARY_DIR}/shared/H5Tinit.c
DEPENDS H5detect
WORKING_DIRECTORY ${HDF5_BINARY_DIR}/shared
)
set (CMD $<TARGET_FILE:H5make_libsettings>)
add_custom_command (
OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c
COMMAND ${CMD}
COMMAND $<TARGET_FILE:H5make_libsettings>
ARGS > ${HDF5_BINARY_DIR}/shared/H5lib_settings.c
DEPENDS H5make_libsettings
WORKING_DIRECTORY ${HDF5_BINARY_DIR}

View File

@ -10,7 +10,7 @@ add_definitions (${HDF_EXTRA_C_FLAGS})
# 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 ()
#-----------------------------------------------------------------------------
@ -19,9 +19,9 @@ endif ()
INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
#-- Add the test sources
add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/src)
add_subdirectory (src)
#-- Add the tests
if (BUILD_TESTING)
add_subdirectory (${HDF5_TOOLS_SOURCE_DIR}/test)
add_subdirectory (test)
endif ()

View File

@ -7,31 +7,31 @@ PROJECT (HDF5_TOOLS_SRC)
add_definitions (${HDF_EXTRA_C_FLAGS})
#-- Add the h5diff and test executables
add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5diff)
add_subdirectory (h5diff)
#-- Add the h5ls executable
add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5ls)
add_subdirectory (h5ls)
#-- Misc Executables
add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/misc)
add_subdirectory (misc)
#-- Add the h5import and test executables
add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5import)
add_subdirectory (h5import)
#-- h5Repack executables
add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5repack)
add_subdirectory (h5repack)
#-- Add the h5dump and test executables
add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5jam)
add_subdirectory (h5jam)
#-- Add the h5copy and test executables
add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5copy)
add_subdirectory (h5copy)
#-- Add the h5stat and test executables
add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5stat)
add_subdirectory (h5stat)
#-- Add the h5dump and test executables
add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5dump)
add_subdirectory (h5dump)
#-- Add the h5format_convert and test executables
add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5format_convert)
add_subdirectory (h5format_convert)

View File

@ -7,34 +7,34 @@ PROJECT (HDF5_TOOLS_TEST)
add_definitions (${HDF_EXTRA_C_FLAGS})
#-- Add the h5diff tests
add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5diff)
add_subdirectory (h5diff)
#-- Add the h5ls tests
add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5ls)
add_subdirectory (h5ls)
#-- Misc tests
add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/misc)
add_subdirectory (misc)
#-- Add the h5import tests
add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5import)
add_subdirectory (h5import)
#-- h5Repack tests
add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5repack)
add_subdirectory (h5repack)
#-- Add the h5jam tests
add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5jam)
add_subdirectory (h5jam)
#-- Add the h5copy tests
add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5copy)
add_subdirectory (h5copy)
#-- Add the h5stat tests
add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5stat)
add_subdirectory (h5stat)
#-- Add the h5dump tests
add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5dump)
add_subdirectory (h5dump)
#-- Add the h5format_convert and test executables
add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5format_convert)
add_subdirectory (h5format_convert)
#-- Add the perform tests
add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/perform)
add_subdirectory (perform)

View File

@ -22,7 +22,7 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
set_target_properties (h5clear_gentest PROPERTIES FOLDER tools)
#add_test (NAME H5CLEAR-h5clear_gentest COMMAND $<TARGET_FILE:h5clear_gentest>)
add_subdirectory (${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/vds)
add_subdirectory (vds)
endif ()