Main Content

setTargetProvidesMain

Disable inclusion of code generator provided (generated or static) main.c source file during build

Description

example

setTargetProvidesMain(buildinfo,providesmain) disables the code generator from including a sample main.c source file.

To replace the sample main.c file from the code generator with a custom main.c file, call the setTargetProvidesMain function during the 'after_tlc' case in the ert_make_rtw_hook.m or grt_make_rtw_hook.m file.

Examples

collapse all

To apply the setTargetProvidesMain function:

Add buildInfo to the arguments in the function call.

function ert_make_rtw_hook(hookMethod,Name,rtwroot, ...
   templateMakefile,buildOpts,buildArgs,buildInfo)

Add the setTargetProvidesMain function to the 'after_tlc' stage.

case 'after_tlc'
 % Called just after to invoking TLC Compiler (actual code generation.)
 % Valid arguments at this stage are hookMethod, Name, and
 % buildArgs, buildInfo
 %
 setTargetProvidesMain(buildInfo,true);

Use the Configuration Parameters > Code Generation > Custom Code > Source Files field to add your custom main.c to the . When you indicate that the target provides main.c, the requires this file to build without errors.

Input Arguments

collapse all

The providesmain argument specifies whether the code generator includes a (generated or static) main.c source file.

  • false — The code generator includes a sample main.obj object file.

  • true — The target provides the main.c source file.

Introduced in R2009a