• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..05-Feb-2019-

lib/H05-Feb-2019-7,3746,691

msbuild/H03-May-2022-447400

src/H05-Feb-2019-4,4363,895

test/H05-Feb-2019-14,54812,233

.gitignoreH A D05-Feb-201933 43

README.mdH A D05-Feb-20194 KiB139100

allTests.pyH A D05-Feb-2019228 124

README.md

1# Building Ice for MATLAB
2
3This document describes how to build and install Ice for MATLAB from source.
4
5ZeroC provides Ice for MATLAB [toolboxes][1] for all recent versions of MATLAB on Windows,
6so building Ice for MATLAB from source is usually unnecessary.
7
8* [Prerequisites](#prerequisites)
9* [Build Instructions](#build-instructions)
10* [Packaging the Ice Toolbox](#packaging-the-ice-toolbox)
11* [Using Ice for MATLAB](#using-ice-for-matlab)
12  * [Search Path](#search-path)
13  * [Slice Files](#slice-files)
14  * [Loading the Library](#loading-the-library)
15  * [Running the Tests](#running-the-tests)
16    * [Running the Tests Manually](#running-the-tests-manually)
17    * [Running the Automated Tests](#running-the-automated-tests)
18
19### Prerequisites
20
21The build system requires MATLAB 2016a or later for Windows, Visual Studio 2015
22and a Perl installation.
23
24### Build Instructions
25
26Open a Visual Studio x64 command prompt, `VS2015 x64 Native Tools Command
27Prompt`. In this Command Prompt, change to the `matlab` subdirectory:
28```
29cd matlab
30```
31
32Now you're ready to build Ice for MATLAB:
33```
34msbuild msbuild\ice.proj
35```
36
37To build in debug mode instead:
38```
39msbuild msbuild\ice.proj /p:Configuration=Debug
40```
41
42Upon completion, a build in release mode generates the following components:
43
44 - Ice for C++11 libraries, located in `cpp\bin\x64\Release`
45 - slice2matlab executable, located in `cpp\bin\x64\Release`
46 - ice.mexw64 MEX file, located in `matlab\lib\x64\Release`
47 - Prototype and thunk files, located in `matlab\lib\x64\Release`
48 - MATLAB code for core Slice files, located in `matlab\lib\generated`
49 - MATLAB code for test Slice files, located in `matlab\test\**\generated`
50
51The MATLAB extension depends on Ice for C++ components from the cpp subdirectory,
52and those are built if required. It is also possible to build the MATLAB extension
53using Ice C++ NuGet packages by setting the ICE_BIN_DIST msbuild property to cpp:
54
55```
56msbuild msbuild\ice.proj /p:ICE_BIN_DIST=cpp
57```
58
59### Packaging the Ice Toolbox
60
61Use the following command to build the Ice toolbox package:
62```
63msbuild msbuild\ice.proj /t:Package
64```
65
66This creates the toolbox package `msbuild\ice-<Ice Version>-<MATLAB Version>.mltbx`.
67
68You can install the toolbox from within MATLAB by double-clicking on the file.
69
70### Using Ice for MATLAB
71
72#### Search Path
73
74To use a source build, add the following directories to your MATLAB path:
75 - `matlab\lib`
76 - `matlab\lib\generated`
77 - `matlab\lib\x64\Release`
78
79#### Slice Files
80
81Use `slice2matlab` to compile your Slice files. Run `slice2matlab -h` for a
82description of its command-line options. You can place the generated `*.m`
83files anywhere you like, but the enclosing directory must be in your MATLAB
84path.
85
86#### Loading the Library
87
88The Ice for MATLAB library can be loaded with this command:
89```
90loadlibrary('ice', @iceproto)
91```
92
93The MEX file depends on `bzip2.dll` and several Ice DLLs that are part of the
94Ice for C++ distribution. The build copies all DLL dependencies to the
95`matlab\lib\x64\Release` directory.
96
97#### Running the Tests
98
99The Ice for MATLAB tests are located in `matlab\test`.
100
101Since Ice for MATLAB only supports client functionality, you need test servers
102from a different language mapping.
103
104##### Running the Tests Manually
105
106In a Command Prompt, start a test server from your chosen server language
107mapping.
108
109In MATLAB, change to a test directory:
110```
111cd matlab\test\...
112```
113
114Now you can start the MATLAB test client. Assuming the server is running on
115the same host, use this command:
116```
117client({})
118```
119
120If you started the server on a different host, use this command instead:
121```
122client({'--Ice.Default.Host=<addr>'})
123```
124
125Replace `<addr>` with the host name or IP address of the server host.
126
127##### Running the Automated Tests
128
129Assuming you've installed Ice for Python, run `allTests.py`:
130```
131python allTests.py
132```
133
134This script automatically starts a Python server for each MATLAB client.
135MATLAB clients are executed using a minimized MATLAB interpreter
136and the test output is copied to the Command Prompt window.
137
138[1]: https://zeroc.com/downloads/ice#matlab
139