Skip to content

Commit 523692e

Browse files
committed
Use meson as build system
1 parent 44dcb11 commit 523692e

6 files changed

Lines changed: 73 additions & 121 deletions

File tree

conda-recipe-cf/meta.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ requirements:
1818
- {{ compiler('c') }}
1919
- {{ stdlib('c') }}
2020
host:
21+
- meson-python >=0.13.0
22+
- meson
23+
- pkg-config
2124
- python
2225
- python-gil # [py>=314]
2326
- pip >=25.0
24-
- setuptools >=77
2527
- mkl-devel
2628
- cython
2729
- wheel >=0.45.1

conda-recipe/meta.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ requirements:
1818
- {{ compiler('c') }}
1919
- {{ stdlib('c') }}
2020
host:
21+
- meson-python >=0.13.0
22+
- meson
23+
- pkg-config
2124
- python
2225
- python-gil # [py>=314]
2326
- pip >=25.0
24-
- setuptools >=77
2527
- mkl-devel
2628
- cython
2729
- wheel >=0.45.1

meson.build

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
project(
2+
'mkl-service',
3+
['c', 'cython'],
4+
version: run_command(
5+
'python', '-c',
6+
'import os; exec(open("mkl/_version.py").read()); print(__version__)',
7+
check: true
8+
).stdout().strip(),
9+
default_options: [
10+
'buildtype=release',
11+
]
12+
)
13+
14+
py = import('python').find_installation(pure: false)
15+
16+
c_args = ['-DNDEBUG']
17+
18+
thread_dep = dependency('threads')
19+
20+
cc = meson.get_compiler('c')
21+
mkl_rt = cc.find_library('mkl_rt', required: true)
22+
mkl_dep = declare_dependency(dependencies: [mkl_rt])
23+
24+
rpath = ''
25+
if host_machine.system() != 'windows'
26+
rpath = '$ORIGIN/../..:$ORIGIN/../../..'
27+
endif
28+
29+
# C extension
30+
py.extension_module(
31+
'_mklinit',
32+
sources: ['mkl/_mklinitmodule.c'],
33+
dependencies: [mkl_dep, thread_dep],
34+
c_args: c_args + ['-DUSING_MKL_RT'],
35+
install_rpath: rpath,
36+
install: true,
37+
subdir: 'mkl'
38+
)
39+
40+
# Cython extension
41+
py.extension_module(
42+
'_py_mkl_service',
43+
sources: ['mkl/_py_mkl_service.pyx'],
44+
dependencies: [mkl_dep],
45+
c_args: c_args,
46+
install_rpath: rpath,
47+
install: true,
48+
subdir: 'mkl'
49+
)
50+
51+
# Python sources
52+
py.install_sources(
53+
[
54+
'mkl/__init__.py',
55+
'mkl/_init_helper.py',
56+
'mkl/_version.py',
57+
],
58+
subdir: 'mkl'
59+
)
60+
61+
install_subdir(
62+
'mkl/tests',
63+
install_dir: py.get_install_dir() / 'mkl'
64+
)

pyproject.toml

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,11 @@
2424
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525

2626
[build-system]
27-
build-backend = "setuptools.build_meta"
28-
requires = [
29-
"setuptools>=77",
30-
"Cython",
31-
"wheel>=0.45.1",
32-
"build>=1.2.2",
33-
"mkl-devel"
34-
]
27+
build-backend = "mesonpy"
28+
requires = ["meson-python>=0.13.0", "Cython", "mkl-devel"]
3529

3630
[project]
37-
authors = [
38-
{name = "Intel Corporation", email = "scripting@intel.com"}
39-
]
31+
authors = [{name = "Intel Corporation"}]
4032
classifiers = [
4133
"Development Status :: 5 - Production/Stable",
4234
"Intended Audience :: Science/Research",
@@ -71,13 +63,3 @@ test = ["pytest"]
7163
[project.urls]
7264
Download = "http://github.com/IntelPython/mkl-service"
7365
Homepage = "http://github.com/IntelPython/mkl-service"
74-
75-
[tool.setuptools]
76-
include-package-data = true
77-
packages = ["mkl"]
78-
79-
[tool.setuptools.dynamic]
80-
version = {attr = "mkl._version.__version__"}
81-
82-
[tool.setuptools.package-data]
83-
"mkl" = ["tests/*.py"]

setup.py

Lines changed: 0 additions & 98 deletions
This file was deleted.

0 commit comments

Comments
 (0)