Skip to content

Commit 1e3c145

Browse files
committed
mex >= R2024b for simplicity, as so many fallbacks now
1 parent 2cbe62e commit 1e3c145

File tree

3 files changed

+14
-62
lines changed

3 files changed

+14
-62
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ jobs:
5757
run: echo "FC=gfortran-14" >> $GITHUB_ENV
5858

5959
- name: Check CodeIssues
60+
if: ${{ matrix.release >= 'R2024a' }}
6061
uses: ./.github/workflows/composite-check
6162

6263
- name: Matlab tell External Language Interface versions
@@ -68,7 +69,7 @@ jobs:
6869
uses: ./.github/workflows/composite-nomex
6970

7071
- name: MEX tests
71-
if: ${{ matrix.release >= 'R2023b' }}
72+
if: ${{ matrix.release >= 'R2024b' }}
7273
uses: ./.github/workflows/composite-mex
7374

7475

.github/workflows/composite-mex/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ runs:
77
steps:
88

99
- name: Mex Test
10-
if: ${{ matrix.release >= 'R2023b' }}
10+
if: ${{ matrix.release >= 'R2024b' }}
1111
uses: matlab-actions/run-build@v2
1212
with:
1313
startup-options: ${{ matrix.startup-options }} -logfile ${{ matrix.release }}-${{ runner.os }}-test.log
14-
tasks: ${{ matrix.release < 'R2024b' && 'test_mex test_exe' || 'test:mex test:exe' }}
14+
tasks: test:mex test:exe

buildfile.m

Lines changed: 10 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@
3737
plan("test_mex") = matlab.buildtool.Task(Actions=@(context) legacy_test(context, cmex), Dependencies="mex");
3838

3939
elseif 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

4646
else
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,...
@@ -101,38 +102,19 @@
101102
WarningThreshold=0, Results="CodeIssues.sarif");
102103
end
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-
115110
for 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]);
136118
end
137119

138120
end
@@ -143,12 +125,6 @@ function clean_mex(context)
143125
end
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-
152128
function legacy_test(context, sel)
153129
import matlab.unittest.TestSuite
154130

@@ -278,18 +254,10 @@ function build_exe(context)
278254
build_all (1,1) logical = false
279255
end
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-
289257
srcs = {
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

295263
if ~stdlib.has_python() || build_all
@@ -299,23 +267,6 @@ function build_exe(context)
299267
srcs{end+1} = "src/disk_capacity.cpp";
300268
end
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-
319270
end
320271

321272

0 commit comments

Comments
 (0)