Ejemplo n.º 1
0
//--------------------------------------------------------------------------------------------------
static void BuildExecutables
(
    legato::App& app,
    const legato::BuildParams_t& buildParams
)
//--------------------------------------------------------------------------------------------------
{
    // Create an Executable Builder object.
    ExecutableBuilder_t exeBuilder(buildParams);

    // For each executable,
    auto& exeList = app.Executables();
    for (auto i = exeList.begin(); i != exeList.end(); i++)
    {
        legato::Executable& exe = i->second;

        // Put the intermediate build output files under a directory named after the executable.
        std::string objOutputDir = legato::CombinePath(buildParams.ObjOutputDir(), exe.CName());

        // Auto-generate the source code file containing main() and add it to the default component.
        exeBuilder.GenerateMain(exe, objOutputDir);

        // Build the executable.
        exeBuilder.Build(exe, objOutputDir);
    }
}
Ejemplo n.º 2
0
//--------------------------------------------------------------------------------------------------
static void Build
(
    legato::Executable& exe
)
//--------------------------------------------------------------------------------------------------
{
    // Set the target-specific environment variables (e.g., LEGATO_TARGET).
    mk::SetTargetSpecificEnvVars(BuildParams.Target());

    // Auto-generate the source code file containing main() and add it to the default component.
    ExecutableBuilder_t exeBuilder(BuildParams);
    exeBuilder.GenerateMain(exe);

    // Build all the components.
    ComponentBuilder_t componentBuilder(BuildParams);
    for (auto componentInstance : exe.ComponentInstanceList())
    {
        // Generate the IPC import/export code.
        componentBuilder.GenerateInterfaceCode(componentInstance.GetComponent());

        // Build the component.
        componentBuilder.Build(componentInstance.GetComponent());
    }

    // Do the final build step for the executable.
    // Note: All the components need to be built before this.
    exeBuilder.Build(exe);
}