-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathmeson.build
More file actions
94 lines (83 loc) · 2.12 KB
/
meson.build
File metadata and controls
94 lines (83 loc) · 2.12 KB
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
project(
'mkl_random',
['c', 'cpp', 'cython'],
version: run_command(
'python', '-c',
'import os; exec(open("mkl_random/_version.py").read()); print(__version__)',
check: true
).stdout().strip(),
default_options: [
'cpp_std=c++11',
'buildtype=release',
]
)
py = import('python').find_installation(pure: false)
py_dep = py.dependency()
# numpy includes
np_dir = run_command(py,
['-c', 'import numpy; print(numpy.get_include())'],
check: true
).stdout().strip()
inc_np = include_directories(np_dir, 'mkl_random/src')
# compiler/linker
cpp = meson.get_compiler('cpp')
cpp_args = [
'-D_FILE_OFFSET_BITS=64',
'-D_LARGEFILE_SOURCE=1',
'-D_LARGEFILE64_SOURCE=1',
'-DPY_ARRAY_UNIQUE_SYMBOL=mkl_random_ext',
'-DNDEBUG'
]
link_args = []
if cpp.get_argument_syntax() == 'msvc'
link_args += ['Advapi32.lib']
else
cpp_args += ['-Wno-unused-but-set-variable', '-Wno-unused-function']
endif
mkl_dep = dependency('MKL', method: 'cmake',
modules: ['MKL::MKL'],
cmake_args: [
'-DMKL_ARCH=intel64',
'-DMKL_LINK=dynamic',
'-DMKL_THREADING=intel_thread',
'-DMKL_INTERFACE=lp64'
],
required: true
)
py.extension_module(
'mklrand',
sources: [
'mkl_random/mklrand.pyx',
'mkl_random/src/mkl_distributions.cpp',
'mkl_random/src/randomkit.cpp'
],
include_directories: inc_np,
dependencies: [mkl_dep, py_dep],
cpp_args: cpp_args,
link_args: link_args,
override_options: ['cython_language=cpp'],
install: true,
subdir: 'mkl_random'
)
# install python sources
py.install_sources(
[
'mkl_random/__init__.py',
'mkl_random/_init_helper.py',
'mkl_random/_patch_numpy.py',
'mkl_random/_version.py',
],
subdir: 'mkl_random'
)
py.install_sources(
[
'mkl_random/interfaces/__init__.py',
'mkl_random/interfaces/_numpy_random.py',
'mkl_random/interfaces/numpy_random.py',
],
subdir: 'mkl_random/interfaces'
)
install_subdir(
'mkl_random/tests',
install_dir: py.get_install_dir() / 'mkl_random'
)