Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

代码编译自定义

自定义编译过程的编译阶段

如果安装支持的编译工具,您可以配置编译过程,在代码生成后生成可执行代码。您可以自定义编译过程的编译阶段。

使用目标框架:

  • 创建自定义 CMake 工具链定义。

  • 定义和注册基于自定义联编文件的工具链。

您还可以通过使用 ToolchainInfo 对象来注册和使用基于自定义联编文件的工具链。

对于模板联编文件方法,自定义一个附带的模板联编文件。

对于 CMake、ToolchainInfo 和模板联编文件方法:

  • 创建并运行代码生成后命令。

  • 在编译过程的特定点上创建和应用钩子方法。

  • 配置 S-Function 代码的编译。

命名空间

target管理目标硬件和构建工具信息

全部展开

target.BuildToolDescribe build tool (自 R2023a 起)
target.BuildToolTypeDescribe build tool type (自 R2023a 起)
target.CMakeSpecify CMake installation for building generated code (自 R2022b 起)
target.CMakeBuildTypeDescribe CMake build type or build configuration (自 R2022b 起)
target.CMakeBuilder Configure how CMake builds generated code (自 R2022b 起)
target.CMakeCacheEntryConfigure a CMake cache entry (自 R2022b 起)
target.DirectiveDescribe command-line flag for tool (自 R2023a 起)
target.EnvironmentConfigurationConfigure system environment for toolchain (自 R2022b 起)
target.FileTypeDefine identifier for file type (自 R2023a 起)
target.HardwareComponentSupportDescribe support for a hardware component (自 R2022b 起)
target.MakefileBuilderSpecify that toolchain is makefile-based (自 R2023a 起)
target.MakeToolTypeDescribe syntax for makefile type (自 R2023a 起)
target.PairedDirectiveDescribe pair of command-line flags (自 R2023a 起)
target.RepeatingDirectiveDescribe repeated command-line flag for tools (自 R2023a 起)
target.ToolchainCapture high-level information about toolchain (自 R2022b 起)

对象

全部展开

RTW.BuildInfo提供用于编译和链接生成的代码的信息

函数

全部展开

addCompileFlagsAdd compiler options to build information
addDefinesAdd preprocessor macro definitions to build information
addIncludeFilesAdd include files to build information
addIncludePathsAdd include paths to build information
addLinkFlagsAdd link options to build information
addLinkObjectsAdd link objects to build information
addNonBuildFilesAdd nonbuild-related files to build information
addSourceFilesAdd source files to build information
addSourcePathsAdd source paths to build information
addTMFTokensAdd template makefile (TMF) tokens to build information
removeIncludePathsRemove include paths from build information (自 R2023b 起)
removeSourceFilesRemove source files from build information object (自 R2021b 起)
findBuildArgFind a specific build argument in build information
findIncludeFilesFind and add include (header) files to build information
getBuildArgsGet build arguments from build information
getCompileFlagsGet compiler options from build information
getDefinesGet preprocessor macro definitions from build information
getFullFileListGet list of files from build information
getIncludeFilesGet include files from build information
getIncludePathsGet include paths from build information
getLinkFlagsGet link options from build information
getNonBuildFilesGet nonbuild-related files from build information
getSourceFilesGet source files from build information
getSourcePathsGet source paths from build information
setTargetProvidesMainDisable inclusion of code generator provided (generated or static) main.c source file during build
updateFilePathsAndExtensionsUpdate files in build information with missing paths and file extensions
updateFileSeparatorUpdate file separator character for file lists in build information
codebuild编译和链接生成的代码 (自 R2020b 起)

主题

编译器

库名称和位置

使用目标框架的基于 CMake 和联编文件的工具链

使用 ToolchainInfo 的基于联编文件的工具链

模板联编文件方法

高级方法