~imperator/public-inbox

Add meson build system v1 PROPOSED

Stefan Tatschner: 1
 Add meson build system

 2 files changed, 47 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~imperator/public-inbox/patches/13968/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] Add meson build system Export this patch

This patch makes all Makefiles and setup.py files obsolete. The project
can be build like this:

        $ meson build && ninja -C build

The resulting *.so will be in `build`.

If you desire to build with mpi support:

        $ meson build -Dmpi=true && ninja -C build
---

Resent to the mailing list I recently discovered.

 meson.build       | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 meson_options.txt |  1 +
 2 files changed, 47 insertions(+)
 create mode 100644 meson.build
 create mode 100644 meson_options.txt

diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..1ebbf3d
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,46 @@
project(
  'minifftw', 'c',
  version : '1',
  license : 'GPL',
  meson_version : '>= 0.47',
)

pymod = import('python')
py = pymod.find_installation('python3', required : true)
c_srcs = ['minifftw.c', 'plancapsule.c', 'util.c']

# numpy dependency consist of just includes
message('searching numpy include dirs')
numpy_cmd = run_command(
  'python3',
  ['-c', 'import numpy; print(numpy.get_include())'],
  check : true,
)
numpy_dep = declare_dependency(
  include_directories : include_directories(numpy_cmd.stdout().strip())
)

cc = meson.get_compiler('c')
minifftw_c_args = []
minifftw_link_args = ['-lfftw3_threads']
minifftw_deps = [
  dependency('threads'),
  cc.find_library('m', required : true),
  py.dependency(),
  numpy_dep,
]

if get_option('mpi')
  minifftw_c_args += '-DMFFTW_MPI'
  minifftw_link_args += '-lfftw3_mpi'
  minifftw_deps += dependency('mpi', language: 'c')
endif

py.extension_module(
  'minifftw',
  c_srcs,
  dependencies : minifftw_deps,
  c_args : minifftw_c_args,
  link_args : minifftw_link_args,
)

diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..4da0a09
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1 @@
option('mpi', type : 'boolean', value : false, description : 'Use the mpi library')
-- 
2.28.0