Author Topic: Compiler settings (not the dialog)  (Read 5224 times)

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Compiler settings (not the dialog)
« on: February 27, 2006, 10:00:23 am »
Back to our favorite issue: compiler settings (not the dialog) :).

You probably have seen this thread about the new wizard plugin WIP.
While developing a few wizards for it, it became apparent that the way compiler options are setup should change to be compiler-neutral. Let me explain:

CompilerConfigurationSwitches
GCCDebug-g -O0
MSVCTKDebug/Zi /D_DEBUG /DDEBUG
.........

As you see above, each compiler is using completely different command-line switches for the same options (obviously).
With the way compiler options are setup now, one cannot easily switch between compilers without causing problems. That's because compiler options are not automatically converted between compilers.

What we could do is define some common group of options, common to all compilers.
Then, in the compiler options dialog, instead of having a list of on/off options, we could have a list of pre-defined settings groups (like "Debugging" above). The advantage would be that the compiler plugin wouldn't store the options as a string but rather the group settings. Something like, "debugging enabled, optimization disabled, C++ exception handling enabled". Not "-g -O0 -fexceptions". The actual command-line compiler switches would be passed to the compiler when a command-line is constructed.
This would allow us to switch between compilers and the settings would still work because we wouldn't have stored anything compiler specific but rather abstract groups of settings.
It would also make the compiler settings dialog more clear for the new user...

I hope the above make some sense, because it's not long since I woke up and coffee hasn't yet effected on me ;)
Be patient!
This bug will be fixed soon...

Trikko

  • Guest
Re: Compiler settings (not the dialog)
« Reply #1 on: February 27, 2006, 10:15:15 am »
Yes it's what i would do by myself using global and "target" vars. Did you remember topic about "global var visibility"? (Did you fixed the "bug"?)

I've just thought about some common settings:

- Defines
- Include path!
- Debug info
- Precompiled Headers
- Optimization: space/speed
- Warning as error

Usually these settings exist, if not you can simply ignore them...
BTW common settings are overridden by compiler ones, aren't them? It could be useful to select if you want to override or append them...

A more funny features could be a modular config/target method using a tree structure, but i just know that you don't like to implement it...


Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Compiler settings (not the dialog)
« Reply #2 on: February 27, 2006, 10:20:34 am »
What we could do is define some common group of options, common to all compilers.
Then, in the compiler options dialog, instead of having a list of on/off options, we could have a list of pre-defined settings groups (like "Debugging" above). The advantage would be that the compiler plugin wouldn't store the options as a string but rather the group settings. Something like, "debugging enabled, optimization disabled, C++ exception handling enabled". Not "-g -O0 -fexceptions". The actual command-line compiler switches would be passed to the compiler when a command-line is constructed.
This would allow us to switch between compilers and the settings would still work because we wouldn't have stored anything compiler specific but rather abstract groups of settings.
It would also make the compiler settings dialog more clear for the new user...

I hope the above make some sense, because it's not long since I woke up and coffee hasn't yet effected on me ;)

Yes, it makes a lot of sense :D. IMHO it is a very good idea. Anyway, I have just a small question. What would happen if I would like to chose specific options for e.g., debugging and not all the options of the common group "debugging"?

Thank you very much.

Best wishes,
Michael

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Compiler settings (not the dialog)
« Reply #3 on: February 27, 2006, 10:49:45 am »
Quote
What would happen if I would like to chose specific options for e.g., debugging and not all the options of the common group "debugging"?

Among the other pre-defined groups, we 'll have one called "Custom settings". This will be stored as a raw string. You can put all your custom settings there (manually). Needless to say you will lose them when you switch compilers for your project...
Be patient!
This bug will be fixed soon...

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Compiler settings (not the dialog)
« Reply #4 on: February 27, 2006, 11:08:26 am »
Among the other pre-defined groups, we 'll have one called "Custom settings". This will be stored as a raw string. You can put all your custom settings there (manually).

Ok, I understand. Thanks for the answer :).

Needless to say you will lose them when you switch compilers for your project...

Yes, of course.

Best wishes,
Michael

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Compiler settings (not the dialog)
« Reply #5 on: February 27, 2006, 11:50:50 am »
I see that this is a difficult task. I would generally agree to the group of common switches - it sounds good. But I would like to point out that this might not always work. I still believe that e.g. a Java compiler could be attached to C::B. I really think C::B has the potential for it and that would rock! But the common set of options between a Java and a C++ compiler are not too many. Furthermore: Does Java has a linker, thus linker options?

So I would like to propose that besides common compiler (linker) settings there should be a "manual" option. I could imagine a simple dialog with two listboxes besides showing left the old compiler settings of the project and right the new (possible) settings - both sides including the description. So really the optionns as you see them in the compiler setup but only for two compilers in comparision. Then let the user decide what he toggles on the right (new compiler) side. What do you think?

Morten.

Edit: Please note that Java is an example here. This might also apply to C/C++/Whatever compilers we don't know yet.
« Last Edit: February 27, 2006, 11:52:29 am by MortenMacFly »
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

takeshimiya

  • Guest
Re: Compiler settings (not the dialog)
« Reply #6 on: February 27, 2006, 01:04:06 pm »
Hi! Reporting in.

Yiannis, can you look at this? I've made it the other day, and was holding until later, but this seems the place for 'release early...'.

I tried to cover all the current settings for compilers, but for sure I forgot something. I have some ideas for the v2 of the file format (reorganizing the options, changing some things for more expansibility, ...), but this v1 is so the TinyXml-ization of the current compilers can be done more easily.

I also hope also that makes sense becase I've waken up suddendly 5 minutes ago. :mrgreen:

EDIT: Specific to the title, here's how some options can be for gcc:

Code: xml
            <Common name="optimize" value="off" option="!-O !-O1 !-O2 !-O3 !-Os !-fexpensive-optimizations" />
            <Common name="optimize" value="speed" option="-O2" />
            <Common name="optimize" value="size" option="-Os -s" />
            <Common name="debug-info" value="yes" option="-g !-Os !-pg !-lgmon" />
            <Common name="debug-info" value="no" option="!-g" />
            <Common name="warnings" value="no" option="-w !-W !-Wall !-pedantic !-Wmain !-Wfatal-errors" />
            <Common name="warnings" value="default" option="-W" />
            <Common name="warnings" value="max" option="-Wall -pedantic -Wmain" />
            <Common name="precomp-headers" value="on" option="" />
            <Common name="precomp-headers" value="off" option="" />
            <Common name="rtti" value="on" option="!-no-rtti" />
            <Common name="rtti" value="off" option="-no-rtti" />
            <Common name="exceptions" value="on" option="!-no-exceptions" />
            <Common name="exceptions" value="off" option="-no-exceptions" />
« Last Edit: February 27, 2006, 01:06:46 pm by Takeshi Miya »