Author Topic: Wizard Settings: How to set compiler and linker flags?  (Read 4031 times)

heplesser

  • Guest
Wizard Settings: How to set compiler and linker flags?
« on: January 12, 2007, 05:25:12 pm »

Hi!

Thank you so much for developing Code::Blocks ! Finally a viable tool for teaching programming courses in a Windows environment :)!

I would appreciate advice on how to solve the following problem. I am teaching introductory programming and want to confuse my students as little as possible with IDE details. I have therefore created user-based templates containing a skeleton source code file and a cbp file with all the right settings. This is particularly important for graphics programs linking against the g2 and gd libraries. Storing these projects as user templates works fine, except that

- each student needs to store the templates in his/her own home directory
- students have to click on "user based template"

I tried adding a wizard and got it to work in principal. The problem is that the wizard does not pick up any compiler/linker configuration from the cbp file.
Is there any way to tell the Wizard

1. let the user choose the project name and placement (and nothing else)
2. fetch all configuration info from a cbp file
3. fetch the given source code files

I'd greatly appreciate any advice!
Hans

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Wizard Settings: How to set compiler and linker flags?
« Reply #1 on: January 12, 2007, 05:30:26 pm »
1. let the user choose the project name and placement (and nothing else)
Yes, that's no problem.

2. fetch all configuration info from a cbp file
No, this is not possible. The wizard *creates* the cbp file as you define it inside the wizard itself. Check e.g. the console wizard how that works.

3. fetch the given source code files
Yes, the wizard(s) all copy the sources from a directory (or directories) you provide in the wizard.

Again: Have a look at the console (or for graphics maybe the glut) wizard - they implement quite well what you want.

With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

heplesser

  • Guest
Re: Wizard Settings: How to set compiler and linker flags?
« Reply #2 on: January 18, 2007, 01:47:23 pm »
Thanks for your recommendations, Morten! Unfortunately, I only got half way, didn't get everything to work just as I would like it to. My biggest problem at present is that I have no documentation for the wizard, so if I can't guess things on the basis of existing scripts, I am stuck.

One example: I don't want my students to either change compiler og targets, so I set both boolean options to false in

Wizard.AddCompilerPage(_T(""), _T("gcc*"), false, false);

but then neither debug nor release target are created, so SetupProject() never calls SetupTarget(). Ideally, I don't want to call AddCompilerPage at all, but simply set the compiler to gcc and activate Debug, Release and possibly Profiling targets.

I'd also like to turn off the "Pause when execution ends" option, but cannot see how to do that.

Any hints and pointers to documentation would be greatly appreciated. Also, while wizards probably are a fine thing in general, life would be a lot easier for me if I could just install "User Templates" in a global place. I don't need rocket science, just a very well defined setup for my students.

Hans

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Wizard Settings: How to set compiler and linker flags?
« Reply #3 on: January 18, 2007, 03:54:20 pm »
Quote from: heplesser
One example: I don't want my students to either change compiler og targets, so I set both boolean options to false in

Wizard.AddCompilerPage(_T(""), _T("gcc*"), false, false);

but then neither debug nor release target are created, so SetupProject() never calls SetupTarget(). Ideally, I don't want to call AddCompilerPage at all, but simply set the compiler to gcc and activate Debug, Release and possibly Profiling targets.

Quote from: svn commit log for revision 3504
* Added three new script functions for wizard scripts: SetCompilerDefault, SetDebugTargetDefaults and SetReleaseTargetDefaults. To be used when no compiler page is added to the wizard.

Example usage:

Code
    // no need for Wizard.AddCompilerPage(...) now

    Wizard.SetCompilerDefault(_T("gcc"));
    Wizard.SetDebugTargetDefaults(true, _T("Debug"), _T("bin/Debug/"), _T("obj/Debug/"));
    Wizard.SetReleaseTargetDefaults(false, _T("Release"), _T("bin/Release/"), _T("obj/Release/"));

Quote from: heplesser
I'd also like to turn off the "Pause when execution ends" option, but cannot see how to do that.

Code
// pass 'true' for pausing after execution, 'false' for not pausing
// note that this affects console executables only

target.SetUseConsoleRunner(bool);

Quote from: heplesser
Any hints and pointers to documentation would be greatly appreciated.

http://wiki.codeblocks.org/index.php?title=Scripting_Code::Blocks
Most everything is documented there, apart from the latest additions. These will get added too eventually.
Be patient!
This bug will be fixed soon...

heplesser

  • Guest
Re: Wizard Settings: How to set compiler and linker flags?
« Reply #4 on: January 22, 2007, 03:39:28 pm »

Hi Morten!

Thanks for the additional hints. Works perfectly now :).

Hans