-
Notifications
You must be signed in to change notification settings - Fork 34
/
meson.build
52 lines (46 loc) · 1.35 KB
/
meson.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
project(
'discretize',
'c', 'cpp', 'cython',
# Note that the git commit hash cannot be added dynamically here
# (it is dynamically generated though setuptools_scm)
version: run_command('python',
[
'-c',
'''
from setuptools_scm import get_version
print(get_version())'''
],
check: true
).stdout().strip(),
license: 'MIT',
meson_version: '>= 1.4.0',
default_options: [
'buildtype=debugoptimized',
'b_ndebug=if-release',
'cpp_std=c++17',
],
)
# https://mesonbuild.com/Python-module.html
py_mod = import('python')
py = py_mod.find_installation(pure: false)
py_dep = py.dependency()
cc = meson.get_compiler('c')
cpp = meson.get_compiler('cpp')
cy = meson.get_compiler('cython')
# generator() doesn't accept compilers, only found programs - cast it.
cython = find_program(cy.cmd_array()[0])
_global_c_args = cc.get_supported_arguments(
'-Wno-unused-but-set-variable',
'-Wno-unused-function',
'-Wno-conversion',
'-Wno-misleading-indentation',
)
add_project_arguments(_global_c_args, language : 'c')
# We need -lm for all C code (assuming it uses math functions, which is safe to
# assume for SciPy). For C++ it isn't needed, because libstdc++/libc++ is
# guaranteed to depend on it.
m_dep = cc.find_library('m', required : false)
if m_dep.found()
add_project_link_arguments('-lm', language : 'c')
endif
subdir('discretize')