diff --git a/meson.build b/meson.build new file mode 100644 index 000000000..2a98039ef --- /dev/null +++ b/meson.build @@ -0,0 +1,24 @@ +project('euphonic', 'c', meson_version: '>=1.1') + +build = get_option('python_only') ? disabler() : [] + +src = ['c/_euphonic.c', 'c/dyn_mat.c', 'c/util.c', 'c/py_util.c', 'c/load_libs.c'] + +openmp = dependency('openmp', required: false, language: 'c') + +py = import('python').find_installation(pure: false) +py_dep = py.dependency() + +np = dependency('numpy', required: false) + +if not np.found() # Try default + np_inc = include_directories(py.get_path('platlib') / 'numpy/core/include') + np = declare_dependency(include_directories: np_inc) +endif + +py.extension_module( + '_euphonic', + src, + dependencies: [build, py_dep, np, openmp], + install: true, +) diff --git a/meson.options b/meson.options new file mode 100644 index 000000000..75a53ee1b --- /dev/null +++ b/meson.options @@ -0,0 +1 @@ +option('python_only', type : 'boolean', value : false) diff --git a/pyproject.toml b/pyproject.toml index 85107557a..d67c6c7e4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,10 @@ +[build-system] +build-backend = 'mesonpy' +requires = ["meson-python", + "packaging", + "numpy>=1.24.0", + "versioneer[toml]==0.29"] + [project] name = "Euphonic" description = "Euphonic calculates phonon bandstructures and inelastic neutron scattering intensities from modelling code output (e.g. CASTEP)" @@ -33,13 +40,6 @@ dependencies = [ ] dynamic = ["version"] -[build-system] -requires = ["packaging", - "numpy>=1.24.0", - "versioneer[toml]==0.29", - "setuptools>=61.0.0"] -build-backend = "setuptools.build_meta" - [project.urls] Homepage = "https://github.com/pace-neutrons/Euphonic" Repository = "https://github.com/pace-neutrons/Euphonic.git" @@ -67,6 +67,3 @@ versionfile_source = "euphonic/_version.py" versionfile_build = "euphonic/_version.py" tag_prefix = "v" parentdir_prefix = "Euphonic-" - -[tool.setuptools.packages.find] -include = ["euphonic*"] \ No newline at end of file