Skip to content

Commit e123cd3

Browse files
committed
meson testing template
1 parent c23f89c commit e123cd3

File tree

4 files changed

+39
-33
lines changed

4 files changed

+39
-33
lines changed

.travis.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
language: minimal
1+
language: python
22
group: travis_latest
33
dist: xenial
44

@@ -17,17 +17,21 @@ matrix:
1717
include:
1818
- os: linux
1919
env: FC=gfortran-6
20-
- os: osx
21-
env: FC=gfortran
22-
before_install:
23-
- brew update > /dev/null
24-
- brew upgrade cmake > /dev/null
25-
- brew install gcc > /dev/null
26-
- brew install hdf5 > /dev/null
20+
# OSX OK, but move to Azure for speed
21+
# - os: osx
22+
# env: FC=gfortran
23+
# before_install:
24+
# - brew update > /dev/null
25+
# - brew upgrade cmake > /dev/null
26+
# - brew install gcc > /dev/null
27+
# - brew install hdf5 > /dev/null
2728

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

33-
script: ctest --parallel --output-on-failure
35+
install: meson build
36+
37+
script: meson test -C build

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ The library `libh5oo` is built, link it into your program as usual.
4545
```sh
4646
meson build
4747

48-
ninja -C build
49-
```
50-
51-
Optionally test via:
52-
```sh
5348
meson test -C build
5449
```
5550

cmake/compilers.cmake

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
2-
message(STATUS "CMake Build Type: ${CMAKE_BUILD_TYPE}")
3-
41
if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
5-
62
if(NOT WIN32)
7-
set(FFLAGS -stand f18 -implicitnone -traceback -warn -heap-arrays)
3+
set(FFLAGS -stand f18 -warn declarations -traceback -warn -heap-arrays)
84
else()
9-
set(FFLAGS /stand:f18 /4Yd /traceback /warn /heap-arrays)
5+
set(FFLAGS /stand:f18 /warn:declarations /traceback /warn /heap-arrays)
106
# Note: -g is /debug:full for ifort Windows
117
endif()
12-
138
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
149
list(APPEND FFLAGS -march=native -fimplicit-none)
1510

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

2419
list(APPEND FFLAGS -Wall -Wextra -Wpedantic -Werror=array-bounds -Warray-temporaries)
2520
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL PGI)
26-
21+
set(FFLAGS -C -Mdclchk)
2722
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL Flang)
28-
23+
set(FFLAGS -W)
2924
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL NAG)
3025
list(APPEND FFLAGS -u -C=all)
3126
endif()

meson.build

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,36 @@
11
project('Object-oriented HDF5 Fortran', 'fortran',
2-
meson_version : '>=0.50',
2+
meson_version : '>=0.51.2',
33
version : '1.0.0')
44

5+
quiet = ['-w']
6+
57
fc = meson.get_compiler('fortran')
68
if fc.get_id() == 'gcc'
7-
add_global_arguments('-O', '-fimplicit-none', '-Wextra', '-Wpedantic', language : 'fortran')
9+
add_project_arguments('-O', '-fimplicit-none', '-Wextra', '-Wpedantic', language : 'fortran')
810
quiet = ['-Wno-compare-reals', '-Wno-maybe-uninitialized']
9-
else
10-
quiet = ['-w']
11+
if fc.version().version_compare('>=8')
12+
add_project_arguments('-std=f2018', language : 'fortran')
13+
endif
14+
elif fcid == 'intel'
15+
add_project_arguments('-warn', '-heap-arrays', '-stand f18', language : 'fortran')
16+
elif fcid == 'intel-cl'
17+
add_project_arguments('/warn', '/heap-arrays', '/stand:f18', language : 'fortran')
18+
elif fcid == 'pgi'
19+
add_project_arguments('-C', '-Mdclchk', language : 'fortran')
1120
endif
1221

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

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

2029
subdir('src')
21-
ooh5 = library('oohdf5', hdf5_src, dependencies: hdf5)
30+
ooh5 = library('oohdf5',
31+
sources: hdf5_src,
32+
dependencies: hdf5
33+
)
2234

2335
# --- testing
2436
subdir('tests')

0 commit comments

Comments
 (0)