-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathmeson.build
More file actions
137 lines (106 loc) · 4.02 KB
/
meson.build
File metadata and controls
137 lines (106 loc) · 4.02 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# Meson build file for ANUGA core.
# Version is derived from git tags via `git describe`.
# Tag releases as `3.3.0`, `3.3.1`, etc. — no `v` prefix, matching the
# existing tag convention. Between releases the version will look like
# `3.3.0-4-gabcdef` (4 commits past the tag, short SHA).
#
# Note: project() must be the first statement in meson.build.
# The version is computed inline; git sha/date are fetched after.
project('anuga', 'c', 'cpp', 'cython',
version: run_command('python', ['_git_version.py'], check: false).stdout().strip(),
default_options: ['cpp_std=c++17'])
# Fetch additional git metadata for the generated _version.py
git = find_program('git', required: false, native: true)
if git.found()
_git_sha = run_command(git, ['rev-parse', 'HEAD'], check: false).stdout().strip()
_git_date = run_command(git, ['log', '-1', '--format=%ci', 'HEAD'], check: false).stdout().strip()
else
_git_sha = 'unknown'
_git_date = 'unknown'
endif
add_project_arguments('-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION', language: 'cpp')
add_project_arguments('-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION', language: 'c')
py3 = import('python').find_installation(pure: false)
dep_py = py3.dependency()
py3_version = py3.language_version()
#========================================================
# Setup numpy dependencies
#========================================================
incdir_numpy = run_command(py3,
['-c', 'import os; os.chdir(".."); import numpy; print(numpy.get_include())'],
check: true
).stdout().strip()
if py3_version.version_compare('>3.8')
# Recommended for Python > 3.8
dep_numpy = dependency('numpy')
else
# Fallback for Python 3.8
inc_numpy = include_directories(incdir_numpy)
dep_numpy = declare_dependency(include_directories: inc_numpy)
endif
# FIXME SR: Do we use this now?
#message('NumPy include directory: ' + inc_numpy)
dependencies = [dep_py, dep_numpy]
#========================================================
# Deal with OpenMP
#========================================================
# cc = meson.get_compiler('c')
# if openmp_dep.found()
# if cc.get_id() in ['intel', 'intel-cl', 'icx']
# openmp_flag = '-qopenmp'
# else
# openmp_flag = '-fopenmp'
# endif
# endif
openmp = dependency('openmp', required: false)
if openmp.found()
# On Windows, the mingw compiler does not support OpenMP ATOMIC operations
# so using gcc_win-64 gxx_win-64 provided by conda-forge
# On linux, OpenMP is supported by gcc and g++
# On macOS, OpenMP is not supported by the Apple clang compiler so using
# clang and llvm-openmp provided by conda-forge
#if host_machine.system() == 'windows'
openmp_c_args = ['-O3', '-march=native', '-fopenmp', '-g']
# openmp_c_args = ['-O3', '-march=native','-funroll-loops', '-fvectorize', '-Rpass=loop-vectorize', '-Rpass=loop-unroll', '-g'],
# openmp_c_args = ['-O3', '-march=native', openmp_flag, '-g'],
openmp_deps = dependencies + [openmp]
else
openmp_c_args = []
openmp_deps = dependencies
endif
#========================================================
# Install the Python scripts
#========================================================
conf = configuration_data()
conf.set('PYTHON', py3.full_path())
message('BinDir: ' + get_option('bindir'))
configure_file(
input: 'scripts/anuga_pmesh_gui.py',
output: 'anuga_pmesh_gui',
configuration: conf,
install_dir: get_option('bindir'),
install_mode: 'rwxr-xr-x'
)
configure_file(
input: 'scripts/anuga_sww_merge.py',
output: 'anuga_sww_merge',
configuration: conf,
install_dir: get_option('bindir'),
install_mode: 'rwxr-xr-x'
)
configure_file(
input: 'scripts/anuga_benchmark_omp.py',
output: 'anuga_benchmark_omp',
configuration: conf,
install_dir: get_option('bindir'),
install_mode: 'rwxr-xr-x'
)
configure_file(
input: 'scripts/anuga_run_toml.py',
output: 'anuga_run_toml',
configuration: conf,
install_dir: get_option('bindir'),
install_mode: 'rwxr-xr-x'
)
# Add subdirectories which contains python sources
subdir('anuga')