Skip to content

Commit

Permalink
meson build: fall back to dependancy if find_library fails (#78)
Browse files Browse the repository at this point in the history
* find libs with dependency rather than find_library

find_library only does a basic search for libs where dependency can use
cmake and pkg-config. this is helpful on systems like nix where
libraries are located over may uniquely named directories

* use find_library for deps and fall back to dependency
  • Loading branch information
a-n-n-a-l-e-e authored Nov 18, 2023
1 parent 58eb7d9 commit dd17e2e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,28 @@ if host_machine.system() == 'darwin'
blas_deps = [dependency('Accelerate')]
else
blas_deps = [cc.find_library('openblas', static: get_option('link_blas_statically'), required : false)]
if not blas_deps[0].found()
blas_deps = [dependency(['openblas', 'OpenBLAS'], static: get_option('link_blas_statically'), required : false)]
endif
endif

# try to find blas/cblas (e.g., Linux)
if not blas_deps[0].found()
blas_deps = [cc.find_library('blas', static: get_option('link_blas_statically'), required : false)]
if not blas_deps[0].found()
blas_deps = [dependency('blas', static: get_option('link_blas_statically'), required : false)]
endif
lapack_dep = cc.find_library('lapack', static: get_option('link_blas_statically'), required : false)
if not lapack_dep.found()
lapack_dep = dependency('lapack', static: get_option('link_blas_statically'), required : false)
endif
if lapack_dep.found()
blas_deps += lapack_dep
endif
cblas_dep = cc.find_library('cblas', static: get_option('link_blas_statically'), required : false)
if not cblas_dep.found()
cblas_dep = dependency('cblas', static: get_option('link_blas_statically'), required : false)
endif
if cblas_dep.found()
blas_deps += cblas_dep
endif
Expand Down

0 comments on commit dd17e2e

Please sign in to comment.