Skip to content

Commit

Permalink
cmake: use native instead of custom
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Apr 19, 2020
1 parent a58cc2d commit 1a45b77
Show file tree
Hide file tree
Showing 26 changed files with 36 additions and 40 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci_linux_meson.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
paths:
- "**.build"
- "**.f90"
- ".github/workflows/ci_linux_meson.yml"
pull_request:

Expand Down
20 changes: 6 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ if(NOT CMAKE_BUILD_TYPE)
endif()
project(h5fortran
LANGUAGES C Fortran
VERSION 2.9.1
VERSION 2.9.2
DESCRIPTION "thin, light object-oriented HDF5 Fortran interface"
HOMEPAGE_URL https://github.com/scivision/h5fortran)
enable_testing()
include(CTest)
include(FeatureSummary)

option(test_shaky "run shaky tests" OFF)

Expand All @@ -19,19 +20,11 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/compilers.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/hdf5.cmake)

if(NOT HDF5OK)

message(STATUS "HDF5 library not working with ${CMAKE_Fortran_COMPILER_ID} ${CMAKE_Fortran_COMPILER_VERSION}")

if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
message(FATAL_ERROR)
message(STATUS "h5fortran: HDF5 not working")
if(NOT PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
return()
endif()

unset(h5fortran)
unset(h5fortran::fortran)
message(STATUS "h5fortran disabled")
return()

endif(NOT HDF5OK)
endif()

set(CTEST_TEST_TIMEOUT 15)

Expand All @@ -55,7 +48,6 @@ if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)

include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/install.cmake)

include(FeatureSummary)
set_package_properties(Threads PROPERTIES DESCRIPTION "the system threads library")
set_package_properties(HDF5 PROPERTIES URL "https://hdfgroup.org/" DESCRIPTION "fast, versatile file I/O format" TYPE REQUIRED)
set_package_properties(ZLIB PROPERTIES URL "https://www.zlib.net/" DESCRIPTION "patent-free compression library")
Expand Down
4 changes: 2 additions & 2 deletions cmake/compilers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL NAG)
endif()

include(CheckFortranSourceCompiles)
check_fortran_source_compiles("implicit none (external); end" f2018impnone SRC_EXT f90)
check_fortran_source_compiles("implicit none (type, external); end" f2018impnone SRC_EXT f90)
if(NOT f2018impnone)
message(FATAL_ERROR "Compiler does not support Fortran 2018 IMPLICIT NONE (EXTERNAL): ${CMAKE_Fortran_COMPILER_ID} ${CMAKE_Fortran_COMPILER_VERSION}")
message(FATAL_ERROR "Compiler does not support Fortran 2018 implicit none (type, external): ${CMAKE_Fortran_COMPILER_ID} ${CMAKE_Fortran_COMPILER_VERSION}")
endif()
7 changes: 6 additions & 1 deletion cmake/hdf5.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ if(WIN32 AND CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
set(HDF5_USE_STATIC_LIBRARIES false)
endif()

find_package(HDF5 COMPONENTS Fortran HL)
if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
find_package(HDF5 COMPONENTS Fortran HL REQUIRED)
else()
find_package(HDF5 COMPONENTS Fortran HL)
endif()

if(NOT HDF5_FOUND)
return()
endif()
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
project('h5fortran', 'fortran',
meson_version : '>=0.52.0',
version : '2.9.1',
version : '2.9.2',
default_options : ['default_library=static', 'buildtype=release', 'warning_level=3'])

subdir('meson')
Expand Down
2 changes: 1 addition & 1 deletion src/interface.f90
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module h5fortran

use string_utils, only : toLower, strip_trailing_null, truncate_string_null

implicit none (external)
implicit none (type, external)
private
public :: hdf5_file, toLower, hdf_shape_check, hdf_get_slice, hdf_wrapup, hsize_t, strip_trailing_null, truncate_string_null, &
check, h5write, h5read
Expand Down
2 changes: 1 addition & 1 deletion src/read.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
h5pget_layout_f, h5pget_chunk_f, H5D_CONTIGUOUS_F, H5D_CHUNKED_F
use H5LT, only : h5ltpath_valid_f

implicit none (external)
implicit none (type, external)

contains

Expand Down
2 changes: 1 addition & 1 deletion src/reader.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use hdf5, only : h5dread_f
use h5lt, only : h5ltread_dataset_string_f

implicit none (external)
implicit none (type, external)

contains

Expand Down
2 changes: 1 addition & 1 deletion src/reader_lt.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
submodule (h5fortran:read) reader_lt

implicit none (external)
implicit none (type, external)

contains

Expand Down
2 changes: 1 addition & 1 deletion src/reader_nd.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
!! conceptual--not tested--will use h5dread_f instead
submodule (h5fortran:read) reader_ND

implicit none (external)
implicit none (type, external)

contains

Expand Down
2 changes: 1 addition & 1 deletion src/string_utils.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module string_utils

use, intrinsic:: iso_c_binding, only: c_null_char

implicit none (external)
implicit none (type, external)

contains

Expand Down
2 changes: 1 addition & 1 deletion src/tests/read_slice.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
program read_slice
!! example of Fortran reading smaller array into slice of larger array via subroutine

implicit none (external)
implicit none (type, external)

type :: foo
integer :: i44(4,4)
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_array.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module test_array
use, intrinsic :: iso_fortran_env, only: real32, real64, int32, stderr=>error_unit
use h5fortran, only : hdf5_file, hsize_t

implicit none (external)
implicit none (type, external)

real(real32) :: nan

Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_deflate.f90
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ program test_deflate
use h5fortran, only: hdf5_file, toLower, strip_trailing_null, truncate_string_null
use hdf5, only: H5D_CHUNKED_F, H5D_CONTIGUOUS_F, hsize_t

implicit none (external)
implicit none (type, external)

character(:), allocatable :: path
character(256) :: argv
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_error.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ program test_error
use, intrinsic:: iso_fortran_env, only: int32, real32, real64, stderr=>error_unit
use h5fortran, only: hdf5_file

implicit none (external)
implicit none (type, external)

type(hdf5_file) :: h5f

Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_exist.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ program test_exist
use, intrinsic :: iso_fortran_env, only : stderr=>error_unit
use h5fortran, only: hdf5_file, h5write

implicit none (external)
implicit none (type, external)

type(hdf5_file) :: h
character(:), allocatable :: path
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_hdf5_ifc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ program test_hdf5
use test_scalar, only : test_scalar_rw
use test_string, only : test_string_rw, test_lowercase, test_strip_null

implicit none (external)
implicit none (type, external)

character(:), allocatable :: path
character(256) :: argv
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_lt.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module test_lt

use h5fortran, only : h5write, h5read

implicit none (external)
implicit none (type, external)

contains

Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_minimal.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ program test_minimal
use hdf5, only : HID_T, HSIZE_T, H5_INTEGER_KIND, h5kind_to_type, h5open_f, h5close_f, h5fclose_f, h5fcreate_f, H5F_ACC_TRUNC_F
use h5lt, only : h5ltmake_dataset_f

implicit none (external)
implicit none (type, external)

integer :: ierr, p
integer(HID_T) :: lid
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_scalar.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module test_scalar
use hdf5, only: HSIZE_T
use h5fortran, only: hdf5_file

implicit none (external)
implicit none (type, external)

contains

Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_shape.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ program test_shape
use h5fortran, only: hdf5_file,hsize_t
use, intrinsic:: iso_fortran_env, only: real64, stdout=>output_unit, stderr=>error_unit

implicit none (external)
implicit none (type, external)

type(hdf5_file) :: h5f
character(1024) :: argv
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_string.f90
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module test_string

use h5fortran, only : toLower, hdf5_file, strip_trailing_null, truncate_string_null

implicit none (external)
implicit none (type, external)

contains

Expand Down
2 changes: 1 addition & 1 deletion src/write.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

use H5LT, only: h5ltpath_valid_f, h5ltset_attribute_string_f, h5ltmake_dataset_string_f

implicit none (external)
implicit none (type, external)

contains

Expand Down
2 changes: 1 addition & 1 deletion src/writer.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
!! This submodule is for writing 0-D..7-D data
use hdf5, only: h5dwrite_f

implicit none (external)
implicit none (type, external)

contains

Expand Down
2 changes: 1 addition & 1 deletion src/writer_lt.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
submodule (h5fortran:write) writer_lt

implicit none (external)
implicit none (type, external)

contains

Expand Down
2 changes: 1 addition & 1 deletion src/writer_nd.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
!! conceptual--not tested
submodule (h5fortran:write) writer_ND

implicit none (external)
implicit none (type, external)

contains

Expand Down

0 comments on commit 1a45b77

Please sign in to comment.