3737 plan(" test_mex" ) = matlab .buildtool .Task(Actions = @(context ) legacy_test(context , cmex ), Dependencies= " mex" );
3838
3939elseif isMATLABReleaseOlderThan(" R2025a" )
40-
40+ % Matlab == R2024b
4141 plan(" test:java" ) = matlab .buildtool .Task(Actions = @(context ) legacy_test(context , cjava ));
4242 plan(" test:exe" ) = matlab .buildtool .tasks .TestTask(test_root , Tag= " exe" , Dependencies= " exe" );
4343 plan(" test:nomex" ) = matlab .buildtool .Task(Actions = @(context ) legacy_test(context , cnomex ), Dependencies= " clean" );
4444 plan(" test:mex" ) = matlab .buildtool .Task(Actions = @(context ) legacy_test(context , cmex ), Dependencies= " mex" );
4545
4646else
47+ % Matlab >= R2025a
4748 plan(" test:exe" ) = matlab .buildtool .tasks .TestTask(test_root , Tag= " exe" , Description= " test subprocess" ,...
4849 SourceFiles= [pkg_root , test_root + [" /*.cpp" , " /*.c" , " /*.f90" ]], ...
4950 RunOnlyImpactedTests= true ,...
101102 WarningThreshold= 0 , Results= " CodeIssues.sarif" );
102103end
103104
105+ if isMATLABReleaseOlderThan(" R2024b" ), return , end
106+
104107%% MexTask
105108[compiler_opt , linker_opt ] = get_compiler_options();
106109
107- use_legacy_mex = isMATLABReleaseOlderThan(" R2024b" );
108-
109- if use_legacy_mex
110- % dummy task to allow "buildtool mex" to build all MEX targets
111- plan(" mex" ) = matlab .buildtool .Task();
112- mex_deps = string .empty ;
113- end
114-
115110for s = get_mex_sources()
116111 src = s{1 };
117112 name = stdlib .stem(src(1 ));
118113
119- % name of MEX target function is name of first source file
120- if use_legacy_mex
121- mex_name = " mex_" + name ;
122- plan(mex_name ) = matlab .buildtool .Task(Inputs = src , ...
123- Outputs= fullfile(pkg_root , name + " ." + mexext()), ...
124- Actions= @(context ) legacy_mex(context , compiler_opt , linker_opt ), ...
125- Description= " Legacy MEX" );
126- mex_deps(end + 1 ) = mex_name ; % #ok<AGROW>
127- else
128- plan(" mex:" + name ) = matlab .buildtool .tasks .MexTask(src , pkg_root , ...
129- Description= " Build MEX target " + name , ...
130- Options= [compiler_opt , linker_opt ]);
131- end
132- end
133-
134- if use_legacy_mex
135- plan(" mex" ).Dependencies = mex_deps ;
114+ % name of MEX target function is name of first source file
115+ plan(" mex:" + name ) = matlab .buildtool .tasks .MexTask(src , pkg_root , ...
116+ Description= " Build MEX target " + name , ...
117+ Options= [compiler_opt , linker_opt ]);
136118end
137119
138120end
@@ -143,12 +125,6 @@ function clean_mex(context)
143125end
144126
145127
146- function legacy_mex(context , compiler_opt , linker_opt )
147- bindir = fileparts(context .Task .Outputs .Path );
148- mex(context .Task .Inputs .Path , " -outdir" , bindir , compiler_opt{: }, linker_opt )
149- end
150-
151-
152128function legacy_test(context , sel )
153129import matlab .unittest .TestSuite
154130
@@ -278,18 +254,10 @@ function build_exe(context)
278254 build_all (1 ,1 ) logical = false
279255end
280256
281- pure = " src/pure.cpp" ;
282- normal = [" src/normalize_fs.cpp" , pure ];
283-
284- win = [pure , " src/windows.cpp" ];
285-
286- sym = " src/symlink_fs.cpp" ;
287-
288-
289257srcs = {
290258" src/remove.cpp" , ...
291- [" src/normalize.cpp" , normal ], ...
292- " src/set_permissions.cpp" , ...
259+ [" src/normalize.cpp" , " src/normalize_fs.cpp " , " src/pure.cpp " ], ...
260+ " src/set_permissions.cpp"
293261};
294262
295263if ~stdlib .has_python() || build_all
@@ -299,23 +267,6 @@ function build_exe(context)
299267srcs{end + 1 } = " src/disk_capacity.cpp" ;
300268end
301269
302- if isMATLABReleaseOlderThan(" R2024b" )
303-
304- if (~stdlib .has_dotnet() && ~stdlib .has_java() && ~stdlib .has_python()) || build_all
305- srcs{end + 1 } = [" src/is_symlink.cpp" , win , sym ];
306- end
307-
308- if (~stdlib .has_java() && ~stdlib .has_python() && stdlib .dotnet_api() < 6 ) || build_all
309- srcs{end + 1 } = [" src/read_symlink.cpp" , win , sym ];
310- end
311-
312- if (~stdlib .has_python() && stdlib .dotnet_api() < 6 ) || build_all
313- % so that we don't need to run matlab AsAdmin on Windows
314- srcs{end + 1 } = [" src/create_symlink.cpp" , win , sym ];
315- end
316-
317- end
318-
319270end
320271
321272
0 commit comments