-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathmeson.build
More file actions
146 lines (135 loc) · 4.08 KB
/
Copy pathmeson.build
File metadata and controls
146 lines (135 loc) · 4.08 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# This file is part of COSMO-X.
# SPDX-Identifier: LGPL-3.0-or-later
#
# COSMO-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.
#
# COSMO-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 COSMO-X. If not, see <https://www.gnu.org/licenses/>.
fc = meson.get_compiler('fortran')
fc_id = fc.get_id()
if fc_id == 'gcc'
add_project_arguments(
'-ffree-line-length-none',
'-fbacktrace',
language: 'fortran',
)
elif fc_id == 'intel' or fc_id == 'intel-llvm'
add_project_arguments(
'-traceback',
language: 'fortran',
)
elif fc_id == 'pgi' or fc_id == 'nvidia_hpc'
add_project_arguments(
'-Mbackslash',
'-Mallocatable=03',
'-traceback',
language: 'fortran',
)
endif
if get_option('openmp')
omp_dep = dependency('openmp')
lib_deps += omp_dep
endif
lapack_vendor = get_option('lapack')
if lapack_vendor == 'auto'
if fc_id == 'intel' or fc_id == 'intel-llvm'
lapack_vendor = 'mkl'
endif
endif
if lapack_vendor == 'mkl'
mkl_dep = []
if fc_id == 'intel' or fc_id == 'intel-llvm'
mkl_dep += fc.find_library('mkl_intel_lp64')
if get_option('openmp')
mkl_dep += fc.find_library('mkl_intel_thread')
endif
elif fc_id == 'gcc'
mkl_dep += fc.find_library('mkl_gf_lp64')
if get_option('openmp')
mkl_dep += fc.find_library('mkl_gnu_thread')
endif
else
error('MKL not supported for this compiler')
endif
if not get_option('openmp')
mkl_dep += fc.find_library('mkl_tbb_thread')
endif
mkl_dep += fc.find_library('mkl_core')
lib_deps += mkl_dep
elif lapack_vendor == 'mkl-rt'
mkl_dep = fc.find_library('mkl_rt')
lib_deps += mkl_dep
elif lapack_vendor == 'openblas'
openblas_dep = dependency('openblas', required: false)
if not openblas_dep.found()
openblas_dep = fc.find_library('openblas')
endif
lib_deps += openblas_dep
if not fc.links('external dsytrs; call dsytrs(); end', dependencies: openblas_dep)
lapack_dep = dependency('lapack', required: false)
if not lapack_dep.found()
lapack_dep = fc.find_library('lapack')
endif
lib_deps += lapack_dep
endif
elif lapack_vendor == 'custom'
custom_deps = []
libs = get_option('custom_libraries')
if libs[0].startswith('-L')
foreach lib: libs
if lib != libs[0]
custom_deps += cc.find_library(lib, dirs: libs[0].substring(2))
endif
endforeach
else
foreach lib: libs
custom_deps += cc.find_library(lib)
endforeach
endif
if (not fc.links('external dsytrs; call dsytrs(); end', dependencies: (get_option('openmp') ? [custom_deps, omp_dep] : [custom_deps])))
error('Custom LAPACK libraries do not link')
elif (not fc.links('external dsytrs; call dgemm(); end', dependencies: (get_option('openmp') ? [custom_deps, omp_dep] : [custom_deps])))
error('Custom BLAS libraries do not link')
endif
lib_deps += custom_deps
else
lapack_dep = dependency('lapack', required: false)
if not lapack_dep.found()
lapack_dep = fc.find_library('lapack')
endif
lib_deps += lapack_dep
blas_dep = dependency('blas', required: false)
if not blas_dep.found()
blas_dep = fc.find_library('blas')
endif
lib_deps += blas_dep
endif
# Create the tool chain library as subproject
mctc_dep = dependency(
'mctc-lib',
version: '>=0.3.0',
fallback: ['mctc-lib', 'mctc_dep'],
default_options: ['default_library=static'],
)
lib_deps += mctc_dep
numsa_dep = dependency(
'numsa',
fallback: ['numsa', 'numsa_dep'],
default_options: ['default_library=static'],
)
lib_deps += numsa_dep
tomlf_dep = dependency(
'toml-f',
version: '>=0.2.0',
fallback: ['toml-f', 'tomlf_dep'],
default_options: ['default_library=static'],
)
lib_deps += tomlf_dep