Configuration

About the mbuild Utility

The mbuild script provides an easy way for you to specify an options file that lets you:

mbuild simplifies the process of setting up a C or C++ compiler. Typically, you only need to use the mbuild utility's setup option once to specify which third-party compiler you want to use. For more information on the mbuild utility, see the mbuild reference page.

MATLAB Compiler (mcc) automatically invokes mbuild under certain conditions. In particular, mcc -m or mcc -l invokes mbuild to perform compilation and linking.

See the reference page for more information about mbuild. For examples of mbuild usage, see Compiling the Driver Application and Compiling the Driver Application.

Configuring an ANSI C or C++ Compiler

Compiler Options Files

Options files contain flags and settings that control the operation of your installed C and C++ compiler. Options files are compiler-specific, i.e., there is a unique options file for each supported C/C++ compiler, which The MathWorks provides.

When you select a compiler to use with MATLAB Compiler , the corresponding options file is activated on your system. To select a default compiler, use

mbuild -setup

Additional information on the options files is provided in this chapter for those users who may need to modify them to suit their own needs. Many users never have to be concerned with the inner workings of the options files and only need the setup option to initially designate a C or C++ compiler. If you need more information on options files, see Options Files.

Windows.   Executing the command on Windows gives

mbuild -setup
Please choose your compiler for building standalone MATLAB applications: 
 
Would you like mbuild to locate installed compilers [y]/n? y
 
Select a compiler: 
[1] Lcc-win32 C 2.4.1 in X:\bat\ADOCNI~1\matlab\sys\lcc 
[2] Microsoft Visual C++ 2005 in C:\Program Files\Microsoft Visual 
    Studio 8 
[3] Microsoft Visual C++ .NET 2003 in C:\Program Files\Microsoft Visual 
    Studio .NET 2003 
 
[0] None Compiler: 2
 
Please verify your choices: 
 
Compiler: Microsoft Visual C++ 2005  
Location: C:\Program Files\Microsoft Visual Studio 8 Please verify 
your choices: 

Are these correct?([y]/n): y
 
Trying to update options file: 
C:\WINNT\Profiles\username\Application 
Data\MathWorks\MATLAB\current_release\compopts.bat 
From template:              
\\sys\MATLAB\BIN\WIN32\mbuildopts\msvc60compp.bat 
 
Done ...

The preconfigured options files that are included with MATLAB for Windows are shown below.

Options File

Compiler

lcccompp.bat

Lcc C, Version 2.4.1 (included with MATLAB)

msvc60compp.bat
msvc71compp.bat
msvc80compp.bat
msvc80freecompp.bat

Microsoft Visual C/C++, Version 6.0
Microsoft Visual C/C++, Version 7.1
Microsoft Visual C/C++, Version 8.0
Microsoft Visual C/C++, Version 8.0 Express Edition

UNIX.   Executing the command on UNIX gives

mbuild -setup

Using the 'mbuild -setup' command selects an options file that is 
placed in ~/.matlab/current_release and
 used by default for 'mbuild'. An options file in the current
working directory or specified on 
the command line overrides the default options file 
in ~/.matlab/current_release.

Options files control which compiler to use, the compiler 
and link command options, and the run time libraries to link against.
 
To override the default options file, use the 'mbuild -f' 
command (see 'mbuild -help' for more information).

The options files available for mbuild are:

1: matlabroot/bin/mbuildopts.sh : 
Build and link with MATLAB C-API or MATLAB Compiler-generated 
library via the system ANSI C/C++ compiler
 
matlabroot/bin/mbuildopts.sh is being copied to 
/home/user/.matlab/current_release/mbuildopts.sh

The preconfigured options file that is included with MATLAB for UNIX is mbuildopts.sh, which uses the system native ANSI compiler for Solaris and gcc for Linux and Macintosh.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS