forked from sagemath/sage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
151 lines (140 loc) · 4.81 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# Compilers
cc = meson.get_compiler('c')
cpp = meson.get_compiler('cpp')
cython = meson.get_compiler('cython')
# Setup dependencies that are needed by many modules
inc_numpy = run_command(
py,
[
'-c',
'''
import numpy
print(numpy.get_include())
'''.strip(),
],
check: true,
).stdout().strip()
numpy = declare_dependency(include_directories: inc_numpy)
inc_cysignals = run_command(
py,
[
'-c',
'''
import cysignals
print(cysignals.__file__.replace('__init__.py', ''))
'''.strip(),
],
check: true,
).stdout().strip()
cysignals = declare_dependency(include_directories: inc_cysignals)
inc_gmpy2 = run_command(
py,
[
'-c',
'''
import gmpy2
print(gmpy2.__file__.replace('__init__.py', ''))
'''.strip(),
],
check: true,
).stdout().strip()
gmpy2 = declare_dependency(include_directories: inc_gmpy2)
gmp = dependency('gmp')
inc_cypari2 = run_command(
py,
[
'-c',
'''
import cypari2
print(cypari2.__file__.replace('__init__.py', ''))
'''.strip(),
],
check: true,
).stdout().strip()
cypari2 = declare_dependency(include_directories: inc_cypari2)
pari = cc.find_library('pari')
mpfr = cc.find_library('mpfr')
flint = dependency('flint', version: '>=3.0.0')
if flint.version().version_compare('<3.1')
# In older versions of flint, pkg-config file is broken, so we manually use find_library
# This has been fixed in flint v3.1: https://github.com/flintlib/flint/pull/1647
flint = cc.find_library('flint')
endif
blas_order = []
if host_machine.system() == 'darwin'
blas_order += 'accelerate'
endif
if host_machine.cpu_family() == 'x86_64'
blas_order += 'mkl'
endif
# pkg-config uses a lower-case name while CMake uses a capitalized name, so try
# that too to make the fallback detection with CMake work
blas_order += ['cblas', 'openblas', 'OpenBLAS', 'flexiblas', 'blis', 'blas']
blas = dependency(blas_order)
gsl = dependency('gsl', version: '>=2.5', required: true)
gd = cc.find_library('gd')
# Only some platforms have a standalone math library (https://mesonbuild.com/howtox.html#add-math-library-lm-portably)
m = cc.find_library('m', required: false)
m4ri = cc.find_library('m4ri')
m4rie = cc.find_library('m4rie')
mtx = cc.find_library('mtx', required: false, disabler: true)
png = cc.find_library('png', required: false)
if not png.found()
png = cc.find_library('png16')
endif
zlib = cc.find_library('z')
# Cannot be found via pkg-config
ec = cc.find_library('ec')
ecm = cc.find_library('ecm')
ppl = cc.find_library('ppl')
gmpxx = cc.find_library('gmpxx')
fflas = dependency('fflas-ffpack')
fplll = dependency('fplll')
givaro = cc.find_library('givaro')
linbox = dependency('linbox', required: false)
if not linbox.found()
linbox = cc.find_library('linbox')
endif
mpc = cc.find_library('mpc')
mpfi = cc.find_library('mpfi')
# Cannot be found via pkg-config (pkg-config file will be added in 4.13)
# Test for common.h header that was added in 4.12 as a indirect version check
gap = cc.find_library('gap', has_headers: ['gap/common.h'])
singular = dependency('Singular')
maxima = find_program('maxima', required: true)
# Cannot be found via pkg-config
ntl = cc.find_library('ntl')
# Meson currently ignores include_directories for Cython modules, so we
# have to add them manually.
# https://github.com/mesonbuild/meson/issues/9562
add_project_arguments('-I', meson.current_source_dir(), language: 'cython')
add_project_arguments('-I', meson.current_build_dir(), language: 'cython')
# Add global compiler flags
add_project_arguments('-X auto_pickle=False', language: 'cython')
add_project_arguments('-X autotestdict=False', language: 'cython')
add_project_arguments('-X binding=False', language: 'cython')
add_project_arguments('-X c_api_binop_methods=True', language: 'cython')
add_project_arguments('-X cdivision=True', language: 'cython')
add_project_arguments('-X cpow=True', language: 'cython')
add_project_arguments('-X embedsignature=True', language: 'cython')
add_project_arguments('--embed-positions', language: 'cython')
add_project_arguments('-X fast_getattr=True', language: 'cython')
#add_project_arguments('-X language_level="3"', language : 'cython')
add_project_arguments('-X legacy_implicit_noexcept=True', language: 'cython')
add_project_arguments(
'-X preliminary_late_includes_cy28=True',
language: 'cython',
)
inc_cpython = include_directories('sage/cpython')
inc_rings = include_directories('sage/rings')
inc_rings_finite = include_directories('sage/rings/finite_rings')
inc_flint = include_directories('sage/libs/flint')
inc_gsl = include_directories('sage/libs/gsl')
inc_ntl = include_directories('sage/libs/ntl')
inc_arb = include_directories('sage/libs/arb')
inc_data_structures = include_directories('sage/data_structures')
inc_ext = include_directories('sage/ext')
inc_partn_ref2 = include_directories('sage/groups/perm_gps/partn_ref2')
inc_src = include_directories('.')
# Submodules
subdir('sage')