target info

Discussion about CodeLite development process and patches
lurscher
CodeLite Enthusiast
Posts: 11
Joined: Wed Oct 31, 2012 4:34 pm
Genuine User: Yes
IDE Question: c++
Contact:

target info

Post 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
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: target info

Post 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
Make sure you have read the HOW TO POST thread
Post Reply