rtw_precompile_libs - Build model libraries without building model - MATLAB (original) (raw)

Main Content

Build model libraries without building model

Syntax

Description

rtw_precompile_libs([model](#d126e114983),[build_spec](#d126e115008)) builds libraries within _`model`_, according to the _`buildspec`_ 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.

Model builds that use the template makefile approach support the function. Model builds that use the toolchain approach do not support the function.

example

Examples

collapse all

Build the libraries in_`mymodel`_ without building_`mymodel`_.

% 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

collapse all

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

Structure with fields that define a build specification. Fields exceptrtwmakecfgDirs are optional.

Name-Value Arguments

collapse all

Example: build_spec.rtwmakecfgDirs = {fullfile(pwd, 'src')};

Specify the structure field values of the build_spec.

Uses the Name and Location elements ofmakeInfo.library, as returned by thertwmakecfg function, to specify name and location of precompiled libraries. If you use theTargetPreCompLibLocation 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')};

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';

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';

Specifies an option to include in the rtwMake command line.

Example: build_spec.makeOpts = '';

This cell array of structures specifies the libraries to build that anrtwmakecfg function does not specify. Define each structure with two fields that are character arrays:

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

See Also

Topics