|
24 | 24 | end |
25 | 25 |
|
26 | 26 | plan("build_c") = matlab.buildtool.Task(Actions=@subprocess_build_c); |
| 27 | +plan("build_cpp") = matlab.buildtool.Task(Actions=@subprocess_build_cpp); |
27 | 28 | plan("build_fortran") = matlab.buildtool.Task(Actions=@subprocess_build_fortran); |
28 | | -plan("test").Dependencies = ["build_c", "build_fortran"]; |
| 29 | +plan("test").Dependencies = ["build_c", "build_cpp", "build_fortran"]; |
29 | 30 |
|
30 | 31 | if ~isMATLABReleaseOlderThan("R2024a") |
31 | 32 | plan("check") = matlab.buildtool.tasks.CodeIssuesTask(pkg_name, IncludeSubfolders=true, ... |
@@ -128,6 +129,39 @@ function subprocess_build_c(context) |
128 | 129 | end |
129 | 130 |
|
130 | 131 |
|
| 132 | +function subprocess_build_cpp(context) |
| 133 | + |
| 134 | +td = context.Plan.RootFolder + "/test"; |
| 135 | +src = td + "/sleep.cpp"; |
| 136 | +exe = td + "/sleep.exe"; |
| 137 | + |
| 138 | +co = mex.getCompilerConfigurations('c++'); |
| 139 | + |
| 140 | +cpp = co.Details.CompilerExecutable; |
| 141 | + |
| 142 | +outFlag = "-o"; |
| 143 | +shell = ""; |
| 144 | +shell_arg = ""; |
| 145 | +msvcLike = ispc && endsWith(cpp, "cl"); |
| 146 | +if msvcLike |
| 147 | + shell = strtrim(co.Details.CommandLineShell); |
| 148 | + shell_arg = co.Details.CommandLineShellArg; |
| 149 | + outFlag = "/link /out:"; |
| 150 | +end |
| 151 | + |
| 152 | +cmd = join([cpp, src, outFlag, exe]); |
| 153 | +if shell ~= "" |
| 154 | + cmd = join([shell, shell_arg, cmd]); |
| 155 | +end |
| 156 | + |
| 157 | +[r, m] = system(cmd); |
| 158 | +if r ~= 0 |
| 159 | + warning("failed to build TestSubprocess " + exe + " " + m) |
| 160 | +end |
| 161 | + |
| 162 | +end |
| 163 | + |
| 164 | + |
131 | 165 | function subprocess_build_fortran(context) |
132 | 166 |
|
133 | 167 | td = context.Plan.RootFolder + "/test"; |
|
0 commit comments