summaryrefslogtreecommitdiff
path: root/matlab/README.md
blob: 11aa19d7d9805df8995e4359b66d486a4e5c3660 (plain)
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# Ice for MATLAB

> *This project is in the beta release stage. Not recommended for use in a
production application.*

## Toolbox Installation

Ice for MATLAB is available as a toolbox for MATLAB versions R2016a and R2017a.
Refer to the [Release Notes](https://doc.zeroc.com/display/IceMatlab/Using+the+MATLAB+Distribution)
for installation instructions.

## Source Build

The remainder of this document describes how to build and use Ice for MATLAB
from source.

### Prerequisites

The build system requires Microsoft Visual Studio 2015, the [Ice Builder for
Visual Studio Extension](https://marketplace.visualstudio.com/items?itemName=ZeroCInc.IceBuilder),
and a Perl installation.

Ice for MATLAB supports MATLAB 2016a or later.

### Build Instructions

Open a Visual Studio x64 command prompt, `VS2015 x64 Native Tools Command
Prompt`. In this Command Prompt, change to the `matlab` subdirectory:
```
cd matlab
```

Now you're ready to build Ice for MATLAB:
```
msbuild msbuild\ice.proj
```

To build in debug mode instead:
```
msbuild msbuild\ice.proj /p:Configuration=Debug
```

Upon completion, a build in release mode generates the following components:

 - Ice for C++11 libraries, located in `cpp\bin\x64\Release`
 - slice2matlab executable, located in `cpp\bin\x64\Release`
 - ice.mexw64 MEX file, located in `matlab\lib\x64\Release`
 - Prototype and thunk files, located in `matlab\lib\x64\Release`
 - MATLAB code for core Slice files, located in `matlab\lib\generated`
 - MATLAB code for test Slice files, located in `matlab\test\**\generated`

### Packaging the Ice Toolbox

Use the following command to build the Ice toolbox package:

```
msbuild msbuild\ice.proj /t:Package
```

This creates the toolbox package `msbuild\ice-<Ice Version>-<MATLAB Version>.mltbx`.

You can install the package from within MATLAB by double-clicking on the file.

### Using Ice for MATLAB

#### Search Path

To use the source build, add the following directories to your MATLAB path:

 - `matlab\lib`
 - `matlab\lib\generated`
 - `matlab\lib\x64\Release`

#### Slice Files

Use `slice2matlab` to compile your Slice files. Run `slice2matlab -h` for a
description of its command-line options. You can place the generated `*.m`
files anywhere you like, but the enclosing directory must be in your MATLAB
path.

#### Loading the Library

The Ice for MATLAB library can be loaded with this command:
```
loadlibrary('ice', @iceproto)
```

The MEX file depends on `bzip2.dll` and several Ice DLLs that are part of the
Ice for C++ distribution. The build copies all DLL dependencies to the
`matlab\lib\x64\Release` directory.

#### Running the Tests

The Ice for MATLAB tests are located in `matlab\test`.

Since Ice for MATLAB only supports client functionality, you will have to build
test servers from a different language mapping.

##### Running the Tests Manually

In a Command Prompt, start a test server from your chosen server language
mapping.

In MATLAB, change to a test directory:
```
cd matlab\test\...
```

Now you can start the MATLAB test client. Assuming the server is running on
the same host, use this command:
```
client({})
```

If you started the server on a different host, use this command instead:
```
client({'--Ice.Default.Host=<addr>'})
```

Replace `<addr>` with the host name or IP address of the server host.

##### Running the Automated Tests

Assuming you've built the C++11 test servers in Release mode on Windows, run the
`allTests.py` script like this:

```
python allTests.py --platform=x64 --cpp-config=Cpp11-Release
```

This command will automatically start a corresponding C++11 server for each
MATLAB client. MATLAB clients are executed using a minimized MATLAB interpreter
and the test output is copied to the Command Prompt window.