Skip to content

Commit c84a966

Browse files
committed
macos: hint fortran compilers for ExeTask
1 parent 2bcb6ea commit c84a966

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

buildfile.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,15 @@ function build_exe(context)
141141
if isempty(comp)
142142
disp("set FC environment variable to the Fortran compiler path, or do 'mex -setup fortran'")
143143
if ismac()
144+
p = '/opt/homebrew/bin/';
145+
for fc = ["flang", "gfortran"]
146+
comp = stdlib.which(fc, p);
147+
if ~isempty(comp)
148+
disp("found " + fc + " compiler: " + comp)
149+
setenv("FC", comp);
150+
return
151+
end
152+
end
144153
disp("on macOS, environment variables propagate in to GUI programs like Matlab by using 'launchctl setenv FC' and a reboot. Or by using 'FC=gfortran matlab -batch buildtool exe'")
145154
end
146155
end

0 commit comments

Comments
 (0)