Skip to content

Commit 9e8a0b0

Browse files
committed
meson: update for tkr
1 parent 82e834d commit 9e8a0b0

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

meson.build

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ project('nc4fortran', 'fortran',
33
version: files('VERSION'),
44
default_options : ['default_library=static', 'buildtype=release', 'warning_level=3'])
55

6+
fs = import('fs')
7+
68
# --- find netcdf
79
fc = meson.get_compiler('fortran')
810
os = host_machine.system()
@@ -14,18 +16,10 @@ quiet = fc.get_supported_arguments(['-w', '-Wno-compare-reals', '-Wno-maybe-unin
1416

1517
#== find NetCDF
1618

17-
# when using CMake, need to capitalize module name like in CMake
18-
netcdf = [dependency('netcdf', language: 'fortran', required : false, disabler: true, cmake_module_path : 'cmake/Modules')]
19-
if os == 'darwin' # homebrew has broken PkgConfig for NetCDF, the test below is false OK without this
20-
netcdf += fc.find_library('netcdff', dirs: '/usr/local/opt/netcdf/lib', required : false, disabler: true)
21-
endif
22-
23-
if not fc.links('use netcdf, only : nf90_inq_varid; end', name: 'NetCDF', dependencies : netcdf)
24-
netcdf = [disabler()]
25-
endif
19+
netcdf = dependency('netcdf', language: 'fortran', required : false, disabler: true, cmake_module_path : 'cmake/Modules')
2620

2721
if not meson.is_subproject()
28-
assert(netcdf[0].found(), 'NetCDF Fortran is required')
22+
assert(netcdf.found(), 'NetCDF Fortran is required')
2923
endif
3024

3125
# ---

src/meson.build

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ configure_file(
1919
configuration : reader_template
2020
)
2121

22-
ret = run_command(python, '-c', 'print(open("' + meson.current_source_dir() / 'writer_template.in.f90' + '").read())')
23-
writer_template = configuration_data()
24-
writer_template.set('writer_template', ret.stdout())
2522
configure_file(
2623
input : 'writer.in.f90',
2724
output : 'writer.f90',
28-
configuration : writer_template
29-
)
25+
configuration : {
26+
'writer_template_r32': fs.read('writer_template_r32.in.f90'),
27+
'writer_template_r64': fs.read('writer_template_r64.in.f90'),
28+
'writer_template_i32': fs.read('writer_template_i32.in.f90'),
29+
'writer_template_i64': fs.read('writer_template_i64.in.f90')
30+
})
3031

3132
nc4_src = files('interface.f90', 'attributes.f90',
3233
'read.f90', meson.current_build_dir() / 'reader.f90',

0 commit comments

Comments
 (0)