-
Notifications
You must be signed in to change notification settings - Fork 27
/
compile.m
65 lines (45 loc) · 1.43 KB
/
compile.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
function compile
%COMPILE compile JIGSAW's c++ backend using cmake.
%
% COMPILE tries to compile JIGSAW from the c++ source code
% available in ../external/jigsaw. The cmake utility and a
% c++ compiler must be available on the system path.
%
% On success, JIGSAW is installed in ../external/jigsaw.
%
% The cmake workflow has been tested on various Linux, Mac
% and Windows-based systems, using the gcc, clang and msvc
% compilers.
%
% See also EXAMPLE, DETAILS
%-----------------------------------------------------------
% Darren Engwirda
% github.com/dengwirda/jigsaw-matlab
% 26-Jul-2019
%-----------------------------------------------------------
%
[here] = fileparts( ...
mfilename( 'fullpath' ) ) ;
[okay] = mkdir(here,'external/jigsaw/build');
cd([here,'/external/jigsaw/build']) ;
try
[okay, cout] = system( ...
'cmake .. -DCMAKE_BUILD_TYPE=Release', '-echo');
if (exist('OCTAVE_VERSION', 'builtin') > 0)
fprintf(+1, '%s', cout) ;
end
[okay, cout] = system( ...
'cmake --build . --config Release --target install', ...
'-echo') ;
if (exist('OCTAVE_VERSION', 'builtin') > 0)
fprintf(+1, '%s', cout) ;
end
cd(here) ;
[okay] = rmdir([here,'/external/jigsaw/build'], 's');
catch err
cd(here) ;
[okay] = rmdir([here,'/external/jigsaw/build'], 's');
rethrow(err) ;
end
end