配置生成代码的编译过程
对于某些应用,您可能要控制在 C/C++ 源代码生成之后、编译之前发生的编译过程的各个方面。要从 MATLAB® 代码内指定其他编译文件和标志,请使用 coder.updateBuildInfo 函数。或者,在工作区中创建一个 RTW.BuildInfo 对象,并使用关联的对象函数来指定编译选项。当您处理外部代码集成或有多个使用相同编译信息的函数时,请使用 coder.ExternalDependency 类自定义编译过程。
使用 target 命名空间中的类来管理目标硬件和编译工具信息。例如,为代码生成注册新目标硬件,为外部模式和处理器在环 (PIL) 仿真设置目标连接,或为在开发计算机上编译生成的代码创建自定义 CMake 工具链定义。
函数
对象
RTW.BuildInfo | 提供用于编译和链接生成的代码的信息 |
类
coder.ExternalDependency | Interface to external code |
target.Alias | Create alternative identifier for target object |
target.BuildTool | Describe build tool (自 R2023a 起) |
target.BuildToolType | Describe build tool type (自 R2023a 起) |
target.CMake | Specify CMake installation for building generated code (自 R2022b 起) |
target.CMakeBuilder | Configure how CMake builds generated code (自 R2022b 起) |
target.CMakeBuildType | Describe CMake build type or build configuration (自 R2022b 起) |
target.CMakeCacheEntry | Configure a CMake cache entry (自 R2022b 起) |
target.EnvironmentConfiguration | Configure system environment for toolchain (自 R2022b 起) |
target.HardwareComponentSupport | 描述对硬件组件的支持 (自 R2022b 起) |
target.LanguageImplementation | 提供 C 和 C++ 编译器实现详细信息 |
target.Object | 用于目标类型的基类 |
target.Processor | Provide target processor information |
target.Toolchain | Capture high-level information about toolchain (自 R2022b 起) |
命名空间
target | 管理目标硬件和编译工具信息 |
主题
- Build Process Customization
Control aspects of the build process that occur after code generation but before compilation.
- C Compiler Considerations for Signed Integer Overflows
For accurate results from signed integer C operations, the C compiler must preserve wrap-on-overflow behavior.
- Requirements for Signed Integer Representation
Compile generated code on a target that uses a two’s complement representation for signed integer values.
- Register New Hardware Devices
Extend the range of supported hardware by registering new devices.
- 配置 CMake 编译过程
为编译生成的代码指定 CMake 工具链定义。
- Create Custom CMake Toolchain Definition
CMake is a third-party, open-source tool for build process management.
- 编译器和链接器错误
解决在编译过程中出现错误的常见原因。
