-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakeThomasGreatAgain.m
More file actions
66 lines (59 loc) · 1.72 KB
/
Copy pathMakeThomasGreatAgain.m
File metadata and controls
66 lines (59 loc) · 1.72 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
62
63
64
65
66
function [] = MakeThomasGreatAgain(sourcecode)
% introduction
disp('Welcome to EPOS2 library')
disp('Eugenio Yime, 2015')
% detecting computer
str = computer;
win64 = strcmp(str, 'PCWIN64');
win32 = strcmp(str, 'PCWIN32');
lin64 = strcmp(str, 'GLNXA64');
lin32 = strcmp(str, 'GLNXA32');
% is it possible to compile the source code ?
if ~(win32 || win64 || lin32 || lin64)
error('Sorry, this library only supports Windows and Linux')
end
% for Linux computer
if ( lin32 || lin64 )
disp('.. Compiling for a Linux computer')
% directory to include files
includedir = './Epos2Linux';
% library name
libeposname = 'EposCmd';
% definitions for right compilation
definitions = '_LINUX_';
end
% for Windows computer
if ( win32 || win64 )
disp('.. Compiling for a Windows computer')
% directory to include files
includedir = '.\Epos2Windows';
% library name
if (win32==1)
libeposname = 'EposCmd';
else
libeposname = 'EposCmd64';
end
% definitions
definitions = 'WINDOWS';
end
% compile each file
sourcecode = [' ', sourcecode];
strcmd = strcat('mex', sourcecode, ' -D', definitions, ' -I', ...
includedir, ' -L', includedir, ' -l', libeposname);
eval( char(strcmd) )
% disp('.. finishing compiling')
% % add directory to path
% disp('.. adding directory to path')
% dirtopath = cd;
% addpath( dirtopath );
% if ( win32 || win64 )
% % copy dlls and lib to actual directory
% copyfile('.\Epos2Windows\*.dll', '.', 'f');
% copyfile('.\Epos2Windows\*.lib', '.', 'f');
% end
% disp('.. done, you can now use this library')
%
% % some help
% disp('Please, use the command: >> savepath')
% disp('if you want to permanently add the source code directory to Matlab')
end