6868 Tag= " python" , ...
6969 SourceFiles= pkg_root , RunOnlyImpactedTests= true ,...
7070 TestResults= " TestResults_python.xml" , Strict= true );
71-
71+
7272 addons = matlab .addons .installedAddons ;
7373 if contains(addons .Name , " Matlab Test" )
7474 plan(" coverage" ) = matlab .buildtool .tasks .TestTask(test_root , ...
@@ -189,6 +189,13 @@ function build_exe(context)
189189
190190
191191function [comp , shell ] = get_compiler(lang )
192+ arguments (Input )
193+ lang (1 ,1 ) string {mustBeMember(lang , [" c" , " c++" , " fortran" ])}
194+ end
195+ arguments (Output )
196+ comp string {mustBeScalarOrEmpty }
197+ shell string {mustBeScalarOrEmpty }
198+ end
192199
193200lang = lower(lang );
194201
@@ -211,7 +218,6 @@ function build_exe(context)
211218 if isempty(comp )
212219 disp(" set CC environment variable to the C compiler path, or do 'mex -setup c'" )
213220 end
214- otherwise , error(" language not known " + lang )
215221 end
216222else
217223 comp = co .Details .CompilerExecutable ;
@@ -238,10 +244,18 @@ function build_exe(context)
238244
239245
240246function [comp , shell , outFlag ] = get_build_cmd(lang )
247+ arguments (Input )
248+ lang (1 ,1 ) string {mustBeMember(lang , [" c" , " c++" , " fortran" ])}
249+ end
250+ arguments (Output )
251+ comp (1 ,1 ) string
252+ shell (1 ,1 ) string
253+ outFlag (1 ,1 ) string
254+ end
241255
242256[comp , shell ] = get_compiler(lang );
243257
244- if contains(shell , " Visual Studio" ) || contains (comp , " ifx.exe" )
258+ if any( contains(shell , " Visual Studio" )) || endsWith (comp , " ifx.exe" )
245259 outFlag = " /Fo" + tempdir + " /link /out:" ;
246260else
247261 outFlag = " -o" ;
@@ -251,9 +265,12 @@ function build_exe(context)
251265
252266
253267function srcs = get_mex_sources(build_all )
254- arguments
268+ arguments ( Input )
255269 build_all (1 ,1 ) logical = false
256270end
271+ arguments (Output )
272+ srcs cell
273+ end
257274
258275srcs = {
259276" src/remove.cpp" , ...
@@ -272,6 +289,10 @@ function build_exe(context)
272289
273290
274291function [compiler_opt , linker_opt ] = get_compiler_options()
292+ arguments (Output )
293+ compiler_opt (1 ,: ) string
294+ linker_opt (1 ,1 ) string
295+ end
275296
276297cxx = mex .getCompilerConfigurations(' c++' );
277298flags = cxx .Details .CompilerFlags ;
@@ -318,8 +339,9 @@ function build_exe(context)
318339
319340
320341function comp = get_fortran_compiler()
321-
322- disp(" set FC environment variable to the Fortran compiler path, or do 'mex -setup fortran'" )
342+ arguments (Output )
343+ comp string {mustBeScalarOrEmpty }
344+ end
323345
324346if ismac()
325347 p = ' /opt/homebrew/bin/' ;
@@ -331,13 +353,14 @@ function build_exe(context)
331353 if isempty(p )
332354 p = getenv(" MW_MINGW64_LOC" );
333355 end
334- if ~isempty( p ) && ~ endsWith(p , [" bin" , " bin/" ])
356+ if ~endsWith(p , [" bin" , " bin/" ])
335357 p = p + " /bin" ;
336358 end
337359else
338360 p = ' ' ;
339361end
340362
363+ comp = string .empty ;
341364for fc = [" flang" , " gfortran" , " ifx" ]
342365 comp = stdlib .which(fc , p );
343366 if ~isempty(comp )
@@ -347,4 +370,6 @@ function build_exe(context)
347370 end
348371end
349372
373+ disp(" to hint Fortran compiler, setenv('FC', <Fortran compiler path>), or do 'mex -setup fortran'" )
374+
350375end
0 commit comments