90 lines
2.3 KiB
Meson
90 lines
2.3 KiB
Meson
# the loess python module is built using swig
|
|
#
|
|
# Compiling this module requires a matching numpy.i include file from
|
|
# https://github.com/numpy/numpy/blob/main/tools/swig/numpy.i
|
|
|
|
project('loess', 'c', 'fortran',
|
|
version : '0.3',
|
|
meson_version: '>= 1.3',
|
|
default_options: [
|
|
'c_std=c99',
|
|
'cpp_std=c++14',
|
|
'fortran_std=legacy',
|
|
'python.install_env=auto',
|
|
'warning_level=2',
|
|
]
|
|
)
|
|
|
|
py_mod = import('python')
|
|
py3 = py_mod.find_installation('python3')
|
|
py3_dep = py3.dependency()
|
|
|
|
ff = meson.get_compiler('fortran')
|
|
blas_dep = ff.find_library('blas', required: true)
|
|
|
|
# silence fortran warnings
|
|
_global_ff_args = ff.get_supported_arguments(
|
|
'-fallow-argument-mismatch',
|
|
'-Wno-conversion',
|
|
'-Wno-unused-dummy-argument',
|
|
'-Wno-unused-variable',
|
|
'-Wno-unused-parameter',
|
|
'-Wno-compare-reals',
|
|
'-Wno-intrinsic-shadow',
|
|
'-Wno-return-type',
|
|
'-Wno-do-subscript',
|
|
'-Wno-argument-mismatch',
|
|
)
|
|
add_project_arguments(_global_ff_args, language : 'fortran')
|
|
|
|
# silence c warnings
|
|
cc = meson.get_compiler('c')
|
|
_global_cc_args = cc.get_supported_arguments(
|
|
'-Wno-argument-mismatch',
|
|
'-Wno-dangling-else',
|
|
'-Wno-format-extra-args',
|
|
'-Wno-implicit-function-declaration',
|
|
'-Wno-implicit-int',
|
|
'-Wno-int-in-bool-context',
|
|
'-Wno-maybe-uninitialized',
|
|
'-Wno-misleading-indentation',
|
|
'-Wno-return-type',
|
|
'-Wno-unused-result',
|
|
'-Wno-unused-variable',
|
|
'-Wno-unused-function',
|
|
'-Wno-unused-parameter',
|
|
'-Wno-write-strings',
|
|
)
|
|
add_project_arguments(_global_cc_args, language : 'c')
|
|
|
|
# swig wrapper
|
|
|
|
swig = find_program('swig')
|
|
loess_module = custom_target(
|
|
input: ['src/loess.i'],
|
|
output: ['@BASENAME@_wrap.c', '@BASENAME@.py'],
|
|
command: [swig, '-python', '-py3', '-o', '@OUTPUT0@', '@INPUT@'],
|
|
install: true,
|
|
install_dir: [false, py3.get_install_dir()],
|
|
)
|
|
|
|
# shared library
|
|
loess_src = ['src/loess.c', 'src/loessc.c', 'src/predict.c', 'src/misc.c', 'src/loessf.f', 'src/dqrsl.f', 'src/dsvdc.f', 'src/fix_main.c', loess_module]
|
|
|
|
numpy_dep = dependency('numpy')
|
|
|
|
loess_lib = py3.extension_module('_loess',
|
|
loess_src,
|
|
include_directories: ['src'],
|
|
dependencies : [py3_dep, blas_dep, numpy_dep],
|
|
install: true,
|
|
)
|
|
|
|
loess_dep = declare_dependency(
|
|
sources : [loess_module[1]],
|
|
dependencies : [py3_dep, blas_dep],
|
|
link_with : loess_lib,
|
|
)
|
|
|
|
test('loess', py3, args : ['-c', 'from loess import loess; exit(0)'])
|