メインコンテンツ

生成されたコードのビルド プロセスの構成

生成されたソース コードのコンパイルおよびリンクをカスタマイズする

アプリケーションによっては、C/C++ ソース コード生成後のコンパイル前に発生するビルド プロセスの内容を制御する場合があります。追加のビルド ファイルおよびフラグを MATLAB® コード内から指定するには、coder.updateBuildInfo 関数を使用します。あるいは、ワークスペースで RTW.BuildInfo オブジェクトを作成し、関連するオブジェクト関数を使用してビルド オプションを指定します。外部コードの統合を使用している場合や、同じビルド情報を使用する複数の関数がある場合は、coder.ExternalDependency クラスを使用してビルド プロセスをカスタマイズします。

ターゲット ハードウェアおよびビルド ツールの情報を管理するには、target 名前空間のクラスを使用します。たとえば、コード生成用に新しいターゲット ハードウェアを登録したり、エクスターナル モードおよびプロセッサインザループ (PIL) シミュレーション用にターゲット接続性を設定したり、開発用コンピューターでの生成コードの作成用にカスタムの CMake ツールチェーン定義を作成したりします。

関数

すべて展開する

coder.updateBuildInfoRTW.BuildInfo ビルド情報オブジェクトの更新
target.addターゲット オブジェクトを内部データベースに追加
target.clearClear all target objects from internal database (R2023a 以降)
target.createターゲット オブジェクトを作成
target.exportターゲット オブジェクトのデータをエクスポート
target.getターゲット オブジェクトを内部データベースから取得
target.remove内部データベースからのターゲット オブジェクトの削除
target.updateUpdate target objects in internal database (R2023a 以降)
target.upgradeハードウェア デバイスの既存の定義のアップグレード
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
addPreincludeFilesAdd preinclude files to build information (R2024a 以降)
addSourceFilesAdd source files to build information
addSourcePathsAdd source paths to build information
addUndefinesAdd undefine preprocessor directives to build information (R2024a 以降)
removeIncludePathsRemove include paths from build information (R2023b 以降)
removeSourceFilesRemove source files from build information object (R2021b 以降)
removeUndefinesRemove undefine preprocessor macros from build information (R2024a 以降)
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
getPreincludeFilesGet preinclude files from build information (R2024a 以降)
getSourceFilesGet source files from build information
getSourcePathsGet source paths from build information
getUndefinesFrom build information, get preprocessor macros to undefine (R2024a 以降)
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

オブジェクト

RTW.BuildInfo生成されたコードのコンパイルとリンクに関する情報を提供する

クラス

coder.ExternalDependency外部コードへのインターフェイス
target.Aliasターゲット オブジェクトの代替識別子を作成
target.BuildToolDescribe build tool (R2023a 以降)
target.BuildToolTypeDescribe build tool type (R2023a 以降)
target.CMakeSpecify CMake installation for building generated code (R2022b 以降)
target.CMakeBuilder Configure how CMake builds generated code (R2022b 以降)
target.CMakeBuildTypeDescribe CMake build type or build configuration (R2022b 以降)
target.CMakeCacheEntryConfigure a CMake cache entry (R2022b 以降)
target.EnvironmentConfigurationConfigure system environment for toolchain (R2022b 以降)
target.HardwareComponentSupportDescribe support for a hardware component (R2022b 以降)
target.LanguageImplementationC および C++ コンパイラの実装の詳細を提供
target.Objectターゲット タイプの基底クラス
target.Processorターゲット プロセッサ情報の提供
target.ToolchainCapture high-level information about toolchain (R2022b 以降)

名前空間

targetターゲット ハードウェアとビルド ツールの情報の管理

トピック

注目の例