Skip to content

Commit

Permalink
Simplify finding of dependencies in meson
Browse files Browse the repository at this point in the history
  • Loading branch information
awvwgk committed Nov 11, 2021
1 parent e27b5a7 commit 8cdb346
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 25 deletions.
23 changes: 5 additions & 18 deletions config/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,9 @@ elif get_option('blas') == 'custom'
endif

# Create the tool chain library as subproject
mctc_dep = dependency('mctc-lib', required: false)
if not mctc_dep.found()
mctc_prj = subproject(
'mctc-lib',
version: '>=0.2',
default_options: [
'default_library=static',
],
)
mctc_dep = mctc_prj.get_variable('mctc_dep')

if install
install_data(
mctc_prj.get_variable('mctc_lic'),
install_dir: get_option('datadir')/'licenses'/meson.project_name()/'mctc-lib'
)
endif
endif
mctc_dep = dependency(
'mctc-lib',
fallback: ['mctc-lib', 'mctc_dep'],
default_options: ['default_library=static'],
)
lib_deps += mctc_dep
11 changes: 4 additions & 7 deletions test/unit/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,16 @@
# along with s-dftd3. If not, see <https://www.gnu.org/licenses/>.

# Create mstore as subproject for testing
mstore_prj = subproject(
mstore_dep = dependency(
'mstore',
version: '>=0.1',
fallback: ['mstore', 'mstore_dep'],
default_options: ['default_library=static'],
required: not meson.is_subproject(),
default_options: [
'default_library=static',
],
)
# If we do not find mstore and are a subproject, we just skip testing
if not mstore_prj.found()
if not mstore_dep.found()
subdir_done()
endif
mstore_dep = mstore_prj.get_variable('mstore_dep')

tests = [
'ncoord',
Expand Down

0 comments on commit 8cdb346

Please sign in to comment.