rtw_precompile_libs
Build model libraries without building model
Description
rtw_precompile_libs(
builds libraries within model
,build_spec
)
, according
to the model
field values, and places
the libraries in a precompiled folder. Use the function to precompile new or updated
S-function libraries (MEX-files), which can reduce the overall build time for the
model.build_spec
Model builds that use the template makefile approach support the function. Model builds that use the toolchain approach do not support the function.
Examples
Precompile Libraries for Model
Build the libraries in
without building
my_model
.my_model
% Specify the library suffix if isunix suffix = '_std.a'; elseif ismac suffix = '_std.a'; else suffix = '_vcx64.lib'; end open_system(my_model); set_param(my_model, 'TargetLibSuffix',suffix); % Set the precompiled library folder set_param(my_model, 'TargetPreCompLibLocation',fullfile(pwd,'lib')); % Define a build specification that specifies % the location of the files to compile. my_build_spec = []; my_build_spec.rtwmakecfgDirs = {fullfile(pwd,'src')}; % Build the libraries in 'my_model' rtw_precompile_libs(my_model,my_build_spec);
Input Arguments
model
— Model object or name for which to build libraries
object
| 'modelName
'
object
modelName
'Name of the model containing the libraries that you want to build.
build_spec
— Structure with field values that provides the build specification
struct
Structure with fields that define a build specification. Fields except
rtwmakecfgDirs
are optional.
Name-Value Arguments
Example: build_spec.rtwmakecfgDirs = {fullfile(pwd,
'src')};
Specify the structure field values of the build_spec
.
rtwmakecfgDirs
— Fully qualified paths to the folders containing rtwmakecfg
files for libraries to precompile
array of paths
Uses the Name
and Location
elements of
makeInfo.library
, as returned by the
rtwmakecfg
function, to specify name and location of
precompiled libraries. If you use the
TargetPreCompLibLocation
parameter to specify the library
folder, it overrides the makeInfo.library.Location
setting.
The specified model must contain S-function blocks that use precompiled
libraries, which the rtwmakecfg
files specify. The makefile
that the build approach generates contains the library rules only if the
conversion requires the libraries.
Example: build_spec.rtwmakecfgDirs = {fullfile(pwd,
'src')};
libSuffix
— Suffix, including the file type extension, to append to the name of each library (for example, _std.a
or
_vcx64.lib
)
character vector
The suffix must include a period (.). Set the suffix by using either this
field or the TargetLibSuffix
parameter. If you specify a
suffix with both mechanisms, the TargetLibSuffix
setting
overrides the setting of this field.
Example: build_spec.libSuffix =
'_vcx64.lib';
intOnlyBuild
— Selects library optimization
'false'
(default) | 'true'
When set to true
, indicates that the function optimizes
the libraries so that they compile from integer code only. Applies to ERT-based
targets only.
Example: build_spec.intOnlyBuild = 'false';
makeOpts
— Specifies an option for rtwMake
character vector
Specifies an option to include in the rtwMake
command line.
Example: build_spec.makeOpts = '';
addLibs
— Specifies libraries to build
cell array of structures
This cell array of structures specifies the libraries to build that an
rtwmakecfg
function does not specify. Define each
structure with two fields that are character arrays:
libName
— Name of the library without a suffixlibLoc
— Location for the precompiled library
With the template makefile build approach, you can specify other libraries and how to build them. Use this field if you must precompile libraries.
Example: build_spec.addLibs =
'libs_list';
Version History
Introduced in R2009b
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)