Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,25 @@ project(
'buildtype=debugoptimized',
],
)
has_cc = add_languages('c', required: get_option('python'), native: false)
fc_nested_functions = meson.get_compiler('fortran').run(
'call a(); contains; subroutine a(); print "(a)", "Nested functions supported"; end; end',
).returncode() == 0
if fc_nested_functions
has_cc = add_languages('c', required: get_option('python'), native: false)
else
has_cc = false
if get_option('python')
error('Cannot compile Python API, Fortran compiler does not support nested functions')
else
warning('Fortran compiler does not support nested functions, C API is disabled')
endif
endif

minpack_lib = library(
meson.project_name(),
sources: files(
'src/minpack.f90',
'src/minpack_capi.f90',
fc_nested_functions ? 'src/minpack_capi.f90' :,
),
install: true,
)
Expand All @@ -38,9 +50,11 @@ install_data(
install_dir: get_option('datadir')/'licenses'/meson.project_name()
)

install_headers(
minpack_header,
)
if fc_nested_functions
install_headers(
minpack_header,
)
endif

module_id = meson.project_name()
meson.add_install_script(
Expand Down