summaryrefslogtreecommitdiff
path: root/matlab/README.md
blob: 92454e6f35d5c1e6db16aa09f533227baeb8524b (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
# Ice for MATLAB

> *This project is in the prototype stage and is changing rapidly. Do not use
in a production application.*

## Prerequisites

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

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
```

If MATLAB is not installed in the standard location set the MSBuild `MatlabHome`
property:

```
msbuild msbuild\ice.proj /p:MatlabHome=C:\Program Files\MATLAB\R2016a
```

Upon completion, the build generates the following components:

 - Ice for C++11 library, located in `cpp\bin\x64\Release`
 - slice2matlab executable, located in `cpp\bin\x64\Release`
 - icematlab.mexw64 MEX file, 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\Ice\*\generated`

## Using Ice for MATLAB

### Search Path

Add the following directories to your MATLAB search 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
search path.

### Loading the Library

The Ice for MATLAB library can be loaded with this command:
```
loadlibrary icematlab
```

The MEX file depends on `bzip2.dll` and `ice37++11.dll` that are part of the
C++ distribution.

### Running the Tests

Several tests have been ported to MATLAB so far. You can find them in
`matlab\test\Ice\*`.

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\Ice\...
```

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

If you started the server on a different host, use this command instead:
```
Client.start({'--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 Debug mode on Windows, run the
`allTests.py` script like this:

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

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