Skip to content

Commit 5ec49d5

Browse files
committed
test meson and modern cmake
1 parent d35fdf3 commit 5ec49d5

5 files changed

Lines changed: 42 additions & 35 deletions

File tree

.appveyor.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ init:
1313
- cmd: set PATH=%MINGW_DIR%;%PATH%
1414

1515
install:
16-
- cd build
17-
- cmd: cmake -G "MinGW Makefiles" -DCMAKE_SH="CMAKE_SH-NOTFOUND" ..
18-
- sh: cmake ..
19-
- cmake --build .
16+
- cmd: cmake -G "MinGW Makefiles" -DCMAKE_SH="CMAKE_SH-NOTFOUND" -B build
17+
- sh: cmake -B build
18+
- cmake --build build --parallel
2019

2120
test_script:
22-
- ctest --output-on-failure
21+
- cd build
22+
- ctest --parallel --output-on-failure
2323

.travis.yml

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# gfortran >= 6
2-
language: c
2+
language: python
33
group: travis_latest
44
dist: xenial
55

66
git:
77
depth: 25
88
quiet: true
99

10-
env: FC=gfortran
10+
env: FC=gfortran-6
1111

1212
addons:
1313
apt:
@@ -19,21 +19,16 @@ matrix:
1919
include:
2020
- os: linux
2121
env: FC=gfortran-6
22-
- os: windows
23-
install:
24-
- cd $TRAVIS_BUILD_DIR/build
25-
- cmake -G "MinGW Makefiles" -DCMAKE_SH="CMAKE_SH-NOTFOUND" ..
26-
27-
install:
28-
- cd $TRAVIS_BUILD_DIR/build
29-
30-
script:
31-
- cmake -Drealbits=32 ..
32-
- cmake --build .
33-
- ctest --output-on-failure
34-
35-
- cmake -Drealbits=64 ..
36-
- cmake --build .
37-
- ctest --output-on-failure
38-
39-
22+
script:
23+
- meson setup -Drealbits=32 build
24+
- meson test -C build
25+
- os: linux
26+
env: FC=gfortran-6
27+
script:
28+
- meson setup -Drealbits=64 build
29+
- meson test -C build
30+
31+
before_install:
32+
- python -m pip install meson
33+
- curl -Ls https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip -o ninja-linux.zip
34+
- sudo unzip ninja-linux.zip -d /usr/local/bin/

build/.ignore

Whitespace-only changes.

cmake/compilers.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
33

44
if(NOT WIN32)
5-
set(FFLAGS -stand f18 -implicitnone -traceback -warn -heap-arrays)
5+
set(FFLAGS -stand f18 -warn declarations -traceback -warn -heap-arrays)
66
else()
7-
set(FFLAGS /stand:f18 /4Yd /traceback /warn /heap-arrays)
7+
set(FFLAGS /stand:f18 /warn:declarations /traceback /warn /heap-arrays)
88
# Note: -g is /debug:full for ifort Windows
99
endif()
1010

@@ -18,9 +18,9 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
1818
list(APPEND FFLAGS -ffpe-trap=overflow)
1919
endif()
2020
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL PGI)
21-
21+
set(FFLAGS -C -Mdclchk)
2222
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL Flang)
23-
23+
set(CFLAGS -W)
2424
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL NAG)
2525
list(APPEND FFLAGS -f2008 -C -colour -gline -nan -info -u)
2626
endif()

meson.build

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
1-
project('MapTran', 'fortran', default_options : ['default_library=static'])
1+
project('MapTran', 'fortran',
2+
meson_version : '>=0.50',
3+
default_options : ['default_library=static', 'buildtype=release'])
24

3-
REALBITS = '-DREALBITS='+get_option('realbits')
5+
realbits = '-DREALBITS='+get_option('realbits')
46

57
fc = meson.get_compiler('fortran')
68
if fc.get_id() == 'gcc'
7-
add_global_arguments('-fimplicit-none', '-Wall', '-Wextra', '-Wpedantic', language : 'fortran')
9+
add_project_arguments('-fimplicit-none', '-Wall', '-Wextra', '-Wpedantic', language : 'fortran')
10+
if fc.version().version_compare('>=8')
11+
add_project_arguments('-std=f2018', language : 'fortran')
12+
endif
13+
elif fcid == 'intel'
14+
add_project_arguments('-warn', '-heap-arrays', '-stand f18', language : 'fortran')
15+
elif fcid == 'intel-cl'
16+
add_project_arguments('/warn', '/heap-arrays', '/stand:f18', language : 'fortran')
17+
elif fcid == 'pgi'
18+
add_project_arguments('-C', '-Mdclchk', language : 'fortran')
819
endif
920

1021
# --- Maptran library
1122
maptran = library('maptran', 'src/maptran.F90', 'src/vallado.F90', 'src/aer.f90', 'src/ecef.f90', 'src/enu.f90',
12-
fortran_args : REALBITS)
23+
fortran_args : realbits)
1324

1425
# --- testing
1526
mtexe = executable('testmaptran', 'tests/test_mod.f90', 'src/assert.F90',
1627
link_with : maptran,
17-
fortran_args : REALBITS)
28+
fortran_args : realbits)
1829

19-
test('Maptran', mtexe)
30+
test('Maptran'+realbits, mtexe,
31+
timeout: 30)

0 commit comments

Comments
 (0)