Skip to content

Commit 982bb90

Browse files
authored
Update dependency handling in meson (#136)
1 parent 270d31b commit 982bb90

2 files changed

Lines changed: 15 additions & 44 deletions

File tree

config/meson.build

Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -108,43 +108,17 @@ else
108108
endif
109109

110110
# Create the tool chain library as subproject
111-
mctc_dep = dependency('mctc-lib', required: false)
112-
if not mctc_dep.found()
113-
mctc_prj = subproject(
114-
'mctc-lib',
115-
version: '>=0.2',
116-
default_options: [
117-
'default_library=static',
118-
],
119-
)
120-
mctc_dep = mctc_prj.get_variable('mctc_dep')
121-
122-
if install
123-
install_data(
124-
mctc_prj.get_variable('mctc_lic'),
125-
install_dir: get_option('datadir')/'licenses'/meson.project_name()/'mctc-lib'
126-
)
127-
endif
128-
endif
111+
mctc_dep = dependency(
112+
'mctc-lib',
113+
fallback: ['mctc-lib', 'mctc_dep'],
114+
default_options: ['default_library=static'],
115+
)
129116
lib_deps += mctc_dep
130117

131-
# Create the tool chain library as subproject
132-
multicharge_dep = dependency('multicharge', required: false)
133-
if not multicharge_dep.found()
134-
multicharge_prj = subproject(
135-
'multicharge',
136-
version: '>=0.1',
137-
default_options: [
138-
'default_library=static',
139-
],
140-
)
141-
multicharge_dep = multicharge_prj.get_variable('multicharge_dep')
142-
143-
if install
144-
install_data(
145-
multicharge_prj.get_variable('multicharge_lic'),
146-
install_dir: get_option('datadir')/'licenses'/meson.project_name()/'multicharge'
147-
)
148-
endif
149-
endif
118+
# Create the electrostatic library as subproject
119+
multicharge_dep = dependency(
120+
'multicharge',
121+
fallback: ['multicharge', 'multicharge_dep'],
122+
default_options: ['default_library=static'],
123+
)
150124
lib_deps += multicharge_dep

test/unit/meson.build

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,16 @@
1515
# along with dftd4. If not, see <https://www.gnu.org/licenses/>.
1616

1717
# Create mstore as subproject for testing
18-
mstore_prj = subproject(
18+
mstore_dep = dependency(
1919
'mstore',
20-
version: '>=0.1',
20+
fallback: ['mstore', 'mstore_dep'],
21+
default_options: ['default_library=static'],
2122
required: not meson.is_subproject(),
22-
default_options: [
23-
'default_library=static',
24-
],
2523
)
2624
# If we do not find mstore and are a subproject, we just skip testing
27-
if not mstore_prj.found()
25+
if not mstore_dep.found()
2826
subdir_done()
2927
endif
30-
mstore_dep = mstore_prj.get_variable('mstore_dep')
3128

3229
tests = [
3330
'ncoord',

0 commit comments

Comments
 (0)