代码编译自定义
自定义编译过程的编译阶段
如果安装支持的编译工具,您可以配置编译过程,在代码生成后生成可执行代码。您可以自定义编译过程的编译阶段。
使用目标框架:
创建自定义 CMake 工具链定义。
定义和注册基于自定义联编文件的工具链。
您还可以通过使用 ToolchainInfo
对象来注册和使用基于自定义联编文件的工具链。
对于模板联编文件方法,自定义一个附带的模板联编文件。
对于 CMake、ToolchainInfo
和模板联编文件方法:
创建并运行代码生成后命令。
在编译过程的特定点上创建和应用钩子方法。
配置 S-Function 代码的编译。
命名空间
target | 管理目标硬件和构建工具信息 |
类
对象
函数
主题
编译器
- Select and Configure C or C++ Compiler
Consider programming language compliance for generated code and select a compiler for the build process. - Control Compiler Optimizations
Control compiler optimizations for your makefile at the Simulink® UI level. - Troubleshoot Compiler Issues
Identify and fix issues that prevent compiler operation in the build process. - Control Build Process Compiling and Linking
Select whether build process ends after code generation and (for template makefile approach) select template makefile options.
库名称和位置
- Control Library Location and Naming During Build
Choose the location for precompiled, non-precompiled, and model reference libraries and select the file extension that the build process applies to libraries.
使用目标框架的基于 CMake 和联编文件的工具链
- Create Custom CMake Toolchain Definition
CMake is a third-party, open-source tool for build process management. - Define Custom Makefile-Based Toolchains Using Target Framework
Define and register custom makefile-based toolchains. - Build Generated Code Remotely
Create a connection and build generated code on a remote computer.
使用 ToolchainInfo
的基于联编文件的工具链
- Custom Toolchain Registration
Register third-party software build tools for creating executables and libraries. - Register Custom Toolchain and Build Executable
Register and use a toolchain to build an executable program. - Troubleshooting Custom Toolchain Validation
Troubleshoot validation errors.
模板联编文件方法
- Template Makefiles and Make Options
Template makefiles that are built into the code generator. - Customize Template Makefiles
Develop a custom template makefile to control the build process.
高级方法
- Customize Post-Code-Generation Build Processing
Modify the build process with a post-code-generation command and (optionally) use build information objects to augment this process. - 使用 STF_make_rtw_hook 文件自定义编译过程
使用自定义
钩子文件中的编译过程钩子机制修改编译过程。STF
_make_rtw_hook.m - Customize Build Process with sl_customization.m
Modify the build process with the build process hook mechanism in a custom sl_customization.m hook file. - Use makecfg to Customize Generated Makefiles for S-Functions
Configure makefile generation for the S-function build process.