Difference between revisions of "ApCoCoA-1:HowTo:Compile MatlabToolbox on Windows"
m |
m (Bot: Replacing category HowTo with HowTo Old) |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 14: | Line 14: | ||
=Download Instructions= | =Download Instructions= | ||
− | Get the latest MatlabToolbox version from the [http://www.apcocoa.org/hg | + | Get the latest MatlabToolbox version from the [http://www.apcocoa.org/~mmachnik/hg repo site]. |
A brief instruction using TortoiseHG is: | A brief instruction using TortoiseHG is: | ||
* Add a folder on your local harddisk for the local repo copy. | * Add a folder on your local harddisk for the local repo copy. | ||
Line 20: | Line 20: | ||
** As the source path copy the selected link from the repo site. | ** As the source path copy the selected link from the repo site. | ||
** As the destination path select your created folder. | ** As the destination path select your created folder. | ||
− | ** Start the download of the | + | ** Start the download of the MatlabToolbox with the clone button. |
=Compilation Instructions= | =Compilation Instructions= | ||
Line 28: | Line 28: | ||
The MatlabToolbox will use the mex.bat to generate mex files. MSVC has to be defined as the default mex compiler. | The MatlabToolbox will use the mex.bat to generate mex files. MSVC has to be defined as the default mex compiler. | ||
− | To do so open the Matlab command prompt and type in: | + | To do so open the Matlab command prompt and type in: <tt>mex -setup</tt> |
− | < | + | |
The following information and dialogs will display. Choose the right options as shown. | The following information and dialogs will display. Choose the right options as shown. | ||
− | < | + | <pre>mex -setup |
Please choose your compiler for building external interface (MEX) files: | Please choose your compiler for building external interface (MEX) files: | ||
Line 49: | Line 49: | ||
Location: C:\Programme\Microsoft Visual Studio 8 | Location: C:\Programme\Microsoft Visual Studio 8 | ||
− | Are these correct?([y]/n): y</ | + | Are these correct?([y]/n): y</pre> |
==Config File== | ==Config File== | ||
Line 55: | Line 55: | ||
Set the include and lib pathes to your local pathes. The relevant section is indicated by | Set the include and lib pathes to your local pathes. The relevant section is indicated by | ||
− | < | + | <pre> |
#------------------------------------------------------------------------------- | #------------------------------------------------------------------------------- | ||
# Adjust the following names and pathes | # Adjust the following names and pathes | ||
Line 63: | Line 63: | ||
#------------------------------------------------------------------------------- | #------------------------------------------------------------------------------- | ||
− | </ | + | </pre> |
==Compilation== | ==Compilation== | ||
Line 91: | Line 91: | ||
If you encounter problems check out the forum: [http://www.apcocoa.org/forum/ ApCoCoA Forum] | If you encounter problems check out the forum: [http://www.apcocoa.org/forum/ ApCoCoA Forum] | ||
− | [[Category:HowTo]][[Category:MatlabToolbox]] | + | [[Category:HowTo Old]] |
+ | [[Category:MatlabToolbox]] |
Latest revision as of 09:41, 29 October 2020
Introduction
- This site is set up to collect all necessary bits and pieces to compile the MatlabToolbox on Windows.
- This description is made for compiling the MatlabToolbox with MSVC 2003 Express and Matlab 2007b.
Preparation
Before compiling the MatlabToolbox you need to install the following files/libraries:
- CoCoALib: Find a description on how to install the CoCoALib on Windows here.
- ApCoCoALib: Find a description on how to install the ApCoCoALib on Windows here.
- HG mercurial: You will need this software to download the latest MatlabToolbox from a repository. The MatlabToolbox is managed with the source control system mercurial. We will refer to TortoiseHG. TortoiseHG will install mercurial on your system and adds a context menu in the MS Explorer providing many of the needed functionalities.
Download Instructions
Get the latest MatlabToolbox version from the repo site. A brief instruction using TortoiseHG is:
- Add a folder on your local harddisk for the local repo copy.
- Open the context menu entry TortoiseHG->Clone a repository.
- As the source path copy the selected link from the repo site.
- As the destination path select your created folder.
- Start the download of the MatlabToolbox with the clone button.
Compilation Instructions
Before compiling you have to set up the right compiler in Matlab and adjust the makefile configuration.
Mex Compiler
The MatlabToolbox will use the mex.bat to generate mex files. MSVC has to be defined as the default mex compiler.
To do so open the Matlab command prompt and type in: mex -setup
The following information and dialogs will display. Choose the right options as shown.
mex -setup Please choose your compiler for building external interface (MEX) files: Would you like mex to locate installed compilers [y]/n? y Select a compiler: [1] Lcc C version 2.4.1 in C:\PROGRA~1\MATLAB\R2006b\sys\lcc [2] Microsoft Visual C/C++ version 8.0 in C:\Programme\Microsoft Visual Studio 8 [0] None Compiler: 2 Please verify your choices: Compiler: Microsoft Visual C/C++ 8.0 Location: C:\Programme\Microsoft Visual Studio 8 Are these correct?([y]/n): y
Config File
Prior to compilation you have to adjust the makefile. Open the file makefile.vc in the ApCoCoALibToolbox subfolder.
Set the include and lib pathes to your local pathes. The relevant section is indicated by
#------------------------------------------------------------------------------- # Adjust the following names and pathes #------------------------------------------------------------------------------- ... #-------------------------------------------------------------------------------
Compilation
Open a Visual Studio command prompt and change to your local ApCoCoALib folder. Use the nmake command to compile the MatlabToolbox : <c>nmake -f Makefile.vc</c> Will display all available targets. <c>nmake -f Makefile.vc toolbox</c> Will build the MatlabToolbox DLL. <c>nmake -f Makefile.vc mex</c> Will build the MatlabToolbox mex files.
Note: The mex files can be called in Matlab as usual Matlab functions.
Setting Path Variables
Windows Path Settings
In order to use the generated ApCoCoALibToolBox.dll this file has to be made known to the system. Add the following path to the System Variable Path: %ToolboxPath\ApCoCoALibToolBox (%ToolboxPath stands for your local MatlabToolbox repository folder). You can set the path e.g. using the windows gui provided at:
- right-click My Computer icon, select Properties,
- click Start > Control Panel > System icon
- Click the Advanced tab
Matlab Path Settings
To use the mex files and the classes provided by the MatlabToolbox three pathes have to be added to the Matlab Path-Variable. Open File->Set Path and add the following three folders (%ToolboxPath stands for your local MatlabToolbox repository folder):
- %ToolboxPath
- %ToolboxPath\MatlabFiles
- %ToolboxPath\MexFiles
Problems
If you encounter problems check out the forum: ApCoCoA Forum