Skip to content

Commit 85e28b8

Browse files
committed
consolidate buildfile
1 parent 9a0c721 commit 85e28b8

File tree

3 files changed

+39
-37
lines changed

3 files changed

+39
-37
lines changed

+stdlib/create_symlink.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
% see example/Filesystem.java for this working in plain Java.
3232
% see example/javaCreateSymbolicLink.m for a non-working attempt in Matlab.
3333

34-
disp("use 'buildtool mex' or 'legacy_mex_build()' for faster symlink creation")
34+
disp("'buildtool mex' for faster symlink creation")
3535

3636
if ispc
3737
cmd = "pwsh -c " + '"' + "New-Item -ItemType SymbolicLink -Path " + link + ...

buildfile.m

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,41 @@ function publishTask(context)
108108
end
109109

110110
end
111+
112+
113+
function [compiler_id, compiler_opt] = get_compiler_options()
114+
115+
cxx = mex.getCompilerConfigurations('c++');
116+
flags = cxx.Details.CompilerFlags;
117+
118+
msvc = startsWith(cxx.ShortName, "MSVCPP");
119+
120+
std = "-std=c++17";
121+
compiler_id = "";
122+
% FIXME: Windows oneAPI
123+
if msvc
124+
std = "/std:c++17";
125+
elseif ismac
126+
% keep for if-logic
127+
elseif isunix && cxx.ShortName == "g++"
128+
% FIXME: update when desired GCC != 10 for newer Matlab
129+
if isMATLABReleaseOlderThan("R2025b") && ~startsWith(cxx.Version, "10")
130+
% https://www.mathworks.com/help/matlab/matlab_external/choose-c-or-c-compilers.html
131+
% https://www.mathworks.com/help/matlab/matlab_external/change-default-gcc-compiler-on-linux-system.html
132+
[s, ~] = system("which g++-10");
133+
if s == 0
134+
compiler_id = "CXX=g++-10";
135+
else
136+
warning("GCC 10 not found, using default GCC " + cxx.Version + " may fail on runtime")
137+
end
138+
end
139+
end
140+
141+
opt = flags + " " + std;
142+
if msvc
143+
compiler_opt = "COMPFLAGS=" + opt;
144+
else
145+
compiler_opt = "CXXFLAGS=" + opt;
146+
end
147+
148+
end

private/get_compiler_options.m

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)