How can I package generated code with the minimal set of files necessary for compilation using packNGo?

5 次查看(过去 30 天)
We are generating code from our Simulink model and would like to package the generated code into a folder with all necessary files for compilation, for example: simstruc.h, fixedpoint.h, tmwtypes.h, and simstruc_types.h in "matlabroot\simulink\include". The files are necessary may change depending on settings/blocks in the model.
However, the "packNGo" utility unnecessarily adds too many files. Instead of adding only the 4 necessary files for compilation, it will add 30 or even more. So code generation and compiling take much longer.
How can we package the generated code into a folder with the minimal set of files necessary for compilation?

采纳的回答

MathWorks Support Team
编辑:MathWorks Support Team 2022-7-28
One of the limitations of the packNGo utility is that unnecessary files may be included even if they are not used. This happens because the utility includes additional files from the source and include paths, some of which may be unnecessary for your use case. The information for which files are to be included in the packaged zip folder is stored in an "RTW.buildInfo" object (for an example, see "model_ert_rtw\buildInfo.mat" file after generating code). The "packNGo" function is called with this "buildInfo" object for the model, as described here:
Therefore, if you would like to modify which files are included in the packaged folder you can modify the "buildInfo" object appropriately. Attached is a script that demonstrates how you might modify the "buildInfo" object to remove the "main" source files that are unnecessary. This script removes the "ert_main.c" or "rt_main.c" files that get generated. You can use this script as starting point to customize which files you want to be included in the packaged folder. More information on functions you can use with the "buildInfo" object can be found here:

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Deployment, Integration, and Supported Hardware 的更多信息

产品


版本

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by