-
Notifications
You must be signed in to change notification settings - Fork 4
/
compile_daqcomm_laser.m
38 lines (30 loc) · 1.52 KB
/
compile_daqcomm_laser.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
function compile_daqcomm_laser()
% Only support modern enough compilers
cCompiler = mex.getCompilerConfigurations('C','Selected');
if ~strncmpi(cCompiler.ShortName', 'msvc', 4) ...
|| str2double(cCompiler.Version) < 11
fprintf('!! WARNING: This is only supported for Microsoft Visual C++ 2012 and newer. Doing nothing.\n');
return;
end
% Code files to compile
code = { 'nidaqPulse.cpp' ...
, 'nidaqPulse2.cpp' ...
, 'nidaqAIread.cpp' ...
, 'nidaqDIread.cpp' ...
, 'nidaqDOwrite.cpp' ...
, 'nidaqDOwrite2ports.cpp' ...
};
% NI-DAQ environment
nidaqDir = fullfile(getenv('NIDAQmxSwitchDir'), '..', '..', 'Shared', 'ExternalCompilerSupport', 'C');
mexOpts = { ['-I' fullfile(nidaqDir, 'include')] ...
, ['-L' fullfile(nidaqDir, ['lib' osBitSize()], 'msvc')] ...
, '-lNIDAQmx' ...
, '-O' ...
};
% Change to the directory that hosts this file (and by assumption the mex code)
origLoc = cd(fullfile(fileparts(mfilename('fullpath')), 'experiments\daq'));
for iCode = 1:numel(code)
fprintf('==================== Compiling %s ====================\n', code{iCode});
mex(code{iCode}, mexOpts{:});
end
cd(origLoc);