-
Notifications
You must be signed in to change notification settings - Fork 27
/
meson.build
96 lines (78 loc) · 2.98 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
project('python-flint', 'cython', 'c')
#
# The minimum versions are because we know that it will not work with earlier
# versions. The maximum versions are because python-flint was not tested
# against future versions that didn't exist at the time of release. In future
# if it seems like new releases do not always break the build of python-flint
# then we can consider not using a speculative upper version cap here.
#
flint_lower = '>=3.0'
flint_upper = '<3.2'
cython_lower = '>=3.0'
cython_upper = '<3.2'
py = import('python').find_installation(pure: false)
dep_py = py.dependency()
cc = meson.get_compiler('c')
cy = meson.get_compiler('cython')
gmp_dep = dependency('gmp')
mpfr_dep = dependency('mpfr')
flint_dep = dependency('flint')
#
# For the source release, we should by default fail for new untested versions
# with a clear error message about the version mismatch.
#
# We need an option to disable this though so that we can test newer versions
# of Flint. Also good to have an escape hatch for users since we don't know
# that future versions of Flint will not work.
#
ver_message = '''
Invalid @0@ version:
Version needed is: @0@ @2@, @3@
Version found is: @0@ == @1@
By default, python-flint will only build against @0@ versions that have
been tested. If you are sure you want to use this version of @0@, you can
disable this check with -Dflint_version_check=false.
If building from the source directory using meson directly, you can do this
with:
meson setup build -Dflint_version_check=false
If you are installing with pip, you can do this with:
pip install --config-settings=setup-args="-Dflint_version_check=false" python-flint
Other build frontends have similar options for passing this to meson.
'''
if get_option('flint_version_check')
if not (flint_dep.version().version_compare(flint_lower) and
flint_dep.version().version_compare(flint_upper))
error(ver_message.format('FLINT', flint_dep.version(), flint_lower, flint_upper))
endif
if not (cy.version().version_compare(cython_lower) and
cy.version().version_compare(cython_upper))
error(ver_message.format('Cython', cy.version(), cython_lower, cython_upper))
endif
endif
# flint.pc was missing -lflint until Flint 3.1.0
if flint_dep.version().version_compare('<3.1')
flint_dep = cc.find_library('flint')
have_acb_theta = false
else
have_acb_theta = true
endif
pyflint_deps = [dep_py, gmp_dep, mpfr_dep, flint_dep]
add_project_arguments(
'-X', 'embedsignature=True',
'-X', 'emit_code_comments=True',
language : 'cython'
)
if get_option('coverage')
add_project_arguments('-X', 'linetrace=True', language : 'cython')
add_project_arguments('-DCYTHON_TRACE=1', language : 'c')
endif
# Add rpaths for a local build of flint found via pkgconfig
# https://github.com/mesonbuild/meson/issues/13046
if get_option('add_flint_rpath')
flint_lib_dir = flint_dep.get_pkgconfig_variable('libdir')
add_project_link_arguments(
'-Wl,-rpath=' + flint_lib_dir,
language: 'c',
)
endif
subdir('src/flint')