Author Topic: Adding Multiple Compilers  (Read 13453 times)

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Adding Multiple Compilers
« Reply #15 on: April 25, 2008, 05:46:51 pm »
Any particular reason for this lack of functionality? I am curious, the only reason I can find seems to be "it doesn't make sense" which multiple people have refuted.

To give you a reason, you may know that not all the compilers accept same command line switches while compiling. Just compare GCC and MSVC and you'll see the difference. They even behave differently. So for a simple project adding multiple compilers to a target may work. But for a complex project, it may not. Yes it's possible if we record full command line for that particular file; but this doesn't ensures that it'll work across all the pcs.
Be a part of the solution, not a part of the problem.

Offline huhlig

  • Single posting newcomer
  • *
  • Posts: 4
Re: Adding Multiple Compilers
« Reply #16 on: April 25, 2008, 06:03:17 pm »
Thats fair, would it be possible to assign different compilers(and associated options to different "Source" groups) As I mentioned in the other thread I am working with D, so I either use gcc/gdc or dmc/dmd. Both of which are supported out of box by code::blocks and are abi complaint. Would it be possible to simply assign a "compiler" to a source group, so all files of that extension set are compiled by that compiler? Settings would be per compiler not per file anyhow.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7594
    • My Best Post
Re: Adding Multiple Compilers
« Reply #17 on: April 26, 2008, 06:07:45 am »
Any particular reason for this lack of functionality? I am curious, the only reason I can find seems to be "it doesn't make sense" which multiple people have refuted.

The code to support the feature is not in the trunk where I can find it.
Note they were working on a new compiler framework that might make it possible to add. But, I don't know the status of it. It could have been merged into trunk, still being work on, or dropped.

Tim S
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Adding Multiple Compilers
« Reply #18 on: April 28, 2008, 09:57:28 am »
Defining a build target as one thing with one compiler keeps things simple, unambiguous, and manageable. Defining them differently can be asking for trouble.
A compiler in a build target in Code::Blocks is not just the compiler, but at least the combined functionality precompiler, compiler, linker, and debugger (if these are available). Alternatively, there are compilers available which are really assemblers or something completely different.
If we support two compilers, we might end up precompiling some files, compiling them, having to figure out how to link them together, and then ending up with something that maybe doesn't work properly with the debugger. This can still happen if you use different compilers in different build targets, but it will happen less often, and it is more explicit and thus easier to fix. Most people will build one library or one program per build target and will be just happy with that, it will never fail. In those cases where people do something else, it will be obvious what's up when it fails.
Besides, if we allowed 2 compilers, we would really have to allow n compilers (because if x are allowed, people will ask for x+1 anway). If we allow n compilers, we have to solve the linker problem for n(n-1) combinations by hand, unless someone comes up with an AI solution which just magically knows the compilers, linkers, and debuggers that are compatible with each other.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."