Author Topic: Project Wizard - Couple of questions  (Read 10309 times)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9489
Project Wizard - Couple of questions
« on: April 21, 2006, 01:39:45 pm »
Dear all,
I'm using the new project wizard intensivly (expect quite a few wizards once it has reached "final stage" ;-)). Anyway - questions remain that I'd like  to ask how this is possible:
1.) Some projects may require a specific compiler. So how can I set the compiler silently (something like SetCompilerID(id))?
2.) I'd like to present a page with further information upon a specfic selection made in the wizard. Is this possible? How?

3.) (not wizard related) I'd like to set nothing (an empty string) into the objects output directory. Thus the compiler would really create a command line like: compiler -c mycode.c -o myobject.obj instead of e.g. compiler -c mycode.c -o .\myobject.obj. Hence it I setup "empty", C::B adds the complete path itself which under certain circumstances will break the compilation. How do I achive a command line like: compiler -c mycode.c -o myobject.obj?

With regadrs, Morten.

Edit: Another one (4.):
How do I disable the creation of the -I- compiler flag? Because of this I cannot compile any Smartwin application. I don't understand when this is added to the compiler options. It is not within the project file and I cannot disable it in the compiler options...?!
« Last Edit: April 21, 2006, 04:56:50 pm by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Project Wizard - Couple of questions
« Reply #1 on: April 25, 2006, 04:47:31 pm »
Quote
1.) Some projects may require a specific compiler. So how can I set the compiler silently (something like SetCompilerID(id))?

project->SetCompilerID("gcc");

Quote
2.) I'd like to present a page with further information upon a specfic selection made in the wizard. Is this possible? How?

Are you asking how to create a custom page or how to inject a page dynamically?

Quote
How do I disable the creation of the -I- compiler flag?

project->SetModeForPCH(pchSourceDir);

Generally, until a doc is written, if you want to know what parts of the SDK are exposed to scripts have a look at src/sdk/as/*.cpp.
Be patient!
This bug will be fixed soon...

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9489
Re: Project Wizard - Couple of questions
« Reply #2 on: April 25, 2006, 07:33:51 pm »
project->SetCompilerID("gcc");
This works now and because of this I can skip the compiler page for e.g. the Matlab S-Function wizard. Anyway: If I would like to use the compiler page to setup the targets and path only, would it be possible to select a compiler in the combobox but greying it out? Thus a user could not change the compiler, but get's informed about the selection.

Are you asking how to create a custom page or how to inject a page dynamically?
I really ment a custom page (like the welcome dialog) where I could place some - or at least one - lable(s) with additional information. To make an example: For the Matlab S-Function in the end there should be a page that informs the user about the fact that depending on the Matlab version he may have to remove a library and rename another.

project->SetModeForPCH(pchSourceDir);
Seems to work, too. Thanks a lot.

Generally, until a doc is written, if you want to know what parts of the SDK are exposed to scripts have a look at src/sdk/as/*.cpp.
Reminds me to update the SDK documentation - which I will do in a while...

Another question is raised concerning the compiler selection: How do I verify a compiler with a specific ID is present? E.g. it the LCC patch is not applied there is no compiler with the ID "lcc". I searched the cpp files but "SetCompilerID" is a void function...?! I suggest changing it to bool to provide this feedback for this purpose?!

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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9489
Re: Project Wizard - Couple of questions
« Reply #3 on: April 25, 2006, 08:25:00 pm »
project->SetCompilerID("gcc");
This works now and because of this I can skip the compiler page for e.g. the Matlab S-Function wizard.
Oops- I was too fast with that because I can't. C::B fires an error then:
This wizard is missing some or all of the following mandatory wizard pages:
Project path selection
Compiler and targets selection
Execution aborted...

But what If I have a wizard (and indeed it is like that) where selecting a compiler makes no sense (because it will work with only one compiler) and selecting targets as well as changing the path's is not possible (as it is in the case of a Matlab-S-Function). This is because the LCC compiler expects all object files in the same folder where the sources are. So providing the opportunity to change this would break the compilation ability.
What should I do next?
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Project Wizard - Couple of questions
« Reply #4 on: April 25, 2006, 08:31:57 pm »
Quote
This works now and because of this I can skip the compiler page for e.g. the Matlab S-Function wizard. Anyway: If I would like to use the compiler page to setup the targets and path only, would it be possible to select a compiler in the combobox but greying it out? Thus a user could not change the compiler, but get's informed about the selection.

Not possible yet, but easy to implement :)

Quote
I really ment a custom page (like the welcome dialog) where I could place some - or at least one - lable(s) with additional information. To make an example: For the Matlab S-Function in the end there should be a page that informs the user about the fact that depending on the Matlab version he may have to remove a library and rename another.

Create a resource named wizard.xrc and create wxPanels in there, one for each extra wizard screen.
Then just add the panels using one or more Wizard.AddPage("PanelNameGoesHere"); in BeginWizard()...

Quote
Another question is raised concerning the compiler selection: How do I verify a compiler with a specific ID is present? E.g. it the LCC patch is not applied there is no compiler with the ID "lcc". I searched the cpp files but "SetCompilerID" is a void function...?! I suggest changing it to bool to provide this feedback for this purpose?!

I 'll come back for this one...
Be patient!
This bug will be fixed soon...

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9489
Re: Project Wizard - Couple of questions
« Reply #5 on: April 25, 2006, 08:40:07 pm »
Create a resource named wizard.xrc and create wxPanels in there, one for each extra wizard screen.
Sometimes I can't see the wood for the trees. Of course! So it's like with the path setup... Sorry, this question was kind of stupid... :oops:
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Project Wizard - Couple of questions
« Reply #6 on: April 26, 2006, 02:51:34 pm »
Check out revision 2385.
Be patient!
This bug will be fixed soon...

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9489
Re: Project Wizard - Couple of questions
« Reply #7 on: April 26, 2006, 07:23:34 pm »
Check out revision 2385.
Thanks Yiannis, the changes looking good! :D I've played around a little but trapped in an assertion failure where I need some help:
I added the following code in my Matlab-C-S-Function wizard in the SetupProject(...) method:
Code: [Select]
  if (!IsValidCompilerID("lcc"))
  {
    ShowError("The wizard has detected that your version of Code::Blocks does not "
              "support the LCC compiler which is required for this project. "
              "The wizard cannot continue. Please update Code::Blocks.");
    return false;
  }
Suddenly I cannot even run the wizard. If I do I get:

---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Assertion failed!
Program: E:\Devel\CodeBlocks_Devel\codeblocks.exe
File: sdk\as\source\as_compiler.cpp
Line: 6027
Expression: ctx->type.dataType.IsReference()
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts
(Press Retry to debug the application - JIT must be enabled)

A compiler with this ID exists. If I remove the lines the wizard works again. It may be of interest that I don't add the compiler page. BeginWizard is as following:
Code: [Select]
  Wizard.AddIntroPage(intro_msg);
  Wizard.AddProjectPathPage();
  Wizard.AddPage("MatlabPath");
  Wizard.AddPage("MatlabHint");
An ideas?!
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Project Wizard - Couple of questions
« Reply #8 on: April 26, 2006, 07:50:37 pm »
Check out revision 2385.
Thanks Yiannis, the changes looking good! :D I've played around a little but trapped in an assertion failure where I need some help:
I added the following code in my Matlab-C-S-Function wizard in the SetupProject(...) method:
Code: [Select]
  if (!IsValidCompilerID("lcc"))
  {
    ShowError("The wizard has detected that your version of Code::Blocks does not "
              "support the LCC compiler which is required for this project. "
              "The wizard cannot continue. Please update Code::Blocks.");
    return false;
  }

I can't test it right now 'cause I 'm on a 64bit environment where scripting does not work yet. But you shouldn't be using IsValidCompilerID() alone anyway. It should be CompilerFactory.IsValidCompilerID(). Can you test it and tell me if this works?
Be patient!
This bug will be fixed soon...

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9489
Re: Project Wizard - Couple of questions
« Reply #9 on: April 26, 2006, 08:04:33 pm »
CompilerFactory.IsValidCompilerID(). Can you test it and tell me if this works?
Yes, this works again. Anyway, now the wizard runs through but during creation of the project C::B crashes (in CompilerFactory::GetCompilerIndex(...)). I've attached the crash report and the wizard your your inspection.
Please note that there might be another issue which I'm not sure of:
I use in SetupProject of the wizard:
Code: [Select]
BuildTarget@ target = project.GetBuildTarget(Wizard.GetDebugName());
but I don't have a compiler page where targets are setup. I wonder how to manually create a target, or are the target(s) being created automatically?!
With best regards, Morten.
Edit: I read the AS stuff and found AddBuildTarget... :oops: I'm trying again...

[attachment deleted by admin]
« Last Edit: April 26, 2006, 08:10:18 pm by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9489
Re: Project Wizard - Couple of questions
« Reply #10 on: May 03, 2006, 08:46:55 pm »
I've worked again on the project wizard for Matlab. Besides the compilation using LCC I figured out a way how even GCC can be used! So I changed the wizard accordingly. Thus one can select the compiler and depending on that C::B is configured properly. So far so good, but I keep getting crashes as described in my post from the other day. I can avoid these crashes if I add a simple ShowError("Hello"); as last entry in bool SetupProject(Project@ project) before return true. Then the message appears and the project is setup properly. Anyway: If I run the wizard a second time the message does not appear but C::B crashes again with the same error. I've attached the rpt file for this case.
I've also attached the wizard for inspection. Please consider that it is still alpha, so it does not yet work completely (but will one day) and LCC requires the LCC patch from BerliOS. Anyway: The GCC part should work without the patch so far... (but doesn't create a compilable project yet).
Any hint?

Edit: I forgot: Version 1.0 revision 2397 ()   gcc 3.4.5 Windows/unicode.

[attachment deleted by admin]
« Last Edit: May 03, 2006, 08:49:25 pm by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Project Wizard - Couple of questions
« Reply #11 on: May 03, 2006, 08:51:56 pm »
Quote
Anyway: If I run the wizard a second time the message does not appear but C::B crashes again with the same error. I've attached the rpt file for this case.

It has already been said that you will experience this behaviour, if your wx version is lower than 2.6.1 (or was that 2.6.2? - can't recall now).
Be patient!
This bug will be fixed soon...

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9489
Re: Project Wizard - Couple of questions
« Reply #12 on: May 03, 2006, 09:05:02 pm »
It has already been said that you will experience this behaviour, if your wx version is lower than 2.6.1 (or was that 2.6.2? - can't recall now).
I know, but I use wxWidgets 2.6.2 (I forgot to add that to the post).
Anyway: Are you sure that this is related? Because if I remove the messagbox I experience the crash in the first place.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Project Wizard - Couple of questions
« Reply #13 on: May 03, 2006, 10:17:37 pm »
Quote
Anyway: Are you sure that this is related? Because if I remove the messagbox I experience the crash in the first place.

I 'll check this tomorrow, when I 'm at a 32bit system.
Be patient!
This bug will be fixed soon...

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Project Wizard - Couple of questions
« Reply #14 on: May 09, 2006, 09:55:05 am »
Morten,

I found some time to test this and I have no problems with it. No crashes whatsoever.
I don't have Matlab so I could only test the wizard, not its outcome, but this shouldn't matter...
I also don't have the LCC patch.
Be patient!
This bug will be fixed soon...