Code::Blocks Forums
Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: puneet_m on October 25, 2007, 01:16:51 am
-
I want to add a separate compiler for each of the target in a given project. But currently, addition of multiple compilers is not supported. Can anyone highlight as to how to fix this?
Thanks,
-
This is possible. Just take a look at wxWidgets Target wizard, where you can add a new target to an existing project with a different compiler. At the moment it won't work as some compiler options are added at project level which spoils this wizard. :)
-
There are only few examples where it really makes sense to do that (for example if a project contains sources in different languages, which are to be linked into one program). However, whether it makes sense or not, it is certainly supported.
-
Where is the code for wxWidget target wizard??
-
Where is the code for wxWidget target wizard??
<C::B-dir>\share\CodeBlocks\templates\wizard\wxwidgets\wizard.script
-
Can we add multiple compilers to the same target?
Thanks,
-
Can we add multiple compilers to the same target?
Exactly what do you want to do?
-
I want to add multiple compilers to same target, check the example below:
<Target title="Debug">
<Option output="bin\Debug\fd.exe" prefix_auto="1" extension_auto="1" />
<Option object_output="obj\Debug\" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
<Option compiler="bcc" />
<Compiler>
<Add option="-b" />
</Compiler>
</Target>
-
I want to add multiple compilers to same target, check the example below:
AFAIK, it isn't allowed.
-
This is not possible (and will not be), as it does not make sense. The build system needs to have unambiguous information about what compiler to use.
-
Hi,
I want to add multiple compilers to same target, check the example below:
Not multiple compiler for the same target, but you may add multiple target using different compiler for each. (Maybe you already know this but..)
--
Regards,
Hakki Dogusan
-
Not multiple compiler for the same target, but you may add multiple target using different compiler for each. (Maybe you already know this but..)
Yes, this works, and this makes perfect sense.
-
Would it be possible to use multiple compilers in the same target for different file extensions or individual files. I am working on a mixture of C and D and need multiple compilers to accomplish this. The option seems to be available on the Files advanced tab but it never seems to 'stick'.
-
No, although it accidentially works nevertheless if you use gcc (since gcc is not a compiler, but really a front-end to half a dozen compilers). One target, one compiler, it doesn't work differently.
What you can do is, use the C compiler in one target to compile, but not link. Then add the object files to the next target which uses the D compiler (or the other way around). Or, make a static library, which only requires you to link one file afterwards (instead of a dozen object files).
-
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.
-
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.
-
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.
-
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
-
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.