mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-11-27 02:10:55 +08:00
1178 lines
61 KiB
Plaintext
1178 lines
61 KiB
Plaintext
************************************************************************
|
||
* Build and Install HDF5 C, C++, Fortran and High-Level Libraries *
|
||
* and tools with CMake *
|
||
************************************************************************
|
||
|
||
Table of Contents
|
||
|
||
Section I: Preconditions
|
||
Section II: Quick Step Building HDF5 Libraries with CMake Script Mode
|
||
Section III: Quick Step Building HDF5 Libraries with CMake Command Mode
|
||
Section IV: Further considerations
|
||
Section V: Options for building HDF5 Libraries with CMake command line
|
||
Section VI: CMake option defaults for HDF5
|
||
Section VII: User Defined Options for HDF5 Libraries with CMake
|
||
Section VIII: User Defined Compile Flags for HDF5 Libraries with CMake
|
||
Section IX: Considerations for cross-compiling
|
||
Section X: Using CMakePresets.json for compiling
|
||
Section XI: Autotools Configuration and Build
|
||
|
||
************************************************************************
|
||
|
||
|
||
========================================================================
|
||
I. Preconditions
|
||
========================================================================
|
||
Obtaining HDF5 source code
|
||
1. Create a directory for your development; for example, "myhdfstuff".
|
||
|
||
2. Obtain HDF5 source from Github
|
||
development branch: https://github.com/HDFGroup/hdf5
|
||
last release: https://github.com/HDFGroup/hdf5/releases/latest
|
||
hdf5-1_15_"X".tar.gz or hdf5-1_15_"X".zip
|
||
|
||
and put it in "myhdfstuff".
|
||
Uncompress the file. There should be a hdf5-1.15."X" folder.
|
||
|
||
CMake version
|
||
1. We suggest you obtain the latest CMake from the Kitware web site.
|
||
The HDF5 1.15."X" product requires a minimum CMake version 3.18,
|
||
where "X" is the current HDF5 release version. If you are using
|
||
VS2022, the minimum version is 3.21.
|
||
|
||
Note:
|
||
To change the install prefix from the platform defaults initialize
|
||
the CMake variable, CMAKE_INSTALL_PREFIX. Users of build scripts
|
||
will use the INSTALLDIR option.
|
||
|
||
|
||
========================================================================
|
||
II. Quick Step Building HDF5 Libraries with CMake Script Mode
|
||
========================================================================
|
||
This short set of instructions is written for users who want to quickly
|
||
build the HDF5 C, C++ and Fortran shared libraries and tools
|
||
from the HDF5 source code package using the CMake tools. This procedure
|
||
will use the default settings in the config/cmake/cacheinit.cmake file.
|
||
HDF Group recommends using the ctest script mode to build HDF5.
|
||
|
||
-------------------------------------------------------------------------
|
||
-------------------------------------------------------------------------
|
||
Individual files needed as mentioned in this document
|
||
-------------------------------------------------------------------------
|
||
CMake build script from https://github.com/HDFGroup/hdf5/tree/master/config/cmake/scripts:
|
||
CTestScript.cmake
|
||
|
||
Configuration files from https://github.com/HDFGroup/hdf5/tree/master/config/cmake/scripts:
|
||
HDF5config.cmake
|
||
HDF5options.cmake
|
||
|
||
External compression plugin libraries from https://github.com/HDFGroup/hdf5_plugins:
|
||
hdf5_plugins.tar.gz
|
||
|
||
External compression szip and zlib libraries:
|
||
ZLIB "https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.3.tar.gz"
|
||
LIBAEC "https://github.com/MathisRosenhauer/libaec/releases/download/v1.0.6/libaec-1.0.6.tar.gz"
|
||
-------------------------------------------------------------------------
|
||
-------------------------------------------------------------------------
|
||
|
||
Build scripts for windows or linux
|
||
-----------------------------------------------
|
||
|
||
To build HDF5 with the SZIP and ZLIB external libraries you will need to:
|
||
|
||
1. Change to the development directory "myhdfstuff".
|
||
|
||
2. Download/copy the individual files mentioned above to "myhdfstuff".
|
||
Do not uncompress the tar.gz files.
|
||
|
||
3. Change to the source directory "hdf5-1.15.x".
|
||
CTestScript.cmake file should not be modified.
|
||
|
||
4. Edit the platform configuration file, HDF5options.cmake, if you want to change
|
||
the default build environment. The file is a compilation of the most used
|
||
options and by commenting/uncommenting lines the options can easily be changed.
|
||
|
||
5. From the "myhdfstuff" directory execute the CTest Script with the
|
||
following options:
|
||
|
||
On 32-bit Windows with Visual Studio 2022, execute:
|
||
ctest -S HDF5config.cmake,BUILD_GENERATOR=VS2022 -C Release -VV -O hdf5.log
|
||
On 64-bit Windows with Visual Studio 2022, execute:
|
||
ctest -S HDF5config.cmake,BUILD_GENERATOR=VS202264 -C Release -VV -O hdf5.log
|
||
On 32-bit Windows with Visual Studio 2019, execute:
|
||
ctest -S HDF5config.cmake,BUILD_GENERATOR=VS2019 -C Release -VV -O hdf5.log
|
||
On 64-bit Windows with Visual Studio 2019, execute:
|
||
ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201964 -C Release -VV -O hdf5.log
|
||
On 32-bit Windows with Visual Studio 2017, execute:
|
||
ctest -S HDF5config.cmake,BUILD_GENERATOR=VS2017 -C Release -VV -O hdf5.log
|
||
On 64-bit Windows with Visual Studio 2017, execute:
|
||
ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201764 -C Release -VV -O hdf5.log
|
||
On Linux and Mac, execute:
|
||
ctest -S HDF5config.cmake,BUILD_GENERATOR=Unix -C Release -VV -O hdf5.log
|
||
The supplied build scripts are versions of the above.
|
||
|
||
The command above will configure, build, test, and create an install
|
||
package in the myhdfstuff folder. It will have the format:
|
||
HDF5-1.15.NN-<platform>.<zip or tar.gz>
|
||
|
||
On Unix, <platform> will be "Linux". A similar .sh file will also be created.
|
||
On Windows, <platform> will be "win64" or "win32". If you have an
|
||
installer on your system, you will also see a similar file that ends
|
||
in either .exe (NSIS) or .msi (WiX).
|
||
|
||
Notes on the command line options.
|
||
The -S option uses the script version of ctest.
|
||
|
||
The value for the -C option (as shown above, "-C Release") must
|
||
match the setting for CTEST_CONFIGURATION_TYPE in the platform
|
||
configuration file.
|
||
|
||
The -VV option is for most verbose; use -V for less verbose.
|
||
|
||
The "-O hdf5.log" option saves the output to a log file hdf5.log.
|
||
|
||
6. To install, "X" is the current release version
|
||
|
||
On Windows (with WiX installed), execute:
|
||
HDF5-1.15."X"-win32.msi or HDF5-1.15."X"-win64.msi
|
||
By default this program will install the hdf5 library into the
|
||
"C:\Program Files" directory and will create the following
|
||
directory structure:
|
||
HDF_Group
|
||
--HDF5
|
||
----1.15."X"
|
||
------bin
|
||
------include
|
||
------lib
|
||
------cmake
|
||
|
||
On Linux, change to the install destination directory
|
||
(create it if doesn't exist) and execute:
|
||
<path-to>/myhdfstuff/HDF5-1.15."X"-Linux.sh
|
||
After accepting the license, the script will prompt:
|
||
By default the HDF5 will be installed in:
|
||
"<current directory>/HDF5-1.15."X"-Linux"
|
||
Do you want to include the subdirectory HDF5-1.15."X"-Linux?
|
||
Saying no will install in: "<current directory>" [Yn]:
|
||
Note that the script will create the following directory structure
|
||
relative to the install point:
|
||
HDF_Group
|
||
--HDF5
|
||
----1.15."X"
|
||
------bin
|
||
------include
|
||
------lib
|
||
------share
|
||
|
||
On Mac you will find HDF5-1.15."X"-Darwin.dmg in the myhdfstuff folder. Click
|
||
on the dmg file to proceed with installation. After accepting the license,
|
||
there will be a folder with the following structure:
|
||
HDF_Group
|
||
--HDF5
|
||
----1.15."X"
|
||
------bin
|
||
------include
|
||
------lib
|
||
------share
|
||
|
||
By default the installation will create the bin, include, lib and cmake
|
||
folders in the <install destination directory>/HDF_Group/HDF5/1.15."X"
|
||
The <install destination directory> depends on the build platform;
|
||
Windows will set the default to:
|
||
C:/Program Files/HDF_Group/HDF5/1.15."X"
|
||
Linux will set the default to:
|
||
"myhdfstuff/HDF_Group/HDF5/1.15."X"
|
||
The default can be changed by adding ",INSTALLDIR=<my new dir>" to the
|
||
"ctest -S HDF5config.cmake..." command. For example on linux:
|
||
ctest -S HDF5config.cmake,INSTALLDIR=/usr/local/myhdf5,BUILD_GENERATOR=Unix -C Release -VV -O hdf5.log
|
||
|
||
|
||
========================================================================
|
||
III. Quick Step Building HDF5 C Static Libraries and Tools with CMake
|
||
========================================================================
|
||
Notes: This short set of instructions is written for users who want to
|
||
quickly build just the HDF5 C static library and tools from
|
||
the HDF5 source code package using the CMake command line tools.
|
||
Avoid the use of drive letters in paths on Windows.
|
||
|
||
Go through these steps:
|
||
|
||
1. Change to the development directory "myhdfstuff".
|
||
|
||
2. Uncompress the HDF5 source file
|
||
|
||
3. Create a folder "build" in the "myhdfstuff" directory.
|
||
|
||
4. Change into the "build" folder.
|
||
|
||
5. Configure the C library, tools and tests with one of the following commands:
|
||
|
||
On Windows 32 bit
|
||
cmake -G "Visual Studio 16 2019" -A Win32 -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTING:BOOL=ON -DHDF5_BUILD_TOOLS:BOOL=ON ..\hdf5-1.15."X"
|
||
|
||
On Windows 64 bit
|
||
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTING:BOOL=ON -DHDF5_BUILD_TOOLS:BOOL=ON ..\hdf5-1.15."X"
|
||
|
||
On Linux and Mac
|
||
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTING:BOOL=ON -DHDF5_BUILD_TOOLS:BOOL=ON ../hdf5-1.15."X"
|
||
|
||
where "X" is the current release version.
|
||
|
||
6. Build the C library, tools and tests with this command:
|
||
cmake --build . --config Release
|
||
|
||
7. Test the C library and tools with this command:
|
||
ctest . -C Release
|
||
|
||
8. Create an install image with this command:
|
||
cpack -C Release CPackConfig.cmake
|
||
|
||
9. To install
|
||
On Windows (with WiX installed), execute:
|
||
HDF5-1.15."X"-win32.msi or HDF5-1.15."X"-win64.msi
|
||
By default this program will install the hdf5 library into the
|
||
"C:\Program Files" directory and will create the following
|
||
directory structure:
|
||
HDF_Group
|
||
--HDF5
|
||
----1.15."X"
|
||
------bin
|
||
------include
|
||
------lib
|
||
------cmake
|
||
|
||
On Linux, change to the install destination directory
|
||
(create if doesn't exist) and execute:
|
||
<path-to>/myhdfstuff/build/HDF5-1.15."X"-Linux.sh
|
||
After accepting the license, the script will prompt:
|
||
By default the HDF5 will be installed in:
|
||
"<current directory>/HDF5-1.15."X"-Linux"
|
||
Do you want to include the subdirectory HDF5-1.15."X"-Linux?
|
||
Saying no will install in: "<current directory>" [Yn]:
|
||
Note that the script will create the following directory structure
|
||
relative to the install point:
|
||
HDF_Group
|
||
--HDF5
|
||
----1.15."X"
|
||
------bin
|
||
------include
|
||
------lib
|
||
------share
|
||
|
||
On Mac you will find HDF5-1.15."X"-Darwin.dmg in the build folder. Click
|
||
on the dmg file to proceed with installation. After accepting the license,
|
||
there will be a folder with the following structure:
|
||
HDF_Group
|
||
--HDF5
|
||
----1.15."X"
|
||
------bin
|
||
------include
|
||
------lib
|
||
------share
|
||
|
||
|
||
========================================================================
|
||
IV. Further considerations
|
||
========================================================================
|
||
|
||
1. We suggest you obtain the latest CMake for windows from the Kitware
|
||
web site. The HDF5 1.15."X" product requires a minimum CMake version 3.18.
|
||
If you are using VS2022, the CMake minimum version is 3.21.
|
||
|
||
2. If you plan to use Zlib or Szip:
|
||
A. Download the binary packages and install them in a central location.
|
||
For example on Windows, create a folder extlibs and install the
|
||
packages there. Add the following CMake options:
|
||
-DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib
|
||
-DZLIB_INCLUDE_DIR:PATH=some_location/include
|
||
-DZLIB_USE_EXTERNAL:BOOL=OFF
|
||
-DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib
|
||
-DSZIP_INCLUDE_DIR:PATH=some_location/include
|
||
-DSZIP_USE_EXTERNAL:BOOL=OFF
|
||
where "some_location" is the full path to the extlibs folder.
|
||
Also the appropriate environment variable must be set;
|
||
set(ENV{ZLIB_ROOT} "some_location")
|
||
set(ENV{SZIP_ROOT} "some_location")
|
||
|
||
B. Use source packages from an GIT server by adding the following CMake
|
||
options:
|
||
HDF5_ALLOW_EXTERNAL_SUPPORT:STRING="GIT"
|
||
ZLIB_GIT_URL:STRING="https://some_location/zlib"
|
||
ZLIB_GIT_BRANCH="some_branch"
|
||
SZIP_GIT_URL:STRING="https://some_location/szip"
|
||
SZIP_GIT_BRANCH="some_branch"
|
||
where "some_location" is the URL to the GIT repository and "some_branch" is
|
||
a branch in the repository, usually the default. Also set
|
||
CMAKE_BUILD_TYPE to the configuration type.
|
||
|
||
C. Use source packages from a compressed file by adding the following
|
||
CMake options:
|
||
HDF5_ALLOW_EXTERNAL_SUPPORT:STRING="TGZ"
|
||
ZLIB_TGZ_NAME:STRING="zlib_src.ext"
|
||
LIBAEC_TGZ_NAME:STRING="libaec_src.ext"
|
||
TGZPATH:STRING="some_location"
|
||
where "some_location" is the URL or full path to the compressed
|
||
file and ext is the type of compression file. Also set CMAKE_BUILD_TYPE
|
||
to the configuration type during configuration. See the settings in the
|
||
config/cmake/cacheinit.cmake file HDF uses for testing.
|
||
|
||
D. Use original source packages from a compressed file by adding the following
|
||
CMake options:
|
||
LIBAEC_TGZ_NAME:STRING="szip_src.ext"
|
||
LIBAEC_TGZ_ORIGPATH:STRING="some_location"
|
||
|
||
ZLIB_TGZ_NAME:STRING="zlib_src.ext"
|
||
ZLIB_TGZ_ORIGPATH:STRING="some_location"
|
||
|
||
HDF5_ALLOW_EXTERNAL_SUPPORT:STRING="TGZ"
|
||
where "some_location" is the URL and by setting
|
||
ZLIB_USE_LOCALCONTENT:BOOL=OFF
|
||
LIBAEC_USE_LOCALCONTENT:BOOL=OFF
|
||
or full path to the compressed file and ext is the type of compression file.
|
||
Also set CMAKE_BUILD_TYPE to the configuration type during configuration.
|
||
See the settings in the config/cmake/cacheinit.cmake file HDF uses for testing.
|
||
|
||
The files can also be retrieved from a local path if necessary
|
||
TGZPATH:STRING="some_location"
|
||
by setting
|
||
ZLIB_USE_LOCALCONTENT:BOOL=ON
|
||
LIBAEC_USE_LOCALCONTENT:BOOL=ON
|
||
|
||
3. If you plan to use compression plugins:
|
||
A. Use source packages from an GIT server by adding the following CMake
|
||
options:
|
||
HDF5_ALLOW_EXTERNAL_SUPPORT:STRING="GIT"
|
||
PLUGIN_GIT_URL:STRING="http://some_location/plugins"
|
||
PLUGIN_GIT_BRANCH="some_branch"
|
||
where "some_location" is the URL to the GIT repository and "some_branch" is
|
||
a branch in the repository, usually the default. Also set
|
||
CMAKE_BUILD_TYPE to the configuration type.
|
||
|
||
B. Use source packages from a compressed file by adding the following
|
||
CMake options:
|
||
HDF5_ALLOW_EXTERNAL_SUPPORT:STRING="TGZ"
|
||
PLUGIN_TGZ_NAME:STRING="plugin_src.ext"
|
||
TGZPATH:STRING="some_location"
|
||
where "some_location" is the URL or full path to the compressed
|
||
file and ext is the type of compression file. Also set CMAKE_BUILD_TYPE
|
||
to the configuration type during configuration. See the settings in the
|
||
config/cmake/cacheinit.cmake file HDF uses for testing.
|
||
|
||
4. If you are building on Apple Darwin platforms, you should add the
|
||
following options:
|
||
Compiler choice - use xcode by setting the ENV variables of CC and CXX
|
||
Shared fortran is not supported, build static:
|
||
BUILD_SHARED_LIBS:BOOL=OFF
|
||
Additional options:
|
||
CMAKE_ANSI_CFLAGS:STRING=-fPIC
|
||
CTEST_USE_LAUNCHERS:BOOL=ON
|
||
CMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF
|
||
|
||
5. Windows developers should install NSIS or WiX to create an install image with CPack.
|
||
Visual Studio Express users will not be able to package HDF5 into
|
||
an install image executable.
|
||
|
||
6. Developers can copy the config/cmake/cacheinit.cmake file and alter the
|
||
the settings for the developers' environment. Then the only options needed
|
||
on the command line are those options that are different. Example using HDF
|
||
default cache file:
|
||
cmake -C ../config/cmake/cacheinit.cmake -G "Visual Studio 16 2019" \
|
||
-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF \
|
||
-DCMAKE_BUILD_TYPE:STRING=Release ..
|
||
|
||
7. CMake uses a toolchain of utilities to compile, link libraries and
|
||
create archives, and other tasks to drive the build. The toolchain
|
||
utilities available are determined by the languages enabled. In normal
|
||
builds, CMake automatically determines the toolchain for host builds
|
||
based on system introspection and defaults. In cross-compiling
|
||
scenarios, a toolchain file may be specified with information about
|
||
compiler and utility paths.
|
||
Variables and Properties
|
||
Several variables relate to the language components of a toolchain which
|
||
are enabled. CMAKE_<LANG>_COMPILER is the full path to the compiler used
|
||
for <LANG>. CMAKE_<LANG>_COMPILER_ID is the identifier used by CMake for
|
||
the compiler and CMAKE_<LANG>_COMPILER_VERSION is the version of the compiler.
|
||
|
||
The CMAKE_<LANG>_FLAGS variables and the configuration-specific equivalents
|
||
contain flags that will be added to the compile command when compiling a
|
||
file of a particular language.
|
||
|
||
As the linker is invoked by the compiler driver, CMake needs a way to
|
||
determine which compiler to use to invoke the linker. This is calculated
|
||
by the LANGUAGE of source files in the target, and in the case of static
|
||
libraries, the language of the dependent libraries. The choice CMake makes
|
||
may be overridden with the LINKER_LANGUAGE target property.
|
||
|
||
See the CMake help for more information on using toolchain files.
|
||
|
||
To use a toolchain file with the supplied cmake scripts, see the
|
||
HDF5options.cmake file under the toolchain section.
|
||
|
||
Notes: CMake and HDF5
|
||
|
||
1. Using CMake for building and using HDF5 is under active development.
|
||
While we have attempted to provide error-free files, please
|
||
understand that development with CMake has not been extensively
|
||
tested outside of HDF. The CMake specific files may change
|
||
before the next release.
|
||
|
||
2. CMake support for HDF5 development should be usable on any
|
||
system where CMake is supported. Please send us any comments on
|
||
how CMake support can be improved on any system. Visit the
|
||
KitWare site for more information about CMake.
|
||
|
||
3. Build and test results can be submitted to our CDash server:
|
||
The CDash server for community submissions of hdf5 is at
|
||
https://my.cdash.org.
|
||
|
||
We ask that all submissions include the configuration information and
|
||
contact information in the CTest Notes Files upload step. See the
|
||
current reports on CDash for examples.
|
||
|
||
Please follow the convention that "NIGHTLY" submissions maintain the same
|
||
configuration every time. "EXPERIMENTAL" submissions can be expected to
|
||
be different for each submission.
|
||
|
||
4. See the appendix at the bottom of this file for examples of using
|
||
a ctest script for building and testing. Using a ctest script is
|
||
preferred because of its flexibility.
|
||
|
||
Notes: CMake in General
|
||
|
||
1. More information about using CMake can be found at the KitWare site at
|
||
www.cmake.org.
|
||
|
||
2. CMake uses the command line; however, the visual CMake tool is
|
||
available for the configuration step. The steps are similar for
|
||
all the operating systems supported by CMake.
|
||
|
||
|
||
========================================================================
|
||
V. Options for Building HDF5 Libraries with the CMake Command Line
|
||
========================================================================
|
||
|
||
To build the HDF5 Libraries with CMake, go through these five steps:
|
||
|
||
1. Run CMake
|
||
2. Configure the cache settings
|
||
3. Build HDF5
|
||
4. Test HDF5
|
||
5. Package HDF5 (create install image)
|
||
|
||
These five steps are described in detail below.
|
||
|
||
========================================================================
|
||
|
||
1. Run CMake
|
||
|
||
The visual CMake executable is named "cmake-gui.exe" on Windows and should be
|
||
available in your Start menu. For Linux, UNIX, and Mac users the
|
||
executable is named "cmake-gui" and can be found where CMake was
|
||
installed.
|
||
|
||
Specify the source and build directories.
|
||
|
||
***** Make the build and source directories different. ******
|
||
|
||
For example on Windows, if the source is at c:\MyHDFstuff\hdf5,
|
||
then use c:\MyHDFstuff\hdf5\build or c:\MyHDFstuff\build\hdf5 as the
|
||
build directory.
|
||
|
||
RECOMMENDED:
|
||
Users can perform the configuration step without using the visual
|
||
cmake-gui program. We use the file cacheinit.cmake in the
|
||
config/cmake source folder for our testing. This file enables all of the
|
||
basic options and we turn specific options on or off for testing
|
||
using the following command line within the build directory:
|
||
|
||
cmake -C <sourcepath>/config/cmake/cacheinit.cmake -G "<generator>" [-D<options>] <sourcepath>
|
||
|
||
Where <generator> is
|
||
* MinGW Makefiles
|
||
* NMake Makefiles
|
||
* Unix Makefiles
|
||
* Visual Studio 14 2015
|
||
* Visual Studio 14 2015 Win64
|
||
* Visual Studio 15 2017
|
||
* Visual Studio 15 2017 Win64
|
||
* Visual Studio 16 2019
|
||
* Visual Studio 17 2022
|
||
|
||
<options> is:
|
||
* SZIP_INCLUDE_DIR:PATH=<path to szip includes directory>
|
||
* SZIP_LIBRARY:FILEPATH=<path to szip/library file>
|
||
* ZLIB_INCLUDE_DIR:PATH=<path to zlib includes directory>
|
||
* ZLIB_LIBRARY:FILEPATH=<path to zlib/library file>
|
||
* <HDF5OPTION>:BOOL=[ON | OFF]
|
||
|
||
<cacheinit.cmake> is:
|
||
# This is the CMakeCache file used by HDF Group for daily tests.
|
||
set (CMAKE_INSTALL_FRAMEWORK_PREFIX "Library/Frameworks" CACHE STRING "Frameworks installation directory" FORCE)
|
||
set (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE)
|
||
set (HDF_PACKAGE_NAMESPACE "hdf5::" CACHE STRING "Name for HDF package namespace (can be empty)" FORCE)
|
||
set (HDF5_BUILD_CPP_LIB ON CACHE BOOL "Build C++ support" FORCE)
|
||
set (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE)
|
||
set (HDF5_BUILD_JAVA ON CACHE BOOL "Build JAVA 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 (MPIEXEC_MAX_NUMPROCS "4" CACHE STRING "Minimum number of processes for HDF parallel tests" FORCE)
|
||
set (HDF5_ENABLE_ALL_WARNINGS ON CACHE BOOL "Enable all warnings" FORCE)
|
||
set (HDF_TEST_EXPRESS "2" CACHE STRING "Control testing framework (0-3)" FORCE)
|
||
set (HDF5_MINGW_STATIC_GCC_LIBS ON CACHE BOOL "Statically link libgcc/libstdc++" FORCE)
|
||
set (HDF5_ALLOW_EXTERNAL_SUPPORT "TGZ" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE)
|
||
set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO GIT TGZ)
|
||
########################
|
||
# compression options
|
||
########################
|
||
set (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE)
|
||
set (ZLIB_TGZ_NAME "zlib-1.3.tar.gz" CACHE STRING "Use HDF5_ZLib from compressed file" FORCE)
|
||
set (ZLIB_TGZ_ORIGPATH "https://github.com/madler/zlib/releases/download/v1.3" CACHE STRING "Use ZLIB from original location" FORCE)
|
||
set (ZLIB_USE_LOCALCONTENT ON CACHE BOOL "Use local file for ZLIB FetchContent" FORCE)
|
||
set (ZLIB_GIT_URL "https://github.com/madler/zlib.git" CACHE STRING "Use ZLIB from GitHub repository" FORCE)
|
||
set (ZLIB_GIT_BRANCH "develop" CACHE STRING "" FORCE)
|
||
set (LIBAEC_PACKAGE_NAME "libaec" CACHE STRING "Name of AEC SZIP package" FORCE)
|
||
set (LIBAEC_TGZ_NAME "libaec-1.0.6.tar.gz" CACHE STRING "Use SZip AEC from compressed file" FORCE)
|
||
set (LIBAEC_TGZ_ORIGPATH "https://github.com/MathisRosenhauer/libaec/releases/download/v1.0.6" CACHE STRING "Use LIBAEC from original location" FORCE)
|
||
set (LIBAEC_USE_LOCALCONTENT ON CACHE BOOL "Use local file for LIBAEC FetchContent" FORCE)
|
||
set (LIBAEC_GIT_URL "https://github.com/MathisRosenhauer/libaec.git" CACHE STRING "Use LIBAEC from GitHub repository" FORCE)
|
||
set (LIBAEC_GIT_BRANCH "v1.0.6" CACHE STRING "" FORCE)
|
||
########################
|
||
# API test options
|
||
########################
|
||
set (KWSYS_TGZ_ORIGPATH "https://gitlab.kitware.com/utils/kwsys/-/archive/master" CACHE STRING "Use KWSYS from original location" FORCE)
|
||
set (KWSYS_TGZ_NAME "kwsys-master.tar.gz" CACHE STRING "Use KWSYS from original compressed file" FORCE)
|
||
set (KWSYS_USE_LOCALCONTENT OFF CACHE BOOL "Use local file for KWSYS FetchContent" FORCE)
|
||
########################
|
||
# filter plugin options
|
||
########################
|
||
set (PLUGIN_TGZ_ORIGPATH "https://github.com/HDFGroup/hdf5_plugins/releases/download/snapshots" CACHE STRING "Use PLUGINS from original location" FORCE)
|
||
set (PLUGIN_TGZ_NAME "hdf5_plugins-master.tar.gz" CACHE STRING "Use PLUGINS from compressed file" FORCE)
|
||
set (PLUGIN_USE_LOCALCONTENT ON CACHE BOOL "Use local file for PLUGIN FetchContent" FORCE)
|
||
set (PLUGIN_PACKAGE_NAME "pl" CACHE STRING "Name of PLUGIN package" FORCE)
|
||
set (PLUGIN_GIT_URL "https://github.com/HDFGroup/hdf5_plugins.git" CACHE STRING "Use plugins from HDF Group repository" FORCE)
|
||
set (PLUGIN_GIT_BRANCH "master" CACHE STRING "" FORCE)
|
||
#############
|
||
# bitshuffle
|
||
#############
|
||
set (BSHUF_GIT_URL "https://github.com/kiyo-masui/bitshuffle.git" CACHE STRING "Use BSHUF from HDF repository" FORCE)
|
||
set (BSHUF_GIT_BRANCH "master" CACHE STRING "" FORCE)
|
||
set (BSHUF_TGZ_ORIGPATH "https://github.com/kiyo-masui/bitshuffle/archive/refs/tags" CACHE STRING "Use PLUGINS from original location" FORCE)
|
||
set (BSHUF_TGZ_NAME "bitshuffle-0.5.1.tar.gz" CACHE STRING "Use BSHUF from compressed file" FORCE)
|
||
set (BSHUF_PACKAGE_NAME "bshuf" CACHE STRING "Name of BSHUF package" FORCE)
|
||
########
|
||
# blosc
|
||
########
|
||
set (BLOSC_GIT_URL "https://github.com/Blosc/c-blosc.git" CACHE STRING "Use BLOSC from Github repository" FORCE)
|
||
set (BLOSC_GIT_BRANCH "main" CACHE STRING "" FORCE)
|
||
set (BLOSC_TGZ_ORIGPATH "https://github.com/Blosc/c-blosc/archive/refs/tags" CACHE STRING "Use PLUGINS from original location" FORCE)
|
||
set (BLOSC_TGZ_NAME "c-blosc-1.21.5.tar.gz" CACHE STRING "Use BLOSC from compressed file" FORCE)
|
||
set (BLOSC_PACKAGE_NAME "blosc" CACHE STRING "Name of BLOSC package" FORCE)
|
||
set (BLOSC_ZLIB_GIT_URL "https://github.com/madler/zlib.git" CACHE STRING "Use ZLIB from GitHub repository" FORCE)
|
||
set (BLOSC_ZLIB_GIT_BRANCH "develop" CACHE STRING "" FORCE)
|
||
set (BLOSC_ZLIB_TGZ_ORIGPATH "https://github.com/madler/zlib/releases/download/v1.3" CACHE STRING "Use PLUGINS from original location" FORCE)
|
||
set (BLOSC_ZLIB_TGZ_NAME "zlib-1.3.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE)
|
||
set (BLOSC_ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of BLOSC_ZLIB package" FORCE)
|
||
########
|
||
# bzip2
|
||
########
|
||
set (BZ2_GIT_URL "https://github.com/libarchive/bzip2.git" CACHE STRING "Use BZ2 from GitHub repository" FORCE)
|
||
set (BZ2_GIT_BRANCH "bzip2-1.0.8" CACHE STRING "" FORCE)
|
||
set (BZ2_TGZ_ORIGPATH "https://github.com/libarchive/bzip2/archive/refs/tags" CACHE STRING "Use PLUGINS from original location" FORCE)
|
||
set (BZ2_TGZ_NAME "bzip2-bzip2-1.0.8.tar.gz" CACHE STRING "Use BZ2 from compressed file" FORCE)
|
||
set (BZ2_PACKAGE_NAME "bz2" CACHE STRING "Name of BZ2 package" FORCE)
|
||
########
|
||
# fpzip
|
||
########
|
||
set (FPZIP_GIT_URL "https://github.com/LLNL/fpzip.git" CACHE STRING "Use FPZIP from GitHub repository" FORCE)
|
||
set (FPZIP_GIT_BRANCH "develop" CACHE STRING "" FORCE)
|
||
set (FPZIP_TGZ_ORIGPATH "https://github.com/LLNL/fpzip/releases/download/1.3.0" CACHE STRING "Use PLUGINS from original location" FORCE)
|
||
set (FPZIP_TGZ_NAME "fpzip-1.3.0.tar.gz" CACHE STRING "Use FPZIP from compressed file" FORCE)
|
||
set (FPZIP_PACKAGE_NAME "fpzip" CACHE STRING "Name of FPZIP package" FORCE)
|
||
#######
|
||
# jpeg
|
||
#######
|
||
set (JPEG_GIT_URL "https://github.com/libjpeg-turbo/libjpeg-turbo.git" CACHE STRING "Use JPEG from TurboJPEG" FORCE)
|
||
set (JPEG_GIT_BRANCH "jpeg-9e" CACHE STRING "" FORCE)
|
||
set (JPEG_TGZ_ORIGPATH "https://www.ijg.org/files" CACHE STRING "Use PLUGINS from original location" FORCE)
|
||
set (JPEG_TGZ_NAME "jpegsrc.v9e.tar.gz" CACHE STRING "Use JPEG from compressed file" FORCE)
|
||
set (JPEG_PACKAGE_NAME "jpeg" CACHE STRING "Name of JPEG package" FORCE)
|
||
######
|
||
# lz4
|
||
######
|
||
set (BUILD_LZ4_LIBRARY_SOURCE ON CACHE BOOL "build the lz4 library within the plugin" FORCE)
|
||
set (LZ4_GIT_URL "https://github.com/lz4/lz4.git" CACHE STRING "Use LZ4 from GitHub repository" FORCE)
|
||
set (LZ4_GIT_BRANCH "dev" CACHE STRING "" FORCE)
|
||
set (LZ4_TGZ_ORIGPATH "https://github.com/lz4/lz4/releases/download/v1.9.4" CACHE STRING "Use PLUGINS from original location" FORCE)
|
||
set (LZ4_TGZ_NAME "lz4-1.9.4.tar.gz" CACHE STRING "Use LZ4 from compressed file" FORCE)
|
||
set (LZ4_PACKAGE_NAME "lz4" CACHE STRING "Name of LZ4 package" FORCE)
|
||
######
|
||
# lzf
|
||
######
|
||
set (LZF_URL "http://software.schmorp.de/pkg/liblzf.html" CACHE STRING "LZF home" FORCE)
|
||
set (LZF_TGZ_ORIGPATH "http://dist.schmorp.de/liblzf" CACHE STRING "Use LZF from original location" FORCE)
|
||
set (LZF_TGZ_NAME "liblzf-3.6.tar.gz" CACHE STRING "Use LZF from compressed file" FORCE)
|
||
set (LZF_PACKAGE_NAME "lzf" CACHE STRING "Name of LZF package" FORCE)
|
||
#########
|
||
# mafisc
|
||
#########
|
||
#set (BUILD_MAFISC_LIBRARY_SOURCE OFF CACHE BOOL "build the mafisc library within the plugin" FORCE)
|
||
#set (MAFISC_TGZ_ORIGPATH "" CACHE STRING "Use PLUGINS from original location" FORCE)
|
||
#set (MAFISC_TGZ_NAME ".tar.gz" CACHE STRING "Use MAFISC from compressed file" FORCE)
|
||
#set (MAFISC_PACKAGE_NAME "mafisc" CACHE STRING "Name of MAFISC package" FORCE)
|
||
#####
|
||
# sz
|
||
#####
|
||
set (SZ_GIT_URL "https://github.com/szcompressor/SZ.git" CACHE STRING "Use SZ filter from GitHub repository" FORCE)
|
||
set (SZ_GIT_BRANCH "master" CACHE STRING "" FORCE)
|
||
set (SZ_TGZ_ORIGPATH "https://github.com/szcompressor/SZ/releases/download/v2.1.12.5" CACHE STRING "Use PLUGINS from original location" FORCE)
|
||
set (SZ_TGZ_NAME "SZ-2.1.12.5.tar.gz" CACHE STRING "Use SZ filter from compressed file" FORCE)
|
||
set (SZ_PACKAGE_NAME "SZ" CACHE STRING "Name of SZ filter package" FORCE)
|
||
######
|
||
# zfp
|
||
######
|
||
set (ZFP_GIT_URL "https://github.com/LLNL/zfp.git" CACHE STRING "Use ZFP from GitHub repository" FORCE)
|
||
set (ZFP_GIT_BRANCH "develop" CACHE STRING "" FORCE)
|
||
set (ZFP_TGZ_ORIGPATH "https://github.com/LLNL/zfp/releases/download/1.0.0" CACHE STRING "Use PLUGINS from original location" FORCE)
|
||
set (ZFP_TGZ_NAME "zfp-1.0.0.tar.gz" CACHE STRING "Use ZFP from compressed file" FORCE)
|
||
set (ZFP_PACKAGE_NAME "zfp" CACHE STRING "Name of ZFP package" FORCE)
|
||
######
|
||
# zstd
|
||
######
|
||
set (ZSTD_GIT_URL "https://github.com/facebook/zstd.git" CACHE STRING "Use ZSTD from GitHub repository" FORCE)
|
||
set (ZSTD_GIT_BRANCH "dev" CACHE STRING "" FORCE)
|
||
set (ZSTD_TGZ_ORIGPATH "https://github.com/facebook/zstd/releases/download/v1.5.5" CACHE STRING "Use PLUGINS from original location" FORCE)
|
||
set (ZSTD_TGZ_NAME "zstd-1.5.5.tar.gz" CACHE STRING "Use ZSTD from compressed file" FORCE)
|
||
set (ZSTD_PACKAGE_NAME "zstd" CACHE STRING "Name of ZSTD package" FORCE)
|
||
|
||
2. Configure the cache settings
|
||
|
||
2.1 Visual CMake users, click the Configure button. If this is the first time you are
|
||
running cmake-gui in this directory, you will be prompted for the
|
||
generator you wish to use (for example on Windows, Visual Studio 12).
|
||
CMake will read in the CMakeLists.txt files from the source directory and
|
||
display options for the HDF5 project. After the first configure you
|
||
can adjust the cache settings and/or specify the locations of other programs.
|
||
|
||
Any conflicts or new values will be highlighted by the configure
|
||
process in red. Once you are happy with all the settings and there are no
|
||
more values in red, click the Generate button to produce the appropriate
|
||
build files.
|
||
|
||
On Windows, if you are using a Visual Studio generator, the solution and
|
||
project files will be created in the build folder.
|
||
|
||
On linux, if you are using the Unix Makefiles generator, the Makefiles will
|
||
be created in the build folder.
|
||
|
||
2.2 Preferred command line example on Windows in c:\MyHDFstuff\hdf5\build directory:
|
||
|
||
cmake -C ../config/cmake/cacheinit.cmake -G "Visual Studio 16 2019" "-Ax64" \
|
||
-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF \
|
||
-DCMAKE_BUILD_TYPE:STRING=Release ..
|
||
|
||
2.3 On Windows, if you are using a Visual Studio Express version you must
|
||
be sure that the following two options are correctly set/unset:
|
||
|
||
HDF5_NO_PACKAGES:BOOL=ON
|
||
HDF5_USE_FOLDERS:BOOL=OFF
|
||
|
||
3. Build HDF5
|
||
|
||
On Windows, you can build HDF5 using either the Visual Studio Environment
|
||
or the command line. The command line can be used on all platforms;
|
||
Windows, linux, Unix, and Mac.
|
||
|
||
To build from the command line, navigate to your build directory and
|
||
execute the following:
|
||
|
||
cmake --build . --config {Debug | Release}
|
||
|
||
NOTE: "--config {Debug | Release}" may be optional on your platform. We
|
||
recommend choosing either Debug or Release on Windows.
|
||
|
||
3.1 If you wish to use the Visual Studio environment, open the solution
|
||
file in your build directory. Be sure to select either Debug or
|
||
Release and build the solution.
|
||
|
||
3.2.1 The external libraries (zlib, szip and plugins) can be configured
|
||
to allow building the libraries by downloading from a GIT repository.
|
||
The option is 'HDF5_ALLOW_EXTERNAL_SUPPORT'; by adding the following
|
||
configuration option:
|
||
-DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING="GIT"
|
||
|
||
The options to control the GIT parameters (config/cmake/cacheinit.cmake file) are:
|
||
ZLIB_GIT_URL:STRING="https://${git_url}/zlib"
|
||
ZLIB_GIT_BRANCH="${git_branch}"
|
||
SZIP_GIT_URL:STRING="https://${git_url}/szip"
|
||
SZIP_GIT_BRANCH="${git_branch}"
|
||
PLUGIN_GIT_URL:STRING="https://${git_url}/plugin"
|
||
PLUGIN_GIT_BRANCH="${git_branch}"
|
||
${git_url} should be changed to your location and ${git_branch} is
|
||
your branch in the repository. Also define CMAKE_BUILD_TYPE
|
||
to be the configuration type.
|
||
|
||
3.2.2 Or the external libraries (zlib, szip and plugins) can be configured
|
||
to allow building the libraries by using a compressed file.
|
||
The option is 'HDF5_ALLOW_EXTERNAL_SUPPORT' and is enabled by
|
||
adding the following configuration option:
|
||
-DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING="TGZ"
|
||
|
||
The options to control the TGZ URL (config/cmake/cacheinit.cmake
|
||
file) are:
|
||
ZLIB_TGZ_NAME:STRING="zlib_src.ext"
|
||
LIBAEC_TGZ_NAME:STRING="libaec_src.ext"
|
||
PLUGIN_TGZ_NAME:STRING="plugin_src.ext"
|
||
TGZPATH:STRING="some_location"
|
||
where "some_location/xxxx_src.ext" is the URL or full path to
|
||
the compressed file and where ext is the type of the compression
|
||
file such as .bz2, .tar, .tar.gz, .tgz, or .zip. Also define
|
||
CMAKE_BUILD_TYPE to be the configuration type.
|
||
|
||
NOTE: the file named by LIBAEC_TGZ_NAME is used to build SZIP.
|
||
|
||
4. Test HDF5
|
||
|
||
To test the build, navigate to your build directory and execute:
|
||
|
||
ctest . -C {Debug | Release}
|
||
|
||
NOTE: "-C {Debug | Release}" may be optional on your platform. We
|
||
recommend choosing either Debug or Release to match the build
|
||
step on Windows.
|
||
|
||
5. Packaging HDF5 (create an install image)
|
||
|
||
To package the build into a simple installer using WiX toolset or the NullSoft installer NSIS
|
||
on Windows, or into compressed files (.tar.gz, .sh, .zip), use the CPack tool.
|
||
|
||
To package the build, navigate to your build directory and execute;
|
||
|
||
cpack -C {Debug | Release} CPackConfig.cmake
|
||
|
||
NOTE: See note 8 of this document for NSIS information.
|
||
See note 9 of this document for WiX information.
|
||
Also, if you are using a Visual Studio Express version or
|
||
want to disable the packaging components, set HDF5_NO_PACKAGES
|
||
to ON (on the command line add -DHDF5_NO_PACKAGES:BOOL=ON)
|
||
|
||
6. The files that support building HDF5 with CMake are all the files in the
|
||
config/cmake folder, the CMakeLists.txt files in each source folder, and
|
||
CTestConfig.cmake. CTestConfig.cmake is specific to the internal testing
|
||
performed by The HDF Group. It should be altered for the user's
|
||
installation and needs. The cacheinit.cmake file settings are used by
|
||
The HDF Group for daily testing. It should be altered/ignored for the user's
|
||
installation and needs.
|
||
|
||
7. More information about using CMake can be found at the KitWare site,
|
||
www.cmake.org.
|
||
|
||
8. Nullsoft Scriptable Install System
|
||
The Nullsoft Scriptable Install System (NSIS) is an open source installation
|
||
system. It was created by the WinAmp authors to distribute that application,
|
||
but it is now a general-purpose system which anyone might use. NSIS installers
|
||
recognize /S for silent installation and /D=dir to specify the
|
||
"output directory", which is where the program will be installed. These
|
||
options are case-sensitive, so be sure to type them in upper case.
|
||
|
||
9. WiX Toolset
|
||
WiX--the Windows Installer XML toolset--lets developers create installers for
|
||
Windows Installer, the Windows installation engine. See http://wixtoolset.org.
|
||
|
||
|
||
========================================================================
|
||
VI. CMake Option Defaults for HDF5
|
||
========================================================================
|
||
|
||
In the options listed below, there are three columns of information:
|
||
Option Name, Option Description, and Option Default.
|
||
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
|
||
if (WINDOWS)
|
||
DISABLE_PDB_FILES "Do not install PDB files" OFF
|
||
|
||
---------------- HDF5 Build Options ----------------------------------------
|
||
HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" OFF
|
||
HDF5_BUILD_EXAMPLES "Build HDF5 Library Examples" ON
|
||
HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF
|
||
HDF5_BUILD_JAVA "Build JAVA support" OFF
|
||
HDF5_BUILD_HL_LIB "Build HIGH Level HDF5 Library" ON
|
||
HDF5_BUILD_TOOLS "Build HDF5 Tools" ON
|
||
HDF5_BUILD_HL_GIF_TOOLS "Build HIGH Level HDF5 GIF Tools" OFF
|
||
HDF5_BUILD_PARALLEL_TOOLS "Build Parallel HDF5 Tools" OFF
|
||
HDF5_BUILD_STATIC_TOOLS "Build Static Tools Not Shared Tools" OFF
|
||
|
||
---------------- HDF5 Folder Build Options ---------------------------------
|
||
Defaults relative to $<INSTALL_PREFIX>
|
||
HDF5_INSTALL_BIN_DIR "bin"
|
||
HDF5_INSTALL_LIB_DIR "lib"
|
||
HDF5_INSTALL_INCLUDE_DIR "include"
|
||
HDF5_INSTALL_MODULE_DIR "mod"
|
||
HDF5_INSTALL_CMAKE_DIR "cmake"
|
||
if (MSVC)
|
||
HDF5_INSTALL_DATA_DIR "."
|
||
else ()
|
||
HDF5_INSTALL_DATA_DIR "share"
|
||
HDF5_INSTALL_DOC_DIR "HDF5_INSTALL_DATA_DIR"
|
||
|
||
HDF5_USE_GNU_DIRS "ON to use GNU Coding Standard install directory variables,
|
||
OFF to use historical settings" OFF
|
||
Defaults as defined by the `GNU Coding Standards`
|
||
HDF5_INSTALL_BIN_DIR "bin"
|
||
HDF5_INSTALL_LIB_DIR "lib"
|
||
HDF5_INSTALL_INCLUDE_DIR "include"
|
||
HDF5_INSTALL_MODULE_DIR "HDF5_INSTALL_INCLUDE_DIR/mod"
|
||
HDF5_INSTALL_CMAKE_DIR "HDF5_INSTALL_LIB_DIR/cmake"
|
||
HDF5_INSTALL_DATA_DIR "share"
|
||
HDF5_INSTALL_DOC_DIR "HDF5_INSTALL_DATA_DIR/doc/hdf5"
|
||
|
||
---------------- HDF5 Advanced Options ---------------------
|
||
ONLY_SHARED_LIBS "Only Build Shared Libraries" OFF
|
||
ALLOW_UNSUPPORTED "Allow unsupported combinations of configure options" OFF
|
||
HDF5_ENABLE_PARALLEL "Enable parallel build (requires MPI)" OFF
|
||
HDF5_ENABLE_THREADSAFE "Enable Threadsafety" OFF
|
||
HDF5_DIMENSION_SCALES_NEW_REF "Use new-style references with dimension scale APIs" OFF
|
||
HDF5_EXTERNAL_LIB_PREFIX "Use prefix for custom library naming." ""
|
||
|
||
HDF5_DISABLE_COMPILER_WARNINGS "Disable compiler warnings" OFF
|
||
HDF5_ENABLE_ALL_WARNINGS "Enable all warnings" OFF
|
||
HDF5_SHOW_ALL_WARNINGS "Show all warnings (i.e. not suppress "noisy" ones internally)" OFF
|
||
HDF5_ENABLE_CODESTACK "Enable the function stack tracing (for developer debugging)." OFF
|
||
HDF5_ENABLE_COVERAGE "Enable code coverage for Libraries and Programs" OFF
|
||
HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF
|
||
HDF5_ENABLE_DEPRECATED_SYMBOLS "Enable deprecated public API symbols" ON
|
||
HDF5_ENABLE_EMBEDDED_LIBINFO "embed library info into executables" ON
|
||
HDF5_ENABLE_PREADWRITE "Use pread/pwrite in sec2/log/core VFDs in place of read/write (when available)" ON
|
||
HDF5_ENABLE_TRACE "Enable API tracing capability" OFF
|
||
HDF5_ENABLE_USING_MEMCHECKER "Indicate that a memory checker is used" OFF
|
||
HDF5_ENABLE_MAP_API "Build the map API" OFF
|
||
HDF5_GENERATE_HEADERS "Rebuild Generated Files" ON
|
||
HDF5_BUILD_GENERATORS "Build Test Generators" OFF
|
||
|
||
HDF5_JAVA_PACK_JRE "Package a JRE installer directory" OFF
|
||
HDF5_NO_PACKAGES "Do not include CPack Packaging" OFF
|
||
HDF5_PACK_EXAMPLES "Package the HDF5 Library Examples Compressed File" OFF
|
||
HDF5_PACK_MACOSX_FRAMEWORK "Package the HDF5 Library in a Frameworks" OFF
|
||
HDF5_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries,
|
||
FALSE to build according to BUILD_SHARED_LIBS" FALSE
|
||
HDF5_PACKAGE_EXTLIBS "CPACK - include external libraries" OFF
|
||
HDF5_STRICT_FORMAT_CHECKS "Whether to perform strict file format checks" OFF
|
||
HDF5_WANT_DATA_ACCURACY "IF data accuracy is guaranteed during data conversions" ON
|
||
HDF5_WANT_DCONV_EXCEPTION "exception handling functions is checked during data conversions" ON
|
||
|
||
DEFAULT_API_VERSION "Enable default API (v16, v18, v110, v112, v114, v116)" "v116"
|
||
HDF5_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON
|
||
HDF5_MSVC_NAMING_CONVENTION "Use MSVC Naming conventions for Shared Libraries" OFF
|
||
HDF5_MINGW_STATIC_GCC_LIBS "Statically link libgcc/libstdc++" OFF
|
||
if (APPLE)
|
||
HDF5_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path" OFF
|
||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||
HDF5_ENABLE_INSTRUMENT "Instrument The library" OFF
|
||
if (HDF5_BUILD_FORTRAN)
|
||
HDF5_INSTALL_MOD_FORTRAN "Copy FORTRAN mod files to include directory (NO SHARED STATIC)" SHARED
|
||
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
|
||
|
||
HDF5_ENABLE_ANALYZER_TOOLS "enable the use of Clang tools" OFF
|
||
HDF5_ENABLE_SANITIZERS "execute the Clang sanitizer" OFF
|
||
HDF5_ENABLE_FORMATTERS "format source files" OFF
|
||
HDF5_BUILD_DOC "Build documentation" OFF
|
||
HDF5_ENABLE_DOXY_WARNINGS "Enable fail if doxygen parsing has warnings." OFF
|
||
|
||
---------------- HDF5 VFD Options ---------------------
|
||
HDF5_ENABLE_DIRECT_VFD "Build the Direct I/O Virtual File Driver" OFF
|
||
HDF5_ENABLE_MIRROR_VFD "Build the Mirror Virtual File Driver" OFF
|
||
HDF5_ENABLE_ROS3_VFD "Build the ROS3 Virtual File Driver" OFF
|
||
HDF5_ENABLE_HDFS "Enable HDFS" OFF
|
||
HDF5_ENABLE_SUBFILING_VFD "Build Parallel HDF5 Subfiling VFD" OFF
|
||
|
||
---------------- HDF5 Advanced Test Options ---------------------
|
||
if (BUILD_TESTING)
|
||
HDF5_TEST_SERIAL "Execute non-parallel tests" ON
|
||
HDF5_TEST_TOOLS "Execute tools tests" ON
|
||
HDF5_TEST_EXAMPLES "Execute tests on examples" ON
|
||
HDF5_TEST_SWMR "Execute SWMR tests" ON
|
||
HDF5_TEST_PARALLEL "Execute parallel tests" ON
|
||
HDF5_TEST_FORTRAN "Execute fortran tests" ON
|
||
HDF5_TEST_CPP "Execute cpp tests" ON
|
||
HDF5_TEST_JAVA "Execute java tests" ON
|
||
HDF_TEST_EXPRESS "Control testing framework (0-3)" "3"
|
||
HDF5_TEST_PASSTHROUGH_VOL "Execute tests with different passthrough VOL connectors" OFF
|
||
if (HDF5_TEST_PASSTHROUGH_VOL)
|
||
HDF5_TEST_FHEAP_PASSTHROUGH_VOL "Execute fheap test with different passthrough VOL connectors" ON
|
||
HDF5_TEST_VFD "Execute tests with different VFDs" OFF
|
||
if (HDF5_TEST_VFD)
|
||
HDF5_TEST_FHEAP_VFD "Execute fheap test with different VFDs" ON
|
||
TEST_SHELL_SCRIPTS "Enable shell script tests" ON
|
||
HDF5_DISABLE_TESTS_REGEX "Regex pattern to set execution of specific tests to DISABLED" ""
|
||
HDF5_USING_ANALYSIS_TOOL "Indicate that an analysis checker is used" ON
|
||
---------------- External Library Options ---------------------
|
||
HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO GIT TGZ)" "NO"
|
||
HDF5_ENABLE_PLUGIN_SUPPORT "Enable PLUGIN Filters" OFF
|
||
HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF
|
||
HDF5_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" ON
|
||
|
||
ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" OFF
|
||
ZLIB_TGZ_ORIGPATH "Use ZLIB from original location" "https://github.com/madler/zlib/releases/download/v1.2.13"
|
||
ZLIB_TGZ_NAME "Use ZLIB from original compressed file" "zlib-1.2.13.tar.gz"
|
||
ZLIB_USE_LOCALCONTENT "Use local file for ZLIB FetchContent" ON
|
||
|
||
SZIP_USE_EXTERNAL "Use External Library Building for SZIP" OFF
|
||
if (HDF5_ENABLE_SZIP_SUPPORT)
|
||
HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" ON
|
||
LIBAEC_TGZ_ORIGPATH "Use LIBAEC from original location" "https://github.com/MathisRosenhauer/libaec/releases/download/v1.0.6"
|
||
LIBAEC_TGZ_NAME "Use LIBAEC from original compressed file" "libaec-1.0.6.tar.gz"
|
||
LIBAEC_USE_LOCALCONTENT "Use local file for LIBAEC FetchContent" ON
|
||
|
||
PLUGIN_USE_EXTERNAL "Use External Library Building for PLUGINS" OFF
|
||
if (WINDOWS)
|
||
H5_DEFAULT_PLUGINDIR "%ALLUSERSPROFILE%/hdf5/lib/plugin"
|
||
else ()
|
||
H5_DEFAULT_PLUGINDIR "/usr/local/hdf5/lib/plugin"
|
||
endif ()
|
||
|
||
NOTE:
|
||
The BUILD_STATIC_EXECS ("Build Static Executables") option is only valid
|
||
on some unix operating systems. It adds the "-static" flag to cflags. This
|
||
flag is not available on windows and some modern linux systems will
|
||
ignore the flag.
|
||
|
||
NOTE:
|
||
The HDF5_USE_GNU_DIRS option is usually recommended for linux platforms, but may
|
||
be useful on other platforms. See the CMake documentation for more details.
|
||
|
||
---------------- Unsupported Library Options ---------------------
|
||
The threadsafe, C++ and Java interfaces are not compatible
|
||
with the HDF5_ENABLE_PARALLEL option.
|
||
Unless ALLOW_UNSUPPORTED has been specified,
|
||
the following options must be disabled:
|
||
HDF5_ENABLE_THREADSAFE, HDF5_BUILD_CPP_LIB, HDF5_BUILD_JAVA
|
||
|
||
The high-level, C++, Fortran and Java interfaces are not compatible
|
||
with the HDF5_ENABLE_THREADSAFE option because the lock is not hoisted
|
||
into the higher-level API calls.
|
||
Unless ALLOW_UNSUPPORTED has been specified,
|
||
the following options must be disabled:
|
||
HDF5_BUILD_HL_LIB, HDF5_BUILD_CPP_LIB, HDF5_BUILD_FORTRAN, HDF5_BUILD_JAVA
|
||
|
||
|
||
========================================================================
|
||
VII. User Defined Options for HDF5 Libraries with CMake
|
||
========================================================================
|
||
|
||
Support for User Defined macros and options has been added. The file
|
||
UserMacros.cmake has an example of the technique.
|
||
|
||
Replace the template code with your macro in the UserMacros.cmake file.
|
||
Then enable the option to the CMake configuration, build and test process.
|
||
|
||
|
||
========================================================================
|
||
VIII. User Defined Compile Flags for HDF5 Libraries with CMake
|
||
========================================================================
|
||
|
||
Custom compiler flags can be added by defining the CMAKE_C_FLAGS and
|
||
CMAKE_CXX_FLAGS variables.
|
||
Using a cmake script:
|
||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
|
||
Defined on the configure line:
|
||
cmake -G "Visual Studio 12 2013" -DCMAKE_C_FLAGS:STRING=-O2 ..
|
||
|
||
Debug symbols are enabled with configuration selections Debug or RelWithDebInfo.
|
||
The difference between Debug and RelWithDebInfo configurations is that
|
||
RelWithDebInfo optimizes the code similar to Release. It produces fully optimized
|
||
code, but also creates the symbol table and the debug metadata to give the
|
||
debugger input to map the execution back to the original code.
|
||
RelwithDebInfo configuration should not affect the performance when the code
|
||
is run without a debugger attached.
|
||
|
||
The HDF5_ENABLE_COVERAGE option will add "-g -O0 -fprofile-arcs -ftest-coverage"
|
||
to CMAKE_C_FLAGS.
|
||
|
||
|
||
========================================================================
|
||
IX: Considerations for cross-compiling
|
||
========================================================================
|
||
|
||
Cross-compiling has several consequences for CMake:
|
||
CMake cannot automatically detect the target platform.
|
||
CMake cannot find libraries and headers in the default system directories.
|
||
Executables built during cross compiling cannot be executed.
|
||
|
||
Cross-compiling support means that CMake separates information about the
|
||
build platform and target platform and gives the user mechanisms to solve
|
||
cross-compiling issues without additional requirements such as running
|
||
virtual machines, etc.
|
||
|
||
CMake uses a toolchain of utilities to compile, link libraries and create
|
||
archives, and other tasks to drive the build. The toolchain utilities
|
||
available are determined by the languages enabled.
|
||
|
||
CMake stores info about the current toolchain in the following variables:
|
||
CMAKE_C_COMPILER,
|
||
CMAKE_CXX_COMPILER.
|
||
They contain paths to the C and C++ compilers respectively. This is usually
|
||
enough on desktop platforms. In the case of embedded systems, a custom
|
||
linker and assembler setting may be needed. In more complex projects
|
||
you may need to additionally specify binaries to other parts of the toolchain
|
||
(size, ranlib, objcopy…). All these tools should be set in the corresponding
|
||
variables:
|
||
CMAKE_AR,
|
||
CMAKE_ASM_COMPILER,
|
||
CMAKE_LINKER,
|
||
CMAKE_OBJCOPY,
|
||
CMAKE_RANLIB
|
||
|
||
As for the host and target operating systems, CMake stores their names in the
|
||
following variables:
|
||
CMAKE_HOST_SYSTEM_NAME – name of the platform, on which CMake is running (host platform).
|
||
On major operating systems this is set to the Linux, Windows or
|
||
Darwin (MacOS) value.
|
||
CMAKE_SYSTEM_NAME – name of the platform, for which we are building (target platform).
|
||
By default, this value is the same as CMAKE_HOST_SYSTEM_NAME, which
|
||
means that we are building for the local platform (no cross-compilation).
|
||
|
||
Put the toolchain variables into a separate file (e.g. <toolchain_name>.cmake)
|
||
and set CMAKE_TOOLCHAIN_FILE variable to the path of that file.
|
||
If cmake is invoked with the command line parameter:
|
||
--toolchain path/to/file
|
||
or
|
||
-DCMAKE_TOOLCHAIN_FILE=path/to/file
|
||
the file will be loaded early to set values for the compilers. The
|
||
CMAKE_CROSSCOMPILING variable is set to true when CMake is cross-compiling.
|
||
|
||
Structure of the toolchain file
|
||
-------------------------------
|
||
In fact, the toolchain file doesn’t have any structure. You can put anything you
|
||
want there. But the best practice is to define at least these settings:
|
||
path to the toolchain binaries (C compiler, C++ compiler, linker, etc.)
|
||
name of the target platform (and optionally target processor architecture)
|
||
required compilation and linking flags on that particular platform
|
||
toolchain sysroot settings
|
||
|
||
It is recommended that you set the CMAKE_FIND_ROOT_PATH variable to a path where
|
||
you have an exact copy of the root filesystem you have on your target device (with
|
||
libraries and binaries pre-compiled for the target processor).
|
||
|
||
References:
|
||
https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html
|
||
https://gitlab.com/embeddedlinux/libs/platform
|
||
https://discourse.cmake.org/t/cross-compile-for-aarch64-on-ubuntu/2161/10
|
||
https://stackoverflow.com/questions/54539682/how-to-set-up-cmake-to-cross-compile-with-clang-for-arm-embedded-on-windows?rq=1
|
||
https://developer.android.com/ndk/guides/cmake
|
||
|
||
|
||
========================================================================
|
||
X: Using CMakePresets.json for compiling
|
||
========================================================================
|
||
|
||
One problem that CMake users often face is sharing settings with other people for common
|
||
ways to configure a project. This may be done to support CI builds, or for users who
|
||
frequently use the same build. CMake supports two main files, CMakePresets.json and CMakeUserPresets.json,
|
||
that allow users to specify common configure options and share them with others. CMake also supports
|
||
files included with the include field.
|
||
|
||
CMakePresets.json and CMakeUserPresets.json live in the project's root directory. They
|
||
both have exactly the same format, and both are optional (though at least one must be
|
||
present if --preset is specified). CMakePresets.json is meant to specify project-wide build
|
||
details, while CMakeUserPresets.json is meant for developers to specify their own local build details.
|
||
|
||
See CMake documentation for details: https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html
|
||
|
||
HDF-provided CMakePresets.json
|
||
-------------------------------
|
||
The CMakePresets.json provided by HDF requires CMake version 3.25, which supports package
|
||
and workflow presets, and ninja build system. The top-level configuration group is intended to be
|
||
a standard set of options to produce a package of shared and staic libraries and tools. Other configurations
|
||
used for inheriting settings are in the included json file in "config/cmake-presets/hidden-presets.json".
|
||
|
||
Available configurations presets can be displayed by executing:
|
||
cmake -S <path-to-source> --list-presets
|
||
|
||
Using individual command presets (where <compiler-type> is GNUC or MSVC or Clang):
|
||
change directory to the hdf5 source folder
|
||
cmake --preset ci-StdShar-<compiler-type>
|
||
cmake --build --preset ci-StdShar-<compiler-type>
|
||
ctest --preset ci-StdShar-<compiler-type>
|
||
cpack --preset ci-StdShar-<compiler-type>
|
||
|
||
|
||
Using the workflow preset to configure, build, test and package the standard configuration is:
|
||
change directory to the hdf5 source folder
|
||
execute "cmake --workflow --preset ci-StdShar-<compiler-type> --fresh"
|
||
where <compiler-type> is GNUC or MSVC or Clang
|
||
|
||
Creating your own configurations
|
||
--------------------------------
|
||
The quickest way is to copy CMakePresets.json to CMakeUserPresets.json and
|
||
edit CMakeUserPresets.json configuration names from ci-* to my-*. Change the
|
||
"configurePresets" section "inherits" field only for those that you have alternate
|
||
options. Then change the "configurePreset" field entries in the "buildPresets",
|
||
"testPresets", "packagePresets" sections to match your my-StdShar-<compiler-type>.
|
||
And finally the names settings in the "workflowPresets" steps will also need the ci-* to my-* change.
|
||
|
||
For instance, to change the support files to use a local directory, edit CMakeUserPresets.json:
|
||
......
|
||
{
|
||
"name": "my-base-tgz",
|
||
"hidden": true,
|
||
"inherits": "ci-base",
|
||
"cacheVariables": {
|
||
"HDF5_ALLOW_EXTERNAL_SUPPORT": {"type": "STRING", "value": "TGZ"},
|
||
"TGZPATH": {"type": "PATH", "value": "${sourceParentDir}/temp"}
|
||
}
|
||
},
|
||
{
|
||
"name": "my-StdCompression",
|
||
"hidden": true,
|
||
"inherits": "my-base-tgz",
|
||
"cacheVariables": {
|
||
......
|
||
{
|
||
"name": "my-StdShar",
|
||
"hidden": true,
|
||
"inherits": "my-StdCompression",
|
||
"cacheVariables": {
|
||
......
|
||
{
|
||
"name": "my-StdShar-GNUC",
|
||
"description": "GNUC Standard Config for x64 (Release)",
|
||
"inherits": [
|
||
"ci-x64-Release-GNUC",
|
||
"ci-CPP",
|
||
"ci-Fortran",
|
||
"ci-Java",
|
||
"my-StdShar",
|
||
"my-StdExamples"
|
||
]
|
||
}
|
||
......
|
||
|
||
|
||
Then you can change or add options for your specific case.
|
||
|
||
|
||
========================================================================
|
||
XI. Autotools Configuration and Build
|
||
========================================================================
|
||
See RELEASE.txt in the release_notes/ directory for the list of platforms
|
||
tested for this release.
|
||
|
||
Instructions for building and testing HDF5 using autotools can be found in the
|
||
INSTALL_Auto.txt file found in this folder.
|
||
|
||
|
||
========================================================================
|
||
For further assistance, send email to help@hdfgroup.org
|
||
========================================================================
|
||
|
||
|
||
|