mirror of
https://github.com/HDFGroup/hdf5.git
synced 2026-09-25 04:09:44 +03:00
562 lines
30 KiB
HTML
562 lines
30 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
|
<meta name="generator" content="Doxygen 1.16.1"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>HDF5: Compiling HDF5 Applications</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="navtreedata.js"></script>
|
|
<script type="text/javascript" src="navtree.js"></script>
|
|
<script type="text/javascript" src="cookie.js"></script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<script type="text/javascript">
|
|
$(function() { init_search(); });
|
|
</script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
<link href="hdf5doxy.css" rel="stylesheet" type="text/css"/>
|
|
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
|
|
<link href="hdf5doxy.css" rel="stylesheet" type="text/css">
|
|
<script type="text/javascript" src="hdf5_navtree_hacks.js"></script>
|
|
<div style="background:#FFDDDD;font-size:120%;text-align:center;margin:0;padding:5px">Help us improve by taking our short survey: <a href="https://www.hdfgroup.org/website-survey/">https://www.hdfgroup.org/website-survey/</a></div>
|
|
<!-- ... other metadata & script includes ... -->
|
|
<script type="text/javascript" src="doxygen-awesome-tabs.js"></script>
|
|
<script type="text/javascript">
|
|
DoxygenAwesomeTabs.init()
|
|
</script>
|
|
<!-- Google tag (gtag.js) -->
|
|
<script async src="https://www.googletagmanager.com/gtag/js?id=G-57FMZK4S7X"></script>
|
|
<script>
|
|
window.dataLayer = window.dataLayer || [];
|
|
function gtag(){dataLayer.push(arguments);}
|
|
gtag('js', new Date());
|
|
gtag('config', 'G-57FMZK4S7X');
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr id="projectrow">
|
|
<td id="projectlogo"><img alt="Logo" src="HDFG-logo.png"/></td>
|
|
<td id="projectalign">
|
|
<div id="projectname">HDF5<span id="projectnumber"> Last Updated on 2026-02-28</span>
|
|
</div>
|
|
<div id="projectbrief">The HDF5 Field Guide</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.16.1 -->
|
|
<script type="text/javascript">
|
|
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
|
</script>
|
|
<script type="text/javascript">
|
|
$(function() { codefold.init(); });
|
|
</script>
|
|
<div id="main-nav">
|
|
<div id="navrow1" class="tabs">
|
|
<ul class="tablist">
|
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
|
<li><a href="_getting_started.html"><span>Getting started</span></a></li>
|
|
<li><a href="_u_g.html"><span>User Guide</span></a></li>
|
|
<li><a href="_r_m.html"><span>Reference Manual</span></a></li>
|
|
<li><a href="_cookbook.html"><span>Cookbook</span></a></li>
|
|
<li><a href="_t_n.html"><span>Technical Notes</span></a></li>
|
|
<li><a href="_r_f_c.html"><span>RFCs</span></a></li>
|
|
<li><a href="_s_p_e_c.html"><span>Specifications</span></a></li>
|
|
<li><a href="_g_l_s.html"><span>Glossary</span></a></li>
|
|
<li><a href="_f_t_s.html"><span>Full-Text Search</span></a></li>
|
|
<li><a href="_about.html"><span>About</span></a></li>
|
|
<li>
|
|
<div id="MSearchBox" class="MSearchBoxInactive">
|
|
<span class="left">
|
|
<span id="MSearchSelect" class="search-icon" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()"><span class="search-icon-dropdown"></span></span>
|
|
<input type="text" id="MSearchField" value="" placeholder="Search" accesskey="S"
|
|
onfocus="searchBox.OnSearchFieldFocus(true)"
|
|
onblur="searchBox.OnSearchFieldFocus(false)"
|
|
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
|
</span><span class="right">
|
|
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><div id="MSearchCloseImg" class="close-icon"></div></a>
|
|
</span>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div><!-- main-nav -->
|
|
</div><!-- top -->
|
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
|
<div id="nav-tree">
|
|
<div id="nav-tree-contents">
|
|
<div id="nav-sync" class="sync"></div>
|
|
</div>
|
|
</div>
|
|
<div id="splitbar" style="-moz-user-select:none;"
|
|
class="ui-resizable-handle">
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
$(function(){initNavTree('_l_b_compiling.html','',''); });
|
|
</script>
|
|
<div id="container">
|
|
<div id="doc-content">
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<div id="MSearchResults">
|
|
<div class="SRPage">
|
|
<div id="SRIndex">
|
|
<div id="SRResults"></div>
|
|
<div class="SRStatus" id="Loading">Loading...</div>
|
|
<div class="SRStatus" id="Searching">Searching...</div>
|
|
<div class="SRStatus" id="NoMatches">No Matches</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div><div class="header">
|
|
<div class="headertitle"><div class="title">Compiling HDF5 Applications </div></div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<div class="textblock"><p>Navigate back: <a class="el" href="index.html" title="notitle">Main</a> / <a class="el" href="_getting_started.html" title="Getting Started with HDF5">Getting Started with HDF5</a> / <a class="el" href="_learn_basics.html" title="Learning the Basics">Learning the Basics</a> </p><hr />
|
|
<h1 class="doxsection"><a class="anchor" id="secLBCompiling"></a>
|
|
Tools and Instructions on Compiling</h1>
|
|
<p>Compiling applications to use the HDF5 Library can be as simple as executing: </p><div class="fragment"><div class="line">h5cc -o myprog myprog.c</div>
|
|
</div><!-- fragment --><p>As an application's file base evolves, there are better solutions using CMake and CMakeLists.txt files. Many tutorials and references can be found with a simple search.</p>
|
|
<p>This tutorial section will discuss the use of compile scripts on Linux. See the <a class="el" href="#secLBCompilingVS" title="Using Visual Studio">Using Visual Studio</a> section for compiling with Visual Studio.</p>
|
|
<h1 class="doxsection"><a class="anchor" id="secLBCompilingLinux"></a>
|
|
Compile Scripts</h1>
|
|
<p>When the library is built, the following compile shell scripts are included: </p><ul>
|
|
<li>h5cc: pkg-config based compile shell script for HDF5 C programs </li>
|
|
<li>h5fc: pkg-config based compile shell script for HDF5 F90 programs </li>
|
|
<li>h5c++: pkg-config based compile shell script for HDF5 C++ programs</li>
|
|
</ul>
|
|
<p>These scripts are easily used to compile single file applications, such as those included in the tutorial. </p><table class="doxtable">
|
|
<tr>
|
|
<th><b>Warning</b> </th><td>The h5cc/h5fc/h5c++ pkg-config compile scripts are included when building with configure. These versions rely on the pkg-config files in the lib/pkgconfig. </td></tr>
|
|
</table>
|
|
<h4>Examples of Using the Unix Compile Scripts:</h4>
|
|
<p>Following are examples of compiling and running an application with the Unix compile scripts: </p><div class="fragment"><div class="line">h5fc myprog.f90</div>
|
|
<div class="line">./a.out</div>
|
|
<div class="line"> </div>
|
|
<div class="line">h5cc -o myprog myprog.c</div>
|
|
<div class="line">./myprog </div>
|
|
</div><!-- fragment --><p>To see how the libraries linked in with a compile script were configured and built, use the -showconfig option. For example, if using h5cc type: </p><div class="fragment"><div class="line">h5cc -showconfig</div>
|
|
</div><!-- fragment --><h4>Detailed Description of Unix Compile Scripts:</h4>
|
|
<p>The h5cc, h5c++, and h5fc pkg-config compile scripts come with the HDF5 binary distributions (include files, libraries, and utilities) for the platforms we support. The h5c++ and h5fc utilities are ONLY present if the library was built with C++ and Fortran.</p>
|
|
<h4>USING_HDF5_CMake.txt:</h4>
|
|
<pre class="fragment">************************************************************************
|
|
* Build and Install HDF5 Applications with CMake *
|
|
************************************************************************
|
|
|
|
Notes: This short instruction is written for users who want to quickly
|
|
build HDF5 applications using the CMake tools. Users can adapt
|
|
these instructions for their own applications. For more information,
|
|
see the "Minimum C Project Files for CMake" section.
|
|
|
|
More information about using CMake can be found at the Kitware
|
|
site, www.cmake.org.
|
|
|
|
CMake uses the command line; however, the visual CMake tool is
|
|
available for the configuration step. The steps are similar for
|
|
all of the operating systems supported by CMake.
|
|
|
|
NOTES:
|
|
1. CMake 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.
|
|
|
|
2. See the appendix at the bottom of this file for an example
|
|
of using a ctest script for building and testing. See
|
|
INSTALL_CMake.txt for more information.
|
|
|
|
3. See https://cmake.org/cmake/help/latest/command/find_package.html
|
|
for more information on the CMake "Config Mode Search Procedure".
|
|
|
|
|
|
========================================================================
|
|
I. Preconditions
|
|
========================================================================
|
|
|
|
1. We suggest you obtain the latest CMake for your platform from the Kitware
|
|
web site. The HDF5 z.y.x product requires a minimum CMake version
|
|
of 3.26.
|
|
|
|
2. You have installed the HDF5 library built with CMake, by executing
|
|
the HDF Install Utility (the *.msi file in the binary package for
|
|
Windows or the *.sh on Linux). You can obtain pre-built binaries
|
|
from The HDF Group's website at www.hdfgroup.org.
|
|
|
|
3. Set the HDF5_ROOT CMake variable, -DHDF5_ROOT=<install_path>
|
|
or environment variable, set(ENV{HDF5_ROOT} "<install_path>")
|
|
to the installed location of HDF5.
|
|
On Windows:
|
|
HDF5_ROOT=C:/Program Files/HDF_Group/HDF5/z.y.x/
|
|
On unix:
|
|
HDF5_ROOT=<install root folder>/HDF_Group/HDF5/z.y.x/
|
|
|
|
If you are using shared libraries, you may need to add to the path
|
|
environment variable. Set the path environment variable to the
|
|
installed location of the library files for HDF5.
|
|
On Windows (*.dll):
|
|
PATH=%PATH%;C:/Program Files/HDF_Group/HDF5/z.y.x/bin
|
|
On unix (*.so):
|
|
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<install root folder>/HDF_Group/HDF5/z.y.x/lib
|
|
|
|
If you are using filter plugin libraries, you will need to set the
|
|
HDF5_PLUGIN_PATH environment variable.
|
|
On Windows:
|
|
HDF5_PLUGIN_PATH=C:/Program Files/HDF_Group/HDF5/z.y.x/lib/plugin
|
|
On unix:
|
|
HDF5_PLUGIN_PATH=<install root folder>/HDF_Group/HDF5/z.y.x/lib/plugin
|
|
|
|
(Note there are no quote characters used on Windows and all platforms
|
|
use forward slashes)
|
|
|
|
4. Created separate source and build directories.
|
|
(CMake commands are executed in the build directory)
|
|
|
|
5. Created a CMakeLists.txt file(s) for your source. See Section III
|
|
below.
|
|
|
|
|
|
|
|
========================================================================
|
|
II. Building HDF5 Applications with CMake
|
|
========================================================================
|
|
|
|
Go through these steps to build HDF5 applications with CMake.
|
|
(The application must support building with CMake.)
|
|
|
|
1. Run CMake
|
|
2. Configure the cache settings
|
|
3. Build HDF5 Applications
|
|
4. Test HDF5 Applications
|
|
|
|
These steps are described in more 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 for the build directory.
|
|
|
|
PREFERRED:
|
|
Users can perform the configuration step without using the visual
|
|
cmake-gui program. The following is an example command line
|
|
configuration step executed within the build directory:
|
|
|
|
cmake -G "<generator>" [-D<options>] <sourcepath>
|
|
|
|
Where <generator> is (examples):
|
|
* MinGW Makefiles
|
|
* NMake Makefiles
|
|
* Unix Makefiles
|
|
* Visual Studio 15 2017
|
|
* Visual Studio 15 2017 Win64
|
|
* Visual Studio 16 2019
|
|
* ... in addition VS2019 will need to set the "-A" option,
|
|
* ... [Win32, x64, ARM, ARM64]
|
|
* Visual Studio 17 2022
|
|
* ... in addition VS2022 will need to set the "-A" option,
|
|
* ... [Win32, x64, ARM, ARM64]
|
|
|
|
<options> is:
|
|
* BUILD_TESTING:BOOL=ON
|
|
* BUILD_SHARED_LIBS:BOOL=[ON | OFF]
|
|
|
|
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 16 2019).
|
|
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 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 Alternative command line example on Windows in c:\MyHDFstuff\hdf5\build directory:
|
|
|
|
cmake -G "Visual Studio 16 2019" -A "x64" -DBUILD_TESTING:BOOL=ON ..
|
|
|
|
3. Build HDF5 Applications
|
|
|
|
On Windows, you can build HDF5 applications using either the Visual Studio Environment
|
|
or the command line. The command line is normally used on 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. If you are
|
|
using the pre-built binaries from HDF, use Release.
|
|
|
|
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.
|
|
|
|
4. Test HDF5 Applications
|
|
|
|
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. The files that support building with CMake are all of 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.
|
|
|
|
|
|
|
|
========================================================================
|
|
III. Minimum C Project Files for CMake
|
|
========================================================================
|
|
|
|
Given the preconditions in section I, create a CMakeLists.txt file at the
|
|
source root. Include the following text in the file:
|
|
|
|
##########################################################
|
|
cmake_minimum_required (VERSION 3.26)
|
|
project (HDF5MyApp C)
|
|
|
|
set (LIB_TYPE STATIC) # or SHARED
|
|
string(TOLOWER ${LIB_TYPE} SEARCH_TYPE)
|
|
|
|
find_package (HDF5 NAMES hdf5 COMPONENTS C ${SEARCH_TYPE})
|
|
# find_package (HDF5) # Find non-cmake built HDF5
|
|
set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "${HDF5_INCLUDE_DIR}")
|
|
set (LINK_LIBS ${LINK_LIBS} ${HDF5_C_${LIB_TYPE}_LIBRARY})
|
|
|
|
set (example hdf_example)
|
|
|
|
add_executable (${example} ${PROJECT_SOURCE_DIR}/${example}.c)
|
|
target_link_libraries (${example} ${LINK_LIBS})
|
|
|
|
enable_testing ()
|
|
include (CTest)
|
|
|
|
add_test (NAME test_example COMMAND ${example})
|
|
##########################################################
|
|
|
|
|
|
|
|
========================================================================
|
|
IV. APPENDIX
|
|
========================================================================
|
|
|
|
Below is an example of a ctest script that can be used to build the examples.
|
|
Adjust the values as necessary. Note that the defaults can be entered on the
|
|
command line and the build folder is created as a sub-folder. Windows should
|
|
adjust the forward slash to double backslashes, except for the HDF_DIR
|
|
environment variable.
|
|
|
|
NOTE: this file is available in the HDF5 repository, for more information see:
|
|
https://github.com/HDFGroup/hdf5/blob/develop/release_docs/USING_CMake_Examples.txt
|
|
|
|
ctest -S HDF5_Examples.cmake -C Release -V -O test.log
|
|
|
|
Also available at the HDF web site is a CMake application framework template.
|
|
You can quickly add files to the framework and execute the script to compile
|
|
your application with an installed HDF5 binary.
|
|
|
|
|
|
========================================================================
|
|
For further assistance, send email to help@hdfgroup.org
|
|
========================================================================
|
|
|
|
|
|
</pre><h1 class="doxsection"><a class="anchor" id="secLBCompilingVS"></a>
|
|
Using Visual Studio</h1>
|
|
<ol type="1">
|
|
<li>If you are building on 64-bit Windows, find the "Platform" dropdown and select "x64". Also select the correct Configuration (Debug, Release, RelWithDebInfo, etc)</li>
|
|
<li><p class="startli">Set up path for external headers</p>
|
|
<p class="startli">The HDF5 install path settings will need to be in the project property sheets per project. Go to "Project" and select "Properties", find "Configuration Properties", and then "C/C++".</p>
|
|
<p class="startli">2.1 Add the header path to the "Additional Include Directories" setting. Under "C/C++" find "General" and select "Additional Include Directories". Select "Edit" from the dropdown and add the HDF5 install/include path to the list. (Ex: "C:\Program Files\HDF_Group\HDF5\1.10.9\include")</p>
|
|
<p class="startli">2.2 Building applications with the dynamic/shared <a class="el" href="namespacehdf5.html">hdf5</a> libraries requires that the "H5_BUILT_AS_DYNAMIC_LIB" compile definition be used. Under "C/C++" find "Preprocessor" and select "Preprocessor Definitions". Select "Edit" from the dropdown and add "H5_BUILT_AS_DYNAMIC_LIB" to the list.</p>
|
|
</li>
|
|
<li><p class="startli">Set up path for external libraries</p>
|
|
<p class="startli">The HDF5 install path/lib settings will need to be in the project property sheets per project. Go to "Project" and select "Properties", find "Configuration Properties", and then "Linker".</p>
|
|
<p class="startli">3.1 Add the libraries to the "Additional Dependencies" setting. Under "Linker" find "Input" and select "Additional Dependencies". Select "Edit" from the dropdown and add the required HDF5 install/lib path to the list. (Ex: "C:\Program Files\HDF_Group\HDF5\1.10.9\lib\hdf5.lib")</p>
|
|
<p class="startli">3.2 For static builds, the external libraries should be added. For example, to compile a C++ application, enter: libhdf5_cpp.lib libhdf5.lib libz.lib libszaec.lib libaec.lib</p>
|
|
</li>
|
|
</ol>
|
|
<h1 class="doxsection"><a class="anchor" id="secLBCompilingLibs"></a>
|
|
HDF5 Libraries</h1>
|
|
<p>Following are the libraries included with HDF5. Whether you are using the Unix compile scripts or Makefiles, or are compiling on Windows, these libraries are or may need to be specified. The order they are specified is important on Linux:</p>
|
|
<table class="doxtable">
|
|
<caption>HDF5 Static Libraries</caption>
|
|
<tr>
|
|
<th>Library</th><th>Linux Name</th><th>Mac Name</th><th>Windows Name</th></tr>
|
|
<tr>
|
|
<td><div class="fragment"><div class="line">HDF5 High Level C++ APIs </div>
|
|
<div class="line">HDF5 C++ Library </div>
|
|
<div class="line">HDF5 High Level Fortran APIs</div>
|
|
<div class="line">HDF5 Fortran Library</div>
|
|
<div class="line">HDF5 High Level C APIs</div>
|
|
<div class="line">HDF5 C Library</div>
|
|
</div><!-- fragment --> </td><td><div class="fragment"><div class="line">libhdf5_hl_cpp.a</div>
|
|
<div class="line">libhdf5_cpp.a</div>
|
|
<div class="line">libhdf5_hl_fortran.a</div>
|
|
<div class="line">libhdf5_fortran.a</div>
|
|
<div class="line">libhdf5_hl.a</div>
|
|
<div class="line">libhdf5.a</div>
|
|
</div><!-- fragment --> </td><td><div class="fragment"><div class="line">libhdf5_hl_cpp.a</div>
|
|
<div class="line">libhdf5_cpp.a</div>
|
|
<div class="line">libhdf5_hl_fortran.a</div>
|
|
<div class="line">libhdf5_fortran.a</div>
|
|
<div class="line">libhdf5_hl.a</div>
|
|
<div class="line">libhdf5.a</div>
|
|
</div><!-- fragment --> </td><td><em>Windows</em> <div class="fragment"><div class="line">libhdf5_hl_cpp.lib</div>
|
|
<div class="line">libhdf5_cpp.lib</div>
|
|
<div class="line">libhdf5_hl_fortran.lib</div>
|
|
<div class="line">libhdf5_fortran.lib</div>
|
|
<div class="line">libhdf5_hl.lib</div>
|
|
<div class="line">libhdf5.lib</div>
|
|
</div><!-- fragment --> </td></tr>
|
|
</table>
|
|
<table class="doxtable">
|
|
<caption>HDF5 Shared Libraries</caption>
|
|
<tr>
|
|
<th>Library</th><th>Linux Name</th><th>Mac Name</th><th>Windows Name</th></tr>
|
|
<tr>
|
|
<td><div class="fragment"><div class="line">HDF5 High Level C++ APIs </div>
|
|
<div class="line">HDF5 C++ Library </div>
|
|
<div class="line">HDF5 High Level Fortran APIs</div>
|
|
<div class="line">HDF5 Fortran Library</div>
|
|
<div class="line">HDF5 High Level C APIs</div>
|
|
<div class="line">HDF5 C Library</div>
|
|
</div><!-- fragment --> </td><td><div class="fragment"><div class="line">libhdf5_hl_cpp.so</div>
|
|
<div class="line">libhdf5_cpp.so</div>
|
|
<div class="line">libhdf5_hl_fortran.so</div>
|
|
<div class="line">libhdf5_fortran.so</div>
|
|
<div class="line">libhdf5_hl.so</div>
|
|
<div class="line">libhdf5.so</div>
|
|
</div><!-- fragment --> </td><td><div class="fragment"><div class="line">libhdf5_hl_cpp.dylib</div>
|
|
<div class="line">libhdf5_cpp.dylib</div>
|
|
<div class="line">libhdf5_hl_fortran.dylib</div>
|
|
<div class="line">libhdf5_fortran.dylib</div>
|
|
<div class="line">libhdf5_hl.dylib</div>
|
|
<div class="line">libhdf5.dylib</div>
|
|
</div><!-- fragment --> </td><td><div class="fragment"><div class="line">hdf5_hl_cpp.lib</div>
|
|
<div class="line">hdf5_cpp.lib</div>
|
|
<div class="line">hdf5_hl_fortran.lib</div>
|
|
<div class="line">hdf5_fortran.lib</div>
|
|
<div class="line">hdf5_hl.lib</div>
|
|
<div class="line"><a class="code hl_namespace" href="namespacehdf5.html">hdf5</a>.lib</div>
|
|
<div class="ttc" id="anamespacehdf5_html"><div class="ttname"><a href="namespacehdf5.html">hdf5</a></div><div class="ttdef"><b>Definition</b> HDF5.F90:26</div></div>
|
|
</div><!-- fragment --> </td></tr>
|
|
</table>
|
|
<table class="doxtable">
|
|
<caption>External Libraries</caption>
|
|
<tr>
|
|
<th>Library</th><th>Linux Name</th><th>Mac Name</th><th>Windows Name</th></tr>
|
|
<tr>
|
|
<td><div class="fragment"><div class="line">SZIP Compression Library</div>
|
|
<div class="line">SZIP Compression Library</div>
|
|
<div class="line">ZLIB or DEFLATE Compression Library</div>
|
|
</div><!-- fragment --> </td><td><div class="fragment"><div class="line">libszaec.a</div>
|
|
<div class="line">libaec.a</div>
|
|
<div class="line">libz.a</div>
|
|
</div><!-- fragment --> </td><td><div class="fragment"><div class="line">libszaec.a</div>
|
|
<div class="line">libaec.a</div>
|
|
<div class="line">libz.a</div>
|
|
</div><!-- fragment --> </td><td><div class="fragment"><div class="line">libszaec.lib</div>
|
|
<div class="line">libaec.lib</div>
|
|
<div class="line">libz.lib</div>
|
|
</div><!-- fragment --> </td></tr>
|
|
</table>
|
|
<p>The pre-compiled binaries, in particular, are built (if at all possible) with these libraries as well as with SZIP and ZLIB. If using shared libraries you may need to add the path to the library to LD_LIBRARY_PATH on Linux or on WINDOWS you may need to add the path to the bin folder to PATH.</p>
|
|
<h1 class="doxsection"><a class="anchor" id="secLBCompilingCMake"></a>
|
|
Compiling an Application with CMake</h1>
|
|
<h2 class="doxsection"><a class="anchor" id="subsecLBCompilingCMakeScripts"></a>
|
|
CMake Scripts for Building Applications</h2>
|
|
<p>See <a href="https://github.com/HDFGroup/hdf5/blob/develop/release_docs/USING_CMake_Examples.txt">Using CMake to Build Applications</a> to build applications with different languages and options.</p>
|
|
<p>For a more complete script (and to help resolve issues) see the script provided with the HDF5 Examples project.</p>
|
|
<h2 class="doxsection"><a class="anchor" id="subsecLBCompilingCMakeExamples"></a>
|
|
HDF5 Examples</h2>
|
|
<p>The installed HDF5 can be verified by compiling the HDF5 Examples project, included with the CMake built HDF5 binaries in the share folder or you can go to the <a href="https://github.com/HDFGroup/hdf5/blob/develop/HDF5Examples">HDF5 Examples</a> in the HDF5 github repository.</p>
|
|
<p>Go into the share directory and follow the instructions in <a href="https://github.com/HDFGroup/hdf5/blob/develop/release_docs/USING_CMake_Examples.txt">Using CMake to Build Examples</a> to build the examples.</p>
|
|
<p>In general, users must first set the HDF5_ROOT environment variable to the installed location of the CMake configuration files for HDF5.</p>
|
|
<p>For example, on Windows the following path might be set: </p><div class="fragment"><div class="line">HDF5_ROOT=C:/Program Files/HDF_Group/HDF5/z.y.x</div>
|
|
</div><!-- fragment --><p>For example, on Linux the following path might be set: </p><div class="fragment"><div class="line">HDF5_ROOT=<install root folder>/HDF_Group/HDF5/z.y.x/</div>
|
|
</div><!-- fragment --><h2 class="doxsection"><a class="anchor" id="subsecLBCompilingCMakeTroubless"></a>
|
|
Troubleshooting CMake</h2>
|
|
<h4>How do you use find_package with HDF5?</h4>
|
|
<p>To use find_package you will first need to make sure that HDF5_ROOT is set correctly. For setting this environment variable see the Preconditions in the USING_HDF5_CMake.txt file in the share directory.</p>
|
|
<p>See the CMakeLists.txt file provided with these examples for how to use find_package with HDF5.</p>
|
|
<p>Please note that the find_package invocation changed to require "shared" or "static": </p><div class="fragment"><div class="line">FIND_PACKAGE(HDF5 COMPONENTS C HL NO_MODULE REQUIRED shared)</div>
|
|
<div class="line">FIND_PACKAGE(HDF5 COMPONENTS C HL NO_MODULE REQUIRED <span class="keyword">static</span>) </div>
|
|
</div><!-- fragment --><p>Previously, the find_package invocation was: </p><div class="fragment"><div class="line">FIND_PACKAGE(HDF5 COMPONENTS C HL NO_MODULE REQUIRED)</div>
|
|
</div><!-- fragment --><h4>My platform/compiler is not included. Can I still use the configuration files?</h4>
|
|
<p>Yes, you can but you will have to edit the HDF5_Examples.cmake file and update the variable: </p><div class="fragment"><div class="line">CTEST_CMAKE_GENERATOR </div>
|
|
</div><!-- fragment --><p>The generators for your platform can be seen by typing: </p><div class="fragment"><div class="line">cmake --<a class="code hl_function" href="h5import_8h.html#a254c266e4e95df99708a4e96db2c0e9e">help</a></div>
|
|
<div class="ttc" id="ah5import_8h_html_a254c266e4e95df99708a4e96db2c0e9e"><div class="ttname"><a href="h5import_8h.html#a254c266e4e95df99708a4e96db2c0e9e">help</a></div><div class="ttdeci">void help(char *)</div></div>
|
|
</div><!-- fragment --><h4>What do I do if the build fails?</h4>
|
|
<p>I received an error during the build and the application binary is not in the build directory as I expected. How do I determine what the problem is?</p>
|
|
<p>If the error is not clear, then the first thing you may want to do is replace the -V (Dash Uppercase Vee) option for ctest in the build script to -VV (Dash Uppercase Vee Uppercase Vee). Then remove the build directory and re-run the build script. The output should be more verbose.</p>
|
|
<p>If the error is still not clear, then check the log files. You will find those in the build directory. For example, on Unix the log files will be in: </p><div class="fragment"><div class="line">build/Testing/Temporary/ </div>
|
|
</div><!-- fragment --><p> There are log files for the configure, test, and build.</p>
|
|
<hr />
|
|
<p> Previous Chapter <a class="el" href="_l_b_quiz_answers.html" title="Learning the basics QUIZ with Answers">Learning the basics QUIZ with Answers</a></p>
|
|
<p>Navigate back: <a class="el" href="index.html" title="notitle">Main</a> / <a class="el" href="_getting_started.html" title="Getting Started with HDF5">Getting Started with HDF5</a> / <a class="el" href="_learn_basics.html" title="Learning the Basics">Learning the Basics</a> </p>
|
|
</div></div><!-- contents -->
|
|
</div><!-- PageDoc -->
|
|
</div><!-- doc-content -->
|
|
<div id="page-nav" class="page-nav-panel">
|
|
<div id="page-nav-resize-handle"></div>
|
|
<div id="page-nav-tree">
|
|
<div id="page-nav-contents">
|
|
</div><!-- page-nav-contents -->
|
|
</div><!-- page-nav-tree -->
|
|
</div><!-- page-nav -->
|
|
</div><!-- container -->
|
|
<!-- start footer part -->
|
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
|
<ul>
|
|
<li class="navelem"><a href="_learn_basics.html">Learning the Basics</a></li>
|
|
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.16.1 </li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|