summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-07-15 16:27:52 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-07-15 16:27:52 (GMT)
commitb0445792fb7cbdc3db9ad9473a934e3079bceb6e (patch)
tree331d92b3dd1929e561e2c4b5f91419caed70cb0d
parent1ecb6ec9c5075a97572d06a1f509cd763be2bc94 (diff)
downloadhdf5-b0445792fb7cbdc3db9ad9473a934e3079bceb6e.zip
hdf5-b0445792fb7cbdc3db9ad9473a934e3079bceb6e.tar.gz
hdf5-b0445792fb7cbdc3db9ad9473a934e3079bceb6e.tar.bz2
CMake updates:
Add build folder as Include for generated files Add install option for copying Fortran mod files to include folder Add PRI defines to win32defs file Exclude mingw from extra flags
-rw-r--r--CMakeLists.txt11
-rw-r--r--config/cmake/HDFFortranCompilerFlags.cmake2
-rw-r--r--config/cmake/PkgInfo.in2
-rw-r--r--config/cmake/cacheinit.cmake3
-rw-r--r--config/gnu-warnings/no-developer-general4
-rw-r--r--fortran/src/CMakeLists.txt20
-rw-r--r--hl/fortran/src/CMakeLists.txt21
-rw-r--r--release_docs/INSTALL_CMake.txt8
-rw-r--r--release_docs/RELEASE.txt25
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/H5win32defs.h48
11 files changed, 137 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a3fa903..ef4caca 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -946,6 +946,17 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for
endif ()
endif ()
+ #option (HDF5_INSTALL_MOD_FORTRAN "Copy FORTRAN mod files to include directory (NO SHARED STATIC)" "NO")
+ set (HDF5_INSTALL_MOD_FORTRAN "SHARED" CACHE STRING "Copy FORTRAN mod files to include directory (NO SHARED STATIC)")
+ set_property (CACHE HDF5_INSTALL_MOD_FORTRAN PROPERTY STRINGS NO SHARED STATIC)
+ if (NOT HDF5_INSTALL_MOD_FORTRAN MATCHES "NO")
+ if (NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
+ set (HDF5_INSTALL_MOD_FORTRAN "STATIC")
+ elseif (BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS)
+ set (HDF5_INSTALL_MOD_FORTRAN "SHARED")
+ endif ()
+ endif ()
+
add_subdirectory (fortran)
if (HDF5_BUILD_HL_LIB)
if (EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran")
diff --git a/config/cmake/HDFFortranCompilerFlags.cmake b/config/cmake/HDFFortranCompilerFlags.cmake
index 15edaa8..2bbb35d 100644
--- a/config/cmake/HDFFortranCompilerFlags.cmake
+++ b/config/cmake/HDFFortranCompilerFlags.cmake
@@ -48,7 +48,7 @@ endif ()
# CDash is configured to only allow 3000 warnings, so
# break into groups (from the config/gnu-flags file)
#-----------------------------------------------------------------------------
-if (NOT MSVC)
+if (NOT MSVC AND NOT MINGW)
# General flags
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
ADD_H5_FLAGS (HDF5_CMAKE_Fortran_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings/ifort-general")
diff --git a/config/cmake/PkgInfo.in b/config/cmake/PkgInfo.in
index e530f88..ae54035 100644
--- a/config/cmake/PkgInfo.in
+++ b/config/cmake/PkgInfo.in
@@ -1 +1 @@
-FMWK???? \ No newline at end of file
+FMWK????
diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake
index 4846997..64e8dcc 100644
--- a/config/cmake/cacheinit.cmake
+++ b/config/cmake/cacheinit.cmake
@@ -23,6 +23,9 @@ set (HDF_PACKAGE_NAMESPACE "hdf5::" CACHE STRING "Name for HDF package namespace
set (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE)
+set (HDF5_INSTALL_MOD_FORTRAN "NO" CACHE STRING "Copy FORTRAN mod files to include directory (NO SHARED STATIC)" FORCE)
+set_property (CACHE HDF5_INSTALL_MOD_FORTRAN PROPERTY STRINGS NO SHARED STATIC)
+
set (HDF5_BUILD_GENERATORS ON CACHE BOOL "Build Test Generators" FORCE)
set (HDF5_ENABLE_Z_LIB_SUPPORT ON CACHE BOOL "Enable Zlib Filters" FORCE)
diff --git a/config/gnu-warnings/no-developer-general b/config/gnu-warnings/no-developer-general
index 85dc0a3..18831dd 100644
--- a/config/gnu-warnings/no-developer-general
+++ b/config/gnu-warnings/no-developer-general
@@ -2,3 +2,7 @@
-Wno-inline
-Wno-missing-format-attribute
-Wno-missing-noreturn
+# NOTE: -pedantic includes -Woverlength-strings which triggers a warning
+# regarding the library settings string (H5libhdf5_settings). We'll turn
+# it off here but leave it on in the developer flags.
+-Wno-overlength-strings
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt
index 3a37278..e133ff2 100644
--- a/fortran/src/CMakeLists.txt
+++ b/fortran/src/CMakeLists.txt
@@ -410,6 +410,16 @@ if (NOT ONLY_SHARED_LIBS)
COMPONENT
fortheaders
)
+ if (HDF5_INSTALL_MOD_FORTRAN MATCHES "STATIC")
+ install (
+ FILES
+ ${mod_files}
+ DESTINATION
+ ${HDF5_INSTALL_INCLUDE_DIR}
+ COMPONENT
+ fortheaders
+ )
+ endif ()
endif ()
if (BUILD_SHARED_LIBS)
@@ -442,6 +452,16 @@ if (BUILD_SHARED_LIBS)
COMPONENT
fortheaders
)
+ if (HDF5_INSTALL_MOD_FORTRAN MATCHES "SHARED")
+ install (
+ FILES
+ ${modsh_files}
+ DESTINATION
+ ${HDF5_INSTALL_INCLUDE_DIR}
+ COMPONENT
+ fortheaders
+ )
+ endif ()
endif ()
#-----------------------------------------------------------------------------
diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt
index 71b9380..d682d5f 100644
--- a/hl/fortran/src/CMakeLists.txt
+++ b/hl/fortran/src/CMakeLists.txt
@@ -234,7 +234,6 @@ if (NOT ONLY_SHARED_LIBS)
${MOD_BUILD_DIR}/h5lt_const.mod
${MOD_BUILD_DIR}/h5im.mod
)
-
install (
FILES
${mod_files}
@@ -243,6 +242,16 @@ if (NOT ONLY_SHARED_LIBS)
COMPONENT
fortheaders
)
+ if (HDF5_INSTALL_MOD_FORTRAN MATCHES "STATIC")
+ install (
+ FILES
+ ${mod_files}
+ DESTINATION
+ ${HDF5_INSTALL_INCLUDE_DIR}
+ COMPONENT
+ fortheaders
+ )
+ endif ()
endif ()
if (BUILD_SHARED_LIBS)
set (modsh_files
@@ -261,6 +270,16 @@ if (BUILD_SHARED_LIBS)
COMPONENT
fortheaders
)
+ if (HDF5_INSTALL_MOD_FORTRAN MATCHES "SHARED")
+ install (
+ FILES
+ ${modsh_files}
+ DESTINATION
+ ${HDF5_INSTALL_INCLUDE_DIR}
+ COMPONENT
+ fortheaders
+ )
+ endif ()
endif ()
#-----------------------------------------------------------------------------
diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt
index 2a2ec9c..a85bb77 100644
--- a/release_docs/INSTALL_CMake.txt
+++ b/release_docs/INSTALL_CMake.txt
@@ -624,6 +624,7 @@ The config/cmake/cacheinit.cmake file can override the following values.
---------------- General Build Options ---------------------
BUILD_SHARED_LIBS "Build Shared Libraries" ON
+BUILD_STATIC_LIBS "Build Static Libraries" ON
BUILD_STATIC_EXECS "Build Static Executables" OFF
BUILD_TESTING "Build HDF5 Unit Testing" ON
@@ -636,6 +637,7 @@ HDF5_BUILD_HL_LIB "Build HIGH Level HDF5 Library" ON
HDF5_BUILD_TOOLS "Build HDF5 Tools" ON
---------------- HDF5 Advanced Options ---------------------
+ONLY_SHARED_LIBS "Only Build Shared Libraries" OFF
ALLOW_UNSUPPORTED "Allow unsupported combinations of configure options" OFF
HDF5_EXTERNAL_LIB_PREFIX "Use prefix for custom library naming." ""
HDF5_DISABLE_COMPILER_WARNINGS "Disable compiler warnings" OFF
@@ -676,6 +678,12 @@ if (CMAKE_BUILD_TYPE MATCHES Debug)
HDF5_ENABLE_INSTRUMENT "Instrument The library" OFF
if (HDF5_TEST_VFD)
HDF5_TEST_FHEAP_VFD "Execute fheap test with different VFDs" ON
+if (HDF5_BUILD_FORTRAN)
+ HDF5_INSTALL_MOD_FORTRAN "Copy FORTRAN mod files to include directory (NO SHARED STATIC)" "XX"
+ if (BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS) default HDF5_INSTALL_MOD_FORTRAN is SHARED
+ if (BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS) default HDF5_INSTALL_MOD_FORTRAN is SHARED
+ if (NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS) default HDF5_INSTALL_MOD_FORTRAN is STATIC
+ if (NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS) default HDF5_INSTALL_MOD_FORTRAN is SHARED
---------------- External Library Options ---------------------
HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO GIT TGZ)" "NO"
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 72b5942..f76f2e5 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -47,6 +47,31 @@ New Features
Configuration:
-------------
+ - CMake option to link the generated Fortran MOD files into the include
+ directory.
+
+ The Fortran generation of MOD files by a Fortran compile can produce
+ different binary files between SHARED and STATIC compiles with different
+ compilers and/or different platforms. Note that it has been found that
+ different versions of Fortran compilers will produce incompatible MOD
+ files. Currently, CMake will locate these MOD files in subfolders of
+ the include directory and add that path to the Fortran library target
+ in the CMake config file, which can be used by the CMake find library
+ process. For other build systems using the binary from a CMake install,
+ a new CMake configuration can be used to copy the pre-chosen version
+ of the Fortran MOD files into the install include directory.
+
+ The default will depend on the configuration of
+ BUILD_STATIC_LIBS and BUILD_SHARED_LIBS:
+ YES YES Default to SHARED
+ YES NO Default to STATIC
+ NO YES Default to SHARED
+ NO NO Default to SHARED
+ The defaults can be overriden by setting the config option
+ HDF5_INSTALL_MOD_FORTRAN to one of NO, SHARED, or STATIC
+
+ (ADB - 2020/07/9, HDFFV-11116)
+
- CMake option to use AEC (open source SZip) library instead of SZip
The open source AEC library is a replacement library for SZip. In
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5ded303..9ff16c9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1074,7 +1074,7 @@ if (NOT ONLY_SHARED_LIBS)
add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS})
target_include_directories (${HDF5_LIB_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
- INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>;$<BUILD_INTERFACE:${HDF5_BINARY_DIR}>"
)
target_compile_options(${HDF5_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}")
target_compile_definitions(${HDF5_LIB_TARGET}
@@ -1111,7 +1111,7 @@ if (BUILD_SHARED_LIBS)
target_include_directories (${HDF5_LIBSH_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
PUBLIC "$<$<BOOL:${HDF5_ENABLE_HDFS}>:${HDFS_INCLUDE_DIR}>"
- INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>;$<BUILD_INTERFACE:${HDF5_BINARY_DIR}>"
)
target_compile_options(${HDF5_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}")
target_compile_definitions(${HDF5_LIBSH_TARGET}
diff --git a/src/H5win32defs.h b/src/H5win32defs.h
index 0a0bd37..8c5ae1a 100644
--- a/src/H5win32defs.h
+++ b/src/H5win32defs.h
@@ -20,6 +20,45 @@
* inside H5private.h
*
*/
+#ifndef H5_HAVE_INTTYPES_H
+/* The following definitions should be suitable for 64-bit Windows, which is
+ * LLP64, and for 32-bit Windows, which is ILP32. Those are the only
+ * platforms where <inttypes.h> is likely to be missing. VS2015 and later
+ * *may* provide these definitions.
+ */
+#ifdef _WIN64
+# define PRIdPTR "lld"
+# define PRIoPTR "llo"
+# define PRIuPTR "llu"
+# define PRIxPTR "llx"
+#else /* _WIN64 */
+# define PRIdPTR "ld"
+# define PRIoPTR "lo"
+# define PRIuPTR "lu"
+# define PRIxPTR "lx"
+#endif /* _WIN64 */
+
+# define PRId8 "d"
+# define PRIo8 "o"
+# define PRIu8 "u"
+# define PRIx8 "x"
+# define PRId16 "d"
+# define PRIo16 "o"
+# define PRIu16 "u"
+# define PRIx16 "x"
+# define PRId32 "d"
+# define PRIo32 "o"
+# define PRIu32 "u"
+# define PRIx32 "x"
+# define PRId64 "lld"
+# define PRIo64 "llo"
+# define PRIu64 "llu"
+# define PRIx64 "llx"
+# define PRIdMAX "lld"
+# define PRIoMAX "llo"
+# define PRIuMAX "llu"
+# define PRIxMAX "llx"
+#endif
/*
* _MSC_VER = 1900 VS2015
@@ -41,11 +80,6 @@ typedef __int64 h5_stat_size_t;
#define HDfstat(F,B) _fstati64(F,B)
#define HDisatty(F) _isatty(F)
-/* The isnan function needs underscore in VS2012 and earlier */
-#if (_MSC_VER <= 1700)
- #define HDisnan(X) _isnan(X)
-#endif /* MSC_VER < 1700 */
-
#define HDgetcwd(S,Z) _getcwd(S,Z)
#define HDgetdcwd(D,S,Z) _getdcwd(D,S,Z)
#define HDgetdrive() _getdrive()
@@ -111,8 +145,10 @@ struct timespec
};
#endif /* MSC_VER < 1900 */
-/* The round functions do not exist in VS2012 and earlier */
#if (_MSC_VER <= 1700)
+/* The isnan function needs underscore in VS2012 and earlier */
+#define HDisnan(X) _isnan(X)
+/* The round functions do not exist in VS2012 and earlier */
#define HDllround(V) Wllround(V)
#define HDllroundf(V) Wllroundf(V)
#define HDlround(V) Wlround(V)