-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeson.build
More file actions
59 lines (46 loc) · 1.51 KB
/
meson.build
File metadata and controls
59 lines (46 loc) · 1.51 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
# meson.build for PyGeTe
# D. Quigley - University of Warwick
project(
'PyGeTe', # The name of the project
['fortran', 'c'], # The languages that Meson should initialize
# Keyword arguments:
version : '1.1.0',
default_options : ['optimization=2', 'debug=false', 'warning_level=3'],
)
# List of options to pass to fortran compiler
# add_project_arguments(['-fbacktrace', '-fbounds-check'], language:'fortran')
# Use swig to generate wrapper code
swig = find_program('swig')
# Need Python headers to compile the wrapper code
pydep = dependency('python3', version : '>=3.0.0')
py = import('python').find_installation(pure: false)
# NumPy include directory - needed in all submodules
incdir_numpy = run_command(py,
[
'-c',
'import numpy; print(numpy.get_include())'
],
check: false
).stdout().strip()
# List of include directories
incdir = include_directories('include')
wrapper_code = custom_target('wrapper_code',
input : ['src/energy.i'],
output : ['energy_wrap.c', 'energy.py'],
command : [swig, '-python', '-I../include/', '-outcurrentdir', '@INPUT@'],
)
# Source files for fortran library
energy_src = ['src/util.f90','src/energy.f90']
# Build fortran source and wrapper code into extension module
py.extension_module(
'_energy',
[energy_src, wrapper_code],
install: true,
include_directories : [incdir, incdir_numpy],
subdir: 'PyGeTe',
)
# Finally define and install python sources
python_sources = [
'__init__.py',
]
py.install_sources(python_sources, subdir : 'PyGeTe')