-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompilemexlibrary.m
More file actions
61 lines (54 loc) · 1.73 KB
/
compilemexlibrary.m
File metadata and controls
61 lines (54 loc) · 1.73 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
function compilemexlibrary()
%COMPILEMEXLIBRARY compile file mex for architcture
archstr = computer('arch');
switch archstr
case {'win64'}
fprintf('system architecture:\t %s\n', archstr)
extmex = ["mexa64"; "mexmaci64"];
checkfile(extmex)
list1 = what;
list2 = what('@Map');
if length(list1.mex) < 1 || length(list2.mex) < 1
compile();
end
case {'glnxa64'}
fprintf('system architecture:\t %s\n', archstr)
extmex = ["mexmaci64"; "mexw64"];
checkfile(extmex)
list1 = what;
list2 = what('@Map');
if length(list1.mex) < 1 || length(list2.mex) < 1
compile();
end
case {'maci64'}
fprintf('system architecture:\t %s\n', archstr)
extmex = ["mexa64"; "mexw64"];
checkfile(extmex)
list1 = what;
list2 = what('@Map');
if length(list1.mex) < 1 || length(list2.mex) < 1
compile();
end
otherwise
disp('architecture not supported');
end
clc
end
function compile()
%COMPILE launches the compilation of the mex functions
mex -v -output Sens_model_noise sens_model_noise.c
mex -v COMPFLAGS='$COMPFLAGS -std=c++14' -output @Map/mapgen ./src/DungeonGenerator/*.cpp
mex -v COMPFLAGS='$COMPFLAGS -std=c++14' -output potentialfield ./src/*.cpp
end
function checkfile(extmex)
%CHECKFILE check and delete files that do not match the architecture
% looking for *.mex files in project folders.
for i = 1:length(extmex)
ext = char(sprintf('**/*.%s',extmex(i)));
listFile = dir(ext);
for j = 1:length(listFile)
fileName = char(sprintf('%s/%s',listFile(j).folder,listFile(j).name));
delete(fileName)
end
end
end