This repository automates building HDF5 with Fortran bindings on Windows and verifies the installation with a Fortran smoke test.
The script hdf5_fortran_vs_demo.bat performs:
- Intel oneAPI environment initialization (
ifx). - HDF5 configure/build/install with
Visual Studio 2022andfortran=ifx. - Fortran smoke test configure/build/run.
- Deployment of runtime files and libraries to a standard Windows layout.
- Visual Studio 2022 with C/C++ build tools.
- Intel oneAPI HPC Toolkit (Fortran
ifx). - CMake available in
PATH.
hdf5/: HDF5 source submodule.fortran_demo/: Fortran smoke-test project.hdf5_fortran_vs_demo.bat: automation script.
git clone --recurse-submodules https://github.com/MaximEremenko/HDF5_test.git
cd HDF5_testIf cloned without submodules:
git submodule update --init --recursiveRun from the repository root:
hdf5_fortran_vs_demo.batAfter a successful run:
build_demo_x64_VS2022\fortran_demo.h5containing datasetrandom_array_5(5 randomdoublevalues)project\bin\hdf5_fortran_smoke.exeproject\bin\*.dll(runtime DLLs)project\lib\*.libandproject\lib\*.a(import/static libraries)
Run the deployed executable:
project\bin\hdf5_fortran_smoke.execall "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64
set BUILD_DIR=build_x64_VS2022
set INSTALL_DIR=bin_x64_VS2022
rmdir /S /Q %BUILD_DIR%
rmdir /S /Q %INSTALL_DIR%
mkdir %INSTALL_DIR%
mkdir %BUILD_DIR%
cd %BUILD_DIR%
cmake ../hdf5 -G "Visual Studio 17 2022" -A x64 -T "fortran=ifx" ^
-DCMAKE_INSTALL_PREFIX=../%INSTALL_DIR% ^
-DHDF5_BUILD_FORTRAN=ON ^
-DHDF5_BUILD_HL_LIB=ON ^
-DHDF5_BUILD_CPP_LIB=OFF ^
-DHDF5_BUILD_JAVA=OFF ^
-DHDF5_BUILD_TOOLS=OFF ^
-DHDF5_BUILD_EXAMPLES=OFF ^
-DBUILD_TESTING=OFF ^
-DHDF5_ENABLE_ZLIB_SUPPORT=OFF ^
-DHDF5_ENABLE_SZIP_SUPPORT=OFF ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
cmake --build . --config Release --target package
cmake --build . --config Release --target clean_cpack
cmake --build . --config Release --target install
cd ..ifxnot found: Runcall "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64, thenwhere ifx.- Generator/toolset errors: Confirm Visual Studio 2022 and C/C++ build tools are installed.
MSB3061or file access/lock errors: Close tools that may lock build files, delete build folders, and rerun.