forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.m
110 lines (84 loc) · 3.71 KB
/
make.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
function make(varargin)
% If we are UNIX, use the GNU makefile instead
if ~ispc
error(['This makefile is only maintained for Windows users.' ...
' Please call make from the unix/mac command line instead']);
% note that I don't call it for you here using 'system', because matlab
% butchers the environment variables. it's much easier for now to force people
% to use the command line.
end
% Builds all mex files in the directory
flags = {'-O'};
%flags = {'-g'};
if (nargin>0 && strcmpi(varargin{1},'clean'))
disp('deleting mex files...');
cd util;
delete(['*.',mexext]);
cd(getDrakePath());
cd systems/plants;
delete(['*.',objext]);
delete(['*.',mexext]);
cd @PlanarRigidBodyManipulator/private;
delete(['*.',mexext]);
cd ..;
cd(getDrakePath());
else
disp('compiling mex files...');
%On Win64, John had to use the following lines (currently commented) and
%comment out the lines beginning with mex to
%deal with an error in which the compiler could not find "simstruc.h"
%simulinkIncludeDir = ['-I"' matlabroot '\simulink\include"'];
load drake_config;
try
cd util;
mexMakeRule('realtime.cpp',flags);
cd(getDrakePath());
if checkDependency('eigen3_enabled')
eigenflags = {['-I',conf.eigen3_incdir]};
cd systems/plants/;
makeRule(['RigidBodyManipulator.',objext],{'RigidBodyManipulator.cpp','RigidBodyManipulator.h','RigidBody.h'},['mex -c RigidBodyManipulator.cpp ',sprintf('%s ',flags{:},eigenflags{:})]);
modelflags = {['RigidBodyManipulator.',objext]};
mexMakeRule('constructModelmex.cpp',horzcat(modelflags,flags,eigenflags),modelflags);
mexMakeRule('deleteModelmex.cpp',horzcat(modelflags,flags,eigenflags),modelflags);
mexMakeRule('HandCmex.cpp',horzcat(modelflags,flags,eigenflags),modelflags);
mexMakeRule('doKinematicsmex.cpp',horzcat(modelflags,flags,eigenflags),modelflags);
mexMakeRule('forwardKinmex.cpp',horzcat(modelflags,flags,eigenflags),modelflags);
mexMakeRule('bodyKinmex.cpp',horzcat(modelflags,flags,eigenflags),modelflags);
% SuperUsers: fix the snoptflags for your platform and uncomment.
% will try to make compilation robust soon.
%
% snoptflags = {'-lf2c','-lsnopt','-lsnprint','-L/opt/local/lib/gcc48','-lgfortran','-I/Users/russt/mylocal/snopt7/cppsrc','-I/opt/local/include','-L/opt/local/lib'};
% mex('inverseKinmex.cpp',modelflags{:},flags{:},eigenflags{:},snoptflags{:});
% note: to make this run on my mac, i had to mv the libgfortran.3.dyld
% in the /Applications/MATLAB_R2012a.app/sys/os/maci64 directory and
% replace it with a symlink to the gcc48 version of the library.
mexMakeRule('deleteModelpmex.cpp',horzcat(flags,eigenflags),modelflags);
mexMakeRule('HandCpmex.cpp',horzcat(flags,eigenflags),modelflags);
mexMakeRule('doKinematicspmex.cpp',horzcat(flags,eigenflags),modelflags);
mexMakeRule('forwardKinpmex.cpp',horzcat(flags,eigenflags),modelflags);
mexMakeRule('forwardKinVelpmex.cpp',horzcat(flags,eigenflags),modelflags);
modelflags = {fullfile('..','..',['RigidBodyManipulator.',objext]),eigenflags{:}};
cd @PlanarRigidBodyManipulator/private;
mexMakeRule('constructModelpmex.cpp',horzcat(flags,eigenflags));
cd ..;
cd(getDrakePath());
end
cd systems;
mexMakeRule('DCSFunction.cpp');
cd(getDrakePath());
if (ispc)
cd(fullfile('thirdParty','GetFullPath'));
mexMakeRule('GetFullPath.c');
cd(getDrakePath());
end
catch ex
cd(getDrakePath());
rethrow(ex);
end
end
disp('done.');
end
function mexPrint(varargin)
disp(['mex ',sprintf('%s ',varargin{:})]);
mex(varargin{:});
end