forked from grimme-lab/CPCM-X
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
90 lines (77 loc) · 2.22 KB
/
meson.build
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
# This file is part of CPCM-X.
# SPDX-Identifier: LGPL-3.0-or-later
#
# CPCM-X is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# CPCM-X is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with CPCM-X. If not, see <https://www.gnu.org/licenses/>.
project(
'cpx',
'fortran', 'c',
version: files('version.txt'),
meson_version: '>=0.60.0',
default_options: [
'buildtype=debugoptimized',
'default_library=static',
],
)
fc = meson.get_compiler('fortran')
fc_id = fc.get_id()
lib_deps = []
if get_option('openmp')
omp_dep = dependency('openmp', required: fc_id != 'intel' and fc_id != 'intel-llvm' and fc_id != 'nvidia_hpc')
if not omp_dep.found()
if fc_id == 'intel' or fc_id != 'intel-llvm'
message('Using -qopenmp to use OpenMP with Intel compilers')
omp_dep = declare_dependency(
compile_args: '-qopenmp',
link_args: '-qopenmp',
)
else
message('Using -mp to use OpenMP with NVHPC compilers')
omp_dep = declare_dependency(
compile_args: '-mp',
link_args: '-mp',
)
endif
endif
lib_deps += omp_dep
endif
lib_deps += dependency('threads')
subdir('config')
srcs = []
subdir('src')
cpx_lib = library(
meson.project_name(),
sources: srcs,
version: meson.project_version(),
dependencies: lib_deps,
install: true,
)
cpx_dep = declare_dependency(
link_with: cpx_lib,
dependencies: lib_deps,
)
inc_dir=include_directories('.')
subdir('app')
module_id = meson.project_name() / fc_id + '-' + fc.version()
meson.add_install_script(
find_program(files('config'/'install-mod.py')),
get_option('includedir') / module_id,
)
pkg = import('pkgconfig')
pkg.generate(
cpx_lib,
subdirs: ['', module_id],
)
cpxenv = environment()
cpxenv.set('CPXHOME', meson.current_source_dir())
subdir('test')