Last active
April 18, 2020 13:12
-
-
Save knedlsepp/e3cb53b36abb876870a7490958bd4adb to your computer and use it in GitHub Desktop.
hdf5-fortran-nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.5) | |
project(test-hdf5 C Fortran) | |
find_package(HDF5 REQUIRED COMPONENTS Fortran) | |
add_library(hdf5::hdf5 INTERFACE IMPORTED) | |
set_property(TARGET hdf5::hdf5 PROPERTY | |
INTERFACE_INCLUDE_DIRECTORIES ${HDF5_Fortran_INCLUDE_DIRS}) | |
set_property(TARGET hdf5::hdf5 PROPERTY | |
INTERFACE_LINK_LIBRARIES ${HDF5_Fortran_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES}) | |
add_executable(test test.f95) | |
target_link_libraries(test hdf5::hdf5) | |
install(TARGETS test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
pkgs = import <nixpkgs> {}; | |
in | |
pkgs.stdenv.mkDerivation { | |
name = "hdf5-test"; | |
src = builtins.fetchGit ./.; | |
nativeBuildInputs = with pkgs; [ | |
gfortran | |
cmake | |
]; | |
hardeningDisable = [ "format" ]; | |
buildInputs = with pkgs; [ | |
hdf5-fortran | |
]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program test | |
use hdf5 | |
implicit none | |
end program test | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment