Skip to content

Commit

Permalink
macos use Homebrew lapack if got
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Jul 23, 2024
1 parent 5a667e9 commit 6fd91fc
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ my @pkgs = qw(lapack blas);
our $libs0 = (
eval {require PkgConfig; join ' ', map PkgConfig->find($_)->get_ldflags, @pkgs} ||
eval {require ExtUtils::PkgConfig; join ' ', map ExtUtils::PkgConfig->libs($_), @pkgs} ||
find_macos_libs() ||
find_libs() ||
`pkg-config @pkgs --libs` ||
'-L/usr/lib/atlas -llapack -lblas -latlas'
Expand Down Expand Up @@ -80,7 +81,6 @@ WriteMakefile(
sub find_libs {
return if $^O !~ /linux/i;
# in performance order based on libraries I've used
# for xnec2c in Ubuntu, Debian, SuSE, CentOS, etc.
# See comments here for detail:
Expand All @@ -93,14 +93,20 @@ sub find_libs {
openblas
openblas_serial
mkl_rt/;
for my $l (@libs) {
return "-l$l" if (check_lib(lib => $l));
}
return;
}
sub find_macos_libs {
return if $^O ne 'darwin';
my $pref = `brew --prefix lapack`;
return if !$pref;
chomp $pref;
qq{-L"$pref/lib" -llapack -lblas};
}
sub MY::postamble {
my $oneliner = PDL::Core::Dev::_oneliner(qq{exit if \$ENV{DESTDIR}; use PDL::Doc; eval { PDL::Doc::add_module(shift); }});
qq|\ninstall :: pure_install\n\t$oneliner \$(NAME)\n|;
Expand Down

0 comments on commit 6fd91fc

Please sign in to comment.