-
Notifications
You must be signed in to change notification settings - Fork 9
/
meson.build
131 lines (112 loc) · 3.36 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
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
# This file is part of cpp-d4.
#
# Copyright (C) 2019 Sebastian Ehlert, Marvin Friede
#
# cpp-d4 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.
#
# cpp-d4 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 cpp-d4. If not, see <https://www.gnu.org/licenses/>.
project(
'cpp-d4',
'cpp',
version: '2.2.0',
license: 'LGPL3-or-later',
meson_version: '>=0.51',
default_options: [
'cpp_std=c++11',
'default_library=both',
'warning_level=3',
],
)
cxx = meson.get_compiler('cpp')
if get_option('buildtype') == 'debug'
add_project_arguments(
[
'-Wzero-as-null-pointer-constant',
'-Wlogical-not-parentheses',
'-Db_sanitize=address,undefined'
],
language: 'cpp'
)
add_project_arguments('-fno-omit-frame-pointer', language: 'cpp')
add_project_link_arguments('-fno-omit-frame-pointer', language: 'cpp')
sanitizer = get_option('sanitizer')
if sanitizer == 'asan'
message('Enabling ASan + UBSan + LSan')
add_project_arguments('-Db_sanitize=address,undefined', language: 'cpp')
message('Adding "-fsanitize-address-use-after-scope" argument (ignore the subsequent warnings).')
add_project_arguments('-fsanitize-address-use-after-scope', language: 'cpp')
add_project_link_arguments('-fsanitize-address-use-after-scope', '-fno-omit-frame-pointer', language: 'cpp')
elif sanitizer == 'msan'
message('Enabling Memory Sanitizer (MSan)')
add_project_arguments('-Db_sanitize=memory', language: 'cpp')
elif sanitizer == 'tsan'
message('Enabling Thread Sanitizer (TSan)')
add_project_arguments('-Db_sanitize=thread', language: 'cpp')
else
message('No sanitizers enabled')
endif
endif
deps = []
foreach lib: ['cblas', 'lapacke']
this_dep = dependency(lib, required: false)
if not this_dep.found()
this_dep = cxx.find_library(lib)
endif
deps += this_dep
endforeach
srcs = files(
'src/dftd_cutoff.cpp',
'src/dftd_damping.cpp',
'src/dftd_dispersion.cpp',
'src/dftd_eeq.cpp',
'src/dftd_model.cpp',
'src/dftd_ncoord.cpp',
'src/damping/dftd_atm.cpp',
'src/damping/dftd_rational.cpp',
)
cpp_d4_inc = include_directories('include')
cpp_d4_lib = library(
meson.project_name(),
sources: srcs,
version: meson.project_version(),
include_directories: cpp_d4_inc,
dependencies: deps,
install: true,
)
install_headers(
'include/dftd_cutoff.h',
'include/dftd_damping.h',
'include/dftd_dispersion.h',
'include/dftd_eeq.h',
'include/dftd_geometry.h',
'include/dftd_matrix.h',
'include/dftd_model.h',
'include/dftd_ncoord.h',
'include/dftd_parameters.h',
'include/damping/dftd_atm.h',
'include/damping/dftd_rational.h',
)
cpp_d4_dep = declare_dependency(
link_with: cpp_d4_lib,
include_directories: cpp_d4_inc,
dependencies: deps,
)
executable(
meson.project_name(),
sources: files(
'app/main.cpp',
'app/readxyz.cpp',
),
dependencies: cpp_d4_dep,
install: true,
)
subdir('test')