Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: Commodore64 on March 21, 2007, 08:56:23 am

Title: New target wizard: makes sense?
Post by: Commodore64 on March 21, 2007, 08:56:23 am
Hi,
I wanted to suggest, if it makes sense, to introduce "new target" wizards.
Here are some scenarios where they may be useful:

Imagine you are working on a wxWidgets project, configured through the wxWidgets wizard, and using MinGW (for example because you want to use the debugger). Later on you want to add a new target to compile with MSVC (for example because it compiles fast and produces smaller executables). Currently, if I am not wrong, you have to configure the new target by hand, or create a completely new project with the wxWidgets wizard (please correct me if I am missing something). With a "new wxWidgets target" wizard you would be able to auto-configure a new MSVC target in the existing project.

Another scenario: you port the same wxWidgets project to Linux. You want to add Linux targets using a wxWidgets target wizard (this would facilitate the migration towards cross-platform project files).

Notice that the current project wizards could be rewritten so that they (1) create a new project, and (2) call the corresponding new targets wizard.

What do you think about it?
Regards,
Luca
Title: Re: New target wizard: makes sense?
Post by: Biplab on March 21, 2007, 09:29:32 am
Currently, if I am not wrong, you have to configure the new target by hand, or create a completely new project with the wxWidgets wizard (please correct me if I am missing something). With a "new wxWidgets target" wizard you would be able to auto-configure a new MSVC target in the existing project.

I'm afraid this is a bit difficult to implement with the current wizard.

Alternatively you can use another feature of C::B to overcome this. Use the workspace feature. Follow the following steps.

Now if you open the workspace, it will show you both the projects and you may use anyone at a time.

Though this is not an elegant solution, but it should work. :)

Regards,

Biplab
Title: Re: New target wizard: makes sense?
Post by: mandrav on March 21, 2007, 09:34:10 am
Quote
Notice that the current project wizards could be rewritten so that they (1) create a new project, and (2) call the corresponding new targets wizard.

It is very possible that the same wizard can be used for new projects as well as new targets. The scripted wizards system has been designed to allow this.

For project wizards, the function "SetupProject(project)" is called in the script to setup the project.
For target wizards, the function "SetupTarget(target, debug_flag)" is called instead to setup the target.

Making a wizard usable both as a project and target wizard is as easy as including both of the above functions in the script. Of course this doesn't mean that the project/target setup must be duplicated. Just put the target setup code in SetupTarget and then call SetupTarget from inside SetupProject.
I don't know if I made it sound complicated but it really is not :).

EDIT: Check the console wizard's script. It does exactly what I described above.
Title: Re: New target wizard: makes sense?
Post by: Biplab on March 21, 2007, 09:40:22 am
EDIT: Check the console wizard's script. It does exactly what I described above.

Hmm... I've got some interesting clue to improve the wizard. Thanks for pointing it. :D
Title: Re: New target wizard: makes sense?
Post by: Commodore64 on March 21, 2007, 02:48:03 pm
Thank you very much for your support!  :D

Actually I didn't notice that there is already the option "Build target" in the new menu... I have to be blind  :oops: sorry...

Anyway, thanks again!
Luca