forked from saraershadi/deep_RandomForest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake.m
More file actions
59 lines (52 loc) · 1.45 KB
/
make.m
File metadata and controls
59 lines (52 loc) · 1.45 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
%
% make
%
% Created by Vahid Kazemi
% Copyright (c) 2013 Vahid Kazemi. All rights reserved.
%
function make(folder, filename)
if nargin==0, folder = '.'; end
if nargin==2
names = {filename};
else
files = dir([folder '/*']);
for i=1:length(files)
if files(i).isdir && files(i).name(1)~='.'
make([folder '/' files(i).name]);
end
end
files = dir([folder '/*.cpp']);
names = cell(1, length(files));
for i=1:length(files)
names{i} = files(i).name;
end
end
for i=1:length(names)
input = [folder '/' names{i}];
output = [input(1:end-3) mexext];
if exist(output,'file')
if getfield(dir(input), 'datenum') < getfield(dir(output), 'datenum')
continue;
end
end
if ispc
cflags = '/Ox /openmp';
lflags = '';
include = '-Icommon';
libs = '';
str = ['mex -O COMPFLAGS="$COMPFLAGS ' cflags '" ' include ' LINKFLAGS="$LINKFLAGS ' lflags '" ' input ' ' libs ' -output ' output];
else
cflags = '-march=native -std=c++0x -fopenmp';
lflags = '-w -fopenmp';
include = '-Icommon';
libs = '';
str = ['mex -O CXXFLAGS="\$CXXFLAGS ' cflags '" ' include ' LDFLAGS="\$LDFLAGS ' lflags '" ' input ' ' libs ' -output ' output];
end
try
disp(['Compiling ' names{i} '...']);
eval(str);
catch err
disp(err.message);
disp('That did not work out.');
end
end