-
Notifications
You must be signed in to change notification settings - Fork 5
/
build_library_win64.m
94 lines (71 loc) · 3.49 KB
/
build_library_win64.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
clear all; %clc;
%% MATLAB API Builder
% This script will build the basic template file for the MATLAB bindings
% however since the library processor isn't perfect manual modifications
% need to be done with the generated interface file
mex -setup:C:\Users\travi\AppData\Roaming\MathWorks\MATLAB\R2020a\mex_C++_win64.xml C++
%%
% Full path to files in the library
if ispc
includepath = fullfile(pwd,'libm2k','include');
hppPath = fullfile(pwd,'libm2k','include','libm2k');
libs = fullfile(pwd,'libm2k','libm2k.lib');
myPkg = 'libm2k';
else
error('Windows builds only tested so far');
end
%% Add related headers
h = {};
% h1 = fullfile(hppPath,'m2kcalibration.hpp'); h = [{h1},h(:)'];
% h1 = fullfile(hppPath,'m2kexceptions.hpp'); h = [{h1},h(:)'];
% h1 = fullfile(hppPath,'logger.hpp'); h = [{h1},h(:)'];
% h1 = fullfile(hppPath,'digital','m2kdigital.hpp'); h = [{h1},h(:)'];
% h1 = fullfile(hppPath,'analog','m2kanalogout.hpp'); h = [{h1},h(:)'];
% h1 = fullfile(hppPath,'analog','m2kanalogin.hpp'); h = [{h1},h(:)'];
% h1 = fullfile(hppPath,'m2kcalibration.hpp'); h = [{h1},h(:)'];
% h1 = fullfile(hppPath,'m2khardwaretrigger.hpp'); h = [{h1},h(:)'];
% h1 = fullfile(hppPath,'analog','m2kpowersupply.hpp'); h = [{h1},h(:)'];
% h1 = fullfile(hppPath,'utils','utils.hpp'); h = [{h1},h(:)'];
% h1 = fullfile(hppPath,'utils','enums.hpp'); h = [{h1},h(:)'];
% h1 = fullfile(hppPath,'contextbuilder.hpp'); h = [{h1},h(:)'];
% h1 = fullfile(hppPath,'m2k.hpp'); h = [{h1},h(:)'];
% h1 = fullfile(hppPath,'m2kglobal.hpp'); h = [{h1},h(:)'];
% h1 = fullfile(hppPath,'context.hpp'); h = [{h1},h(:)'];
% h1 = fullfile(hppPath,'digital','enums.hpp'); h = [{h1},h(:)'];
% h1 = fullfile(hppPath,'analog','enums.hpp'); h = [{h1},h(:)'];
% h1 = fullfile(hppPath,'enums.hpp'); h = [{h1},h(:)'];
% % h1 = fullfile(pwd,'libm2k','include','iio.h'); h = [{h1},h(:)'];
% headers = h;
h1 = fullfile(hppPath,'digital','m2kdigital.hpp'); h = [{h1},h(:)'];
h1 = fullfile(hppPath,'digital','enums.hpp'); h = [{h1},h(:)'];
h1 = fullfile(hppPath,'analog','m2kanalogout.hpp'); h = [{h1},h(:)'];
h1 = fullfile(hppPath,'analog','m2kanalogin.hpp'); h = [{h1},h(:)'];
h1 = fullfile(hppPath,'analog','m2kpowersupply.hpp'); h = [{h1},h(:)'];
h1 = fullfile(hppPath,'analog','dmm.hpp'); h = [{h1},h(:)'];
h1 = fullfile(hppPath,'analog','enums.hpp'); h = [{h1},h(:)'];
% h1 = fullfile(hppPath,'utils','utils.hpp'); h = [{h1},h(:)'];
% h1 = fullfile(hppPath,'utils','enums.hpp'); h = [{h1},h(:)'];
h1 = fullfile(hppPath,'m2kcalibration.hpp'); h = [{h1},h(:)'];
h1 = fullfile(hppPath,'m2khardwaretrigger.hpp'); h = [{h1},h(:)'];
h1 = fullfile(hppPath,'contextbuilder.hpp'); h = [{h1},h(:)'];
h1 = fullfile(hppPath,'m2k.hpp'); h = [{h1},h(:)'];
h1 = fullfile(hppPath,'m2kglobal.hpp'); h = [{h1},h(:)'];
h1 = fullfile(hppPath,'context.hpp'); h = [{h1},h(:)'];
h1 = fullfile(hppPath,'logger.hpp'); h = [{h1},h(:)'];
h1 = fullfile(hppPath,'m2kcalibration.hpp'); h = [{h1},h(:)'];
h1 = fullfile(hppPath,'m2kexceptions.hpp'); h = [{h1},h(:)'];
h1 = fullfile(hppPath,'enums.hpp'); h = [{h1},h(:)'];
% h1 = fullfile(pwd,'libm2k','include','iio.h'); h = [{h1},h(:)'];
headers = h;
%% Build interface file
%% Add 'DefinedMacros' to fix builds using Visual Studio 16 2019
clibgen.generateLibraryDefinition(headers,...
'IncludePath', includepath,...
'Libraries', libs,...
'PackageName', myPkg,...
'Verbose',true,...
'DefinedMacros', ["_HAS_CONDITIONAL_EXPLICIT=0"])
delete definelibm2k.mlx
%% Build library once manually updated
% pkg = definelibm2k;
% build(pkg);