Products & Services Solutions Academia Support User Community Company

Learn more about Real-Time Workshop   

rtw_precompile_libs - Build libraries within model without building model

Syntax

rtw_precompile_libs('model', build_spec)

Description

rtw_precompile_libs('model', build_spec) builds libraries within model, according to the build_spec arguments, and places the libraries in a precompiled folder.

Inputs

model

Character array. Name of the model containing the libraries that you want to build.

build_spec

Structure of field and value pairs that define a build specification; all fields except rtwmakecfgDirs are optional:

FieldValue
rtwmakecfgDirs

Cell array of strings that names the folders containing rtwmakecfg files for libraries that you want to precompile. 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 blocks that use precompiled libraries that the rtwmakecfg files specify. The template makefile (TMF)-to-makefile conversion generates the library rules only if the conversion needs the libraries.

libSuffix (optional)

String that specifies the suffix, including the file type extension, to append to the name of each library (for example, .a or _vc.lib). The string must include a period (.). Set the suffix with either this field or the TargetLibSuffix parameter. If you specify a suffix with both mechanisms, the TargetLibSuffix setting overrides the setting of this field.

intOnlyBuild (optional)

Boolean flag. When set to true, indicates the function optimizes the libraries so that they compile from integer code only. Applies to ERT-based targets only.

makeOpts (optional)

String that specifies an option to include in the rtwMake command line.

addLibs (optional)

Cell array of structures that specify 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 suffix

  • libLoc — location for the precompiled library

The TMF can specify other libraries and how to build them. Use this field if you must precompile libraries.

Examples

Build the libraries in my_model without building my_model:

% Specify the library suffix
if isunix
   suffix = '.a';
else
   suffix = '_vc.lib';
end
set_param(my_model, 'TargetLibSuffix', suffix);

% Set the prcompiled library folder
set_param(my_model, 'TargetPreCompLibLocation', fullfile(pwd,'lib'));

% Define a build specification that specifies the location of the files to compile.
build_spec = [];
build_spec.rtwmakecfgDirs = {fullfile(pwd, 'src')};

% Build the libraries in 'my_model'
rtw_precompile_libs(my_model, build_spec);

How To

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

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