Пример #1
0
//--------------------------------------------------------------------------------------------------
void MakeExecutable
(
    int argc,           ///< Count of the number of command line parameters.
    const char** argv   ///< Pointer to an array of pointers to command line argument strings.
)
//--------------------------------------------------------------------------------------------------
{
    GetCommandLineArgs(argc, argv);

    Build(ConstructObjectModel());
}
Пример #2
0
void CMainFrame::OnInitialUpdate()
{
	// Here we process the command line arguments, and automatically load a file if one is specified.
	// GetCommandLineArgs retrieves our command line arguments and stores them in a vector of CString.

	std::vector<CString> args = GetCommandLineArgs();
	// The second argument (if any) contains our file name.
	if (args.size() > 1)
	{
		GetDoc().FileOpen(args[1]);
	}
}
Пример #3
0
void MultipleInstanceManager::SendParameters()
{
	if(m_pfnBSM == NULL)
		return;

	if(__argc < 2)
	{
		// If there are no arguments to send, then
		// we simply activate the other instance.
		ActivateOther();
		return;
	}

	std::list<tstring> args = GetCommandLineArgs();
	SendParameters(args);
}
Пример #4
0
//--------------------------------------------------------------------------------------------------
void MakeSystem
(
    int argc,           ///< Count of the number of command line parameters.
    const char** argv   ///< Pointer to an array of pointers to command line argument strings.
)
//--------------------------------------------------------------------------------------------------
{
    GetCommandLineArgs(argc, argv);

    // Set the target-specific environment variables (e.g., LEGATO_TARGET).
    mk::SetTargetSpecificEnvVars(BuildParams.Target());

    // Parse the .sdef file, populating the System object with the results.
    legato::parser::ParseSystem(&System, BuildParams);

    Build();
}
Пример #5
0
//--------------------------------------------------------------------------------------------------
void MakeParsedModel
(
    int argc,           ///< Count of the number of command line parameters.
    const char** argv   ///< Pointer to an array of pointers to command line argument strings.
)
//--------------------------------------------------------------------------------------------------
{
    // Process our command line arguments and figure out what the user is asking us to do.
    auto processedArgs = GetCommandLineArgs(argc, argv);

    FindToolChain(processedArgs.params);
    mk::BuildParams_t& buildParams = processedArgs.params;
    //buildParams.readOnly = true;

    // Set the target-specific environment variables (e.g., LEGATO_TARGET).
    envVars::SetTargetSpecific(buildParams);

    std::ostream& output = std::cout;

    switch (processedArgs.defType)
    {
        case DefType_t::CDEF:
            GenerateJsonModel(output, processedArgs, modeller::GetComponent);
            break;

        case DefType_t::ADEF:
            //GenerateJsonModel(output, processedArgs, modeller::GetApp);
            break;

        case DefType_t::SDEF:
            GenerateJsonModel(output, processedArgs, modeller::GetSystem);
            break;

        case DefType_t::MDEF:
            GenerateJsonModel(output, processedArgs, modeller::GetModule);
            break;
    }
}
Пример #6
0
//--------------------------------------------------------------------------------------------------
void MakeComponent
(
    int argc,           ///< Count of the number of command line parameters.
    const char** argv   ///< Pointer to an array of pointers to command line argument strings.
)
//--------------------------------------------------------------------------------------------------
{
    GetCommandLineArgs(argc, argv);

    // Set the target-specific environment variables (e.g., LEGATO_TARGET).
    mk::SetTargetSpecificEnvVars(BuildParams.Target());

    ConstructObjectModel();

    if (IsStandAlone)
    {
        BuildStandAlone();
    }
    else
    {
        Build();
    }
}
Пример #7
0
//--------------------------------------------------------------------------------------------------
void MakeApp
(
    int argc,           ///< Count of the number of command line parameters.
    const char** argv   ///< Pointer to an array of pointers to command line argument strings.
)
//--------------------------------------------------------------------------------------------------
{
    GetCommandLineArgs(argc, argv);

    // Set the target-specific environment variables (e.g., LEGATO_TARGET).
    envVars::SetTargetSpecific(BuildParams.target);

    // If we have been asked not to run Ninja, then delete the staging area because it probably
    // will contain some of the wrong files now that .Xdef file have changed.
    if (DontRunNinja)
    {
        file::DeleteDir(path::Combine(BuildParams.workingDir, "staging"));
    }
    // If we have not been asked to ignore any already existing build.ninja, and the command-line
    // arguments and environment variables we were given are the same as last time, just run ninja.
    else if (args::MatchesSaved(BuildParams, argc, argv) && envVars::MatchesSaved(BuildParams))
    {
        RunNinja(BuildParams);
        // NOTE: If build.ninja exists, RunNinja() will not return.  If it doesn't it will.
    }

    // Construct a model of the application.
    AppPtr = modeller::GetApp(AdefFilePath, BuildParams);
    if (AppPtr->version.empty())
    {
        AppPtr->version = VersionSuffix;
    }

    // Append a "." and the VersionSuffix if the user provides a
    // "--append or -a" argument in the command line
    else if (VersionSuffix.empty() == false)
    {
        AppPtr->version += '.' + VersionSuffix;
    }

    // Ensure that all client-side interfaces have either been bound to something or declared
    // external.
    modeller::EnsureClientInterfacesSatisfied(AppPtr);

    if (BuildParams.beVerbose)
    {
        modeller::PrintSummary(AppPtr);
    }

    // Since this app is the only app, it won't be under the "apps" subdirectory,
    // reset the application's relative working directory path.
    AppPtr->workingDir = "";

    // Create the working directory, if it doesn't already exist.
    file::MakeDir(BuildParams.workingDir);

    // Generate the configuration data file.
    config::Generate(AppPtr, BuildParams);

    // Generate the build script for the application.
    ninja::Generate(AppPtr, BuildParams, OutputDir, argc, argv);

    // For each executable in the application,
    for (auto exePtr : AppPtr->executables)
    {
        // Generate _main.c.
        code::GenerateExeMain(exePtr, BuildParams);
    }

    // For each component in the application,
    for (auto componentPtr : AppPtr->components)
    {
        // Create a working directory to build the component in.
        file::MakeDir(path::Combine(BuildParams.workingDir, componentPtr->workingDir));

        // Generate a custom "interfaces.h" file for this component.
        code::GenerateInterfacesHeader(componentPtr, BuildParams);

        // Generate a custom "_componentMain.c" file for this component.
        code::GenerateComponentMainFile(componentPtr, BuildParams, false);
    }

    // Generate the manifest.app file for Air Vantage.
    airVantage::GenerateManifest(AppPtr, BuildParams);

    // If we haven't been asked not to run ninja,
    if (!DontRunNinja)
    {
        // Save the command-line arguments and environment variables for future comparison.
        // Note: we don't need to do this if we have been asked not to run ninja, because
        // that only happens when ninja is already running and asking us to regenerate its
        // script for us, and that only happens if we just saved the args and env vars and
        // ran ninja.
        args::Save(BuildParams, argc, argv);
        envVars::Save(BuildParams);

        RunNinja(BuildParams);
    }
}
Пример #8
0
//--------------------------------------------------------------------------------------------------
void MakeSystem
(
    int argc,           ///< Count of the number of command line parameters.
    const char** argv   ///< Pointer to an array of pointers to command line argument strings.
)
//--------------------------------------------------------------------------------------------------
{
    GetCommandLineArgs(argc, argv);

    // Set the target-specific environment variables (e.g., LEGATO_TARGET).
    envVars::SetTargetSpecific(BuildParams.target);

    // Compute the staging directory path.
    auto stagingDir = path::Combine(BuildParams.workingDir, "staging");

    // If we have been asked not to run Ninja, then delete the staging area because it probably
    // will contain some of the wrong files now that .Xdef file have changed.
    if (DontRunNinja)
    {
        file::DeleteDir(stagingDir);
    }
    // If we have not been asked to ignore any already existing build.ninja, and the command-line
    // arguments and environment variables we were given are the same as last time, just run ninja.
    else if (args::MatchesSaved(BuildParams, argc, argv) && envVars::MatchesSaved(BuildParams))
    {
        RunNinja(BuildParams);
        // NOTE: If build.ninja exists, RunNinja() will not return.  If it doesn't it will.
    }

    // Construct a model of the system.
    model::System_t* systemPtr = modeller::GetSystem(SdefFilePath, BuildParams);

    // If verbose mode is on, print a summary of the system model.
    if (BuildParams.beVerbose)
    {
//        modeller::PrintSummary(systemPtr);
    }

    // Create the working directory and the staging directory, if they don't already exist.
    file::MakeDir(stagingDir);

    // Generate code for all the components in the system.
    GenerateCode(model::Component_t::GetComponentMap(), BuildParams);

    // Generate code and configuration files for all the apps in the system.
    for (auto appMapEntry : systemPtr->apps)
    {
        GenerateCode(appMapEntry.second, BuildParams);
    }

    // Generate the configuration files for the system.
    config::Generate(systemPtr, BuildParams);

    // Generate the build script for the system.
    ninja::Generate(systemPtr, BuildParams, OutputDir, argc, argv);

    // If we haven't been asked not to run ninja,
    if (!DontRunNinja)
    {
        // Save the command-line arguments and environment variables for future comparison.
        // Note: we don't need to do this if we have been asked not to run ninja, because
        // that only happens when ninja is already running and asking us to regenerate its
        // script for us, and that only happens if we just saved the args and env vars and
        // ran ninja.
        args::Save(BuildParams, argc, argv);
        envVars::Save(BuildParams);

        RunNinja(BuildParams);
    }
}
Пример #9
0
//--------------------------------------------------------------------------------------------------
void MakeApp
(
    int argc,           ///< Count of the number of command line parameters.
    const char** argv   ///< Pointer to an array of pointers to command line argument strings.
)
//--------------------------------------------------------------------------------------------------
{
    GetCommandLineArgs(argc, argv);

    // Set the target-specific environment variables (e.g., LEGATO_TARGET).
    envVars::SetTargetSpecific(BuildParams.target);

    // If we have been asked not to run Ninja, then delete the staging area because it probably
    // will contain some of the wrong files now that .Xdef file have changed.
    if (DontRunNinja)
    {
        file::DeleteDir(path::Combine(BuildParams.workingDir, "staging"));
    }
    // If we have not been asked to ignore any already existing build.ninja, and the command-line
    // arguments and environment variables we were given are the same as last time, just run ninja.
    else if (args::MatchesSaved(BuildParams, argc, argv) && envVars::MatchesSaved(BuildParams))
    {
        RunNinja(BuildParams);
        // NOTE: If build.ninja exists, RunNinja() will not return.  If it doesn't it will.
    }
    // If we have not been asked to ignore any already existing build.ninja and there has
    // been a change in either the argument list or the environment variables,
    // save the command-line arguments and environment variables for future comparison.
    // Note: we don't need to do this if we have been asked not to run ninja, because
    // that only happens when ninja is already running and asking us to regenerate its
    // script for us, and that only happens if the args and env vars have already been saved.
    else
    {
        // Save the command line arguments.
        args::Save(BuildParams, argc, argv);

        // Save the environment variables.
        // Note: we must do this before we parse the definition file, because parsing the file
        // will result in the CURDIR environment variable being set.
        envVars::Save(BuildParams);
    }

    // Construct a model of the application.
    model::App_t* appPtr = modeller::GetApp(AdefFilePath, BuildParams);

    // Append a "." and the VersionSuffix if the user provides a
    // "--append or -a" argument in the command line.
    if (appPtr->version.empty())
    {
        appPtr->version = VersionSuffix;
    }
    else if (VersionSuffix.empty() == false)
    {
        appPtr->version += '.' + VersionSuffix;
    }

    // Ensure that all client-side interfaces have either been bound to something or declared
    // external.
    modeller::EnsureClientInterfacesSatisfied(appPtr);

    // If verbose mode is on, print a summary of the application model.
    if (BuildParams.beVerbose)
    {
        modeller::PrintSummary(appPtr);
    }

    // Generate app-specific code and configuration files.
    GenerateCode(appPtr, BuildParams);

    // Generate code for all the components in the app.
    GenerateCode(appPtr->components, BuildParams);

    // Generate the build script for the application.
    ninja::Generate(appPtr, BuildParams, OutputDir, argc, argv);

    // If we haven't been asked not to, run ninja.
    if (!DontRunNinja)
    {
        RunNinja(BuildParams);
    }
}