Skip to content

Commit

Permalink
meson testing template
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Aug 6, 2019
1 parent c23f89c commit e123cd3
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 33 deletions.
30 changes: 17 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
language: minimal
language: python
group: travis_latest
dist: xenial

Expand All @@ -17,17 +17,21 @@ matrix:
include:
- os: linux
env: FC=gfortran-6
- os: osx
env: FC=gfortran
before_install:
- brew update > /dev/null
- brew upgrade cmake > /dev/null
- brew install gcc > /dev/null
- brew install hdf5 > /dev/null
# OSX OK, but move to Azure for speed
# - os: osx
# env: FC=gfortran
# before_install:
# - brew update > /dev/null
# - brew upgrade cmake > /dev/null
# - brew install gcc > /dev/null
# - brew install hdf5 > /dev/null

install:
- cd build
- cmake ..
- cmake --build . --parallel
before_install:
- git -C $HOME clone https://github.com/mesonbuild/meson
- python -m pip install -e $HOME/meson
- curl -Ls https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip -o ninja-linux.zip
- sudo unzip ninja-linux.zip -d /usr/local/bin/

script: ctest --parallel --output-on-failure
install: meson build

script: meson test -C build
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ The library `libh5oo` is built, link it into your program as usual.
```sh
meson build

ninja -C build
```

Optionally test via:
```sh
meson test -C build
```

Expand Down
13 changes: 4 additions & 9 deletions cmake/compilers.cmake
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@

message(STATUS "CMake Build Type: ${CMAKE_BUILD_TYPE}")

if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)

if(NOT WIN32)
set(FFLAGS -stand f18 -implicitnone -traceback -warn -heap-arrays)
set(FFLAGS -stand f18 -warn declarations -traceback -warn -heap-arrays)
else()
set(FFLAGS /stand:f18 /4Yd /traceback /warn /heap-arrays)
set(FFLAGS /stand:f18 /warn:declarations /traceback /warn /heap-arrays)
# Note: -g is /debug:full for ifort Windows
endif()

elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
list(APPEND FFLAGS -march=native -fimplicit-none)

Expand All @@ -23,9 +18,9 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)

list(APPEND FFLAGS -Wall -Wextra -Wpedantic -Werror=array-bounds -Warray-temporaries)
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL PGI)

set(FFLAGS -C -Mdclchk)
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL Flang)

set(FFLAGS -W)
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL NAG)
list(APPEND FFLAGS -u -C=all)
endif()
24 changes: 18 additions & 6 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
project('Object-oriented HDF5 Fortran', 'fortran',
meson_version : '>=0.50',
meson_version : '>=0.51.2',
version : '1.0.0')

quiet = ['-w']

fc = meson.get_compiler('fortran')
if fc.get_id() == 'gcc'
add_global_arguments('-O', '-fimplicit-none', '-Wextra', '-Wpedantic', language : 'fortran')
add_project_arguments('-O', '-fimplicit-none', '-Wextra', '-Wpedantic', language : 'fortran')
quiet = ['-Wno-compare-reals', '-Wno-maybe-uninitialized']
else
quiet = ['-w']
if fc.version().version_compare('>=8')
add_project_arguments('-std=f2018', language : 'fortran')
endif
elif fcid == 'intel'
add_project_arguments('-warn', '-heap-arrays', '-stand f18', language : 'fortran')
elif fcid == 'intel-cl'
add_project_arguments('/warn', '/heap-arrays', '/stand:f18', language : 'fortran')
elif fcid == 'pgi'
add_project_arguments('-C', '-Mdclchk', language : 'fortran')
endif

hdf5 = dependency('hdf5', language : 'fortran')

h5run = fc.run('use h5lt; end', dependencies: hdf5)
h5run = fc.run('use h5lt; end', dependencies: hdf5, name: 'HDF5')
if h5run.returncode() != 0
error('HDF5 linking problems: ' + h5run.stderr())
endif

subdir('src')
ooh5 = library('oohdf5', hdf5_src, dependencies: hdf5)
ooh5 = library('oohdf5',
sources: hdf5_src,
dependencies: hdf5
)

# --- testing
subdir('tests')
Expand Down

0 comments on commit e123cd3

Please sign in to comment.