Page 1 of 1

target info

Posted: Mon Nov 12, 2012 12:44 am
by lurscher
Hi,

I'm basing off the QMake plugin in order to create a scons build script generation

I'm seeing that QMake relies on the user picking a selection about the type of target(console, static lib or dyn lib). see https://codelite.svn.sourceforge.net/sv ... rojdlg.cpp

Isn't this redundant? Does this suggests that there is no explicit way to retrieve the targets for a given project? I would expect the api to return at least one target per project, with such information

Re: target info

Posted: Mon Nov 12, 2012 12:49 am
by eranif
The easiest way to retrieve the build configuration is by simply calling:

To get the "Debug" build configuration info:

Code: Select all

BuildConfigPtr bldConf = WorkspaceST::Get()->GetProjBuildConf( "project-name", "Debug" );
To get the selected build configuration, simply leave the requested build configuration empty:

Code: Select all

BuildConfigPtr bldConf = WorkspaceST::Get()->GetProjBuildConf( "project-name", "" );
OR:

You can look for the project:

Code: Select all

wxString errMsg;
ProjectPtr project = WorkspaceST::Get()->FindProjectByName("MyProject", errMsg);
Next, you can explore the build configurations (aka: targets)

Code: Select all

    ProjectSettingsPtr settings = project->GetSettings();
    ProjectSettingsCookie cookie;
    
    BuildConfigPtr buildConfig = settings->GetFirstBuildConfiguration(cookie);
    while ( BuildConfig ) {
        buildConfig = settings->GetNextBuildConfiguration(cookie);
        
        // DO something with the build-configuration
        wxString targetName = buildConfig->GetName();
    }
Eran