-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathoctave_build.m
47 lines (40 loc) · 1.16 KB
/
octave_build.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
% Build C++-based .oct file for GNU Octave
function octave_build(overwrite)
if nargin < 1, overwrite = false; end
assert(stdlib.isoctave(), "for GNU Octave only")
r = fileparts(mfilename("fullpath"));
inc = fullfile(r, "src");
d = fullfile(inc, "octave");
t = fullfile(r, "+stdlib");
%% specific source
srcs = {
fullfile(d, "disk_available.cpp"), ...
fullfile(d, "disk_capacity.cpp"), ...
fullfile(d, "drop_slash.cpp"), ...
fullfile(d, "is_wsl.cpp"), ...
fullfile(d, "is_rosetta.cpp"), ...
fullfile(d, "is_admin.cpp"), ...
fullfile(d, "normalize.cpp"), ...
fullfile(d, "parent.cpp"), ...
fullfile(d, "proximate_to.cpp"), ...
fullfile(d, "relative_to.cpp"), ...
};
% need this for loop below
unlink_bin = fullfile(t, "unlink.oct");
if ~isfile(unlink_bin)
mkoctfile(fullfile(d, "unlink.cpp"), ["-I", inc], "--output", unlink_bin)
end
%% build C+ Octave
for s = srcs
src = s{1};
[~, n] = fileparts(src);
bin = fullfile(t, [n, ".oct"]);
if ~overwrite && stdlib.get_modtime(src) < stdlib.get_modtime(bin)
continue
end
disp(["mkoctfile: ", src, " => ", bin])
if isfile(bin)
assert(stdlib.unlink(bin))
end
mkoctfile(src, ["-I", inc], "--output", bin)
end