Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: PerryWerneck on July 10, 2014, 01:51:16 am

Title: Setting codeblocks to auto-detect MinGW32 & MinGW64 cross compilers.
Post by: PerryWerneck on July 10, 2014, 01:51:16 am
Hi,

I was wondering how complex is to setup the linux versio of codeblocks to auto-detect MinGW32 and MinGW64 cross-compilers and create the right settings.

I looked for some info at the compilers/compiler_*.xml files but seens like it detects the compiler based on the instalation path am I right? The problem is: On OpenSUSE packets the mingw compilers are installed in the normal system path with modified names (see below) and they'r not automatically detected. One can always configure the compilers manually but, I think, it would be better if everithing goes "automagically"

Is the compiler_*.xml files the right & better way? Am I doing something wrong? Glad if someone points me to the right direction.

The MinGW paths on OpenSUSE (and, problably, other distros):

32 bits:

/usr/bin/i686-w64-mingw32-gcc
/usr/bin/i686-w64-mingw32-gcc-4.8.3
/usr/bin/i686-w64-mingw32-gcc-ar

64 bits:

/usr/bin/i686-w64-mingw32-gcc
/usr/bin/i686-w64-mingw32-gcc-4.8.3
/usr/bin/i686-w64-mingw32-gcc-ar

Title: Re: Setting codeblocks to auto-detect MinGW32 & MinGW64 cross compilers.
Post by: Alpha on July 10, 2014, 02:53:44 am
For simple detection routines, this can be done via the xml configs.  To start with, you could copy compiler_clang.xml and options_gcc.xml to (for example) compiler_NewId.xml and options_NewId.xml (Edit: Or even easier, create a options_* file with the extends attribute on gcc.).  Edit the relevant descriptions and id in the compiler_*, and the <Program name=* value="NewExecutable"/> in the options_* .

This should give you a working starting point (though, much refinement will probably be needed).  See documentation: compiler_*.xml (http://wiki.codeblocks.org/index.php?title=Compiler_file) and options_*.xml (http://wiki.codeblocks.org/index.php?title=Compiler_options_file).

(For more complicated autodetection, and other accessories, explore implementations in compilerMINGW.cpp and related files.)
Title: Re: Setting codeblocks to auto-detect MinGW32 & MinGW64 cross compilers.
Post by: PerryWerneck on July 11, 2014, 02:23:02 am
Hi,

Thanks! That was I need. It's detecting the cross compiler with a few adjustments in the xml files. Will work with the options to see if it's working.
Title: Re: Setting codeblocks to auto-detect MinGW32 & MinGW64 cross compilers.
Post by: MortenMacFly on July 11, 2014, 08:14:00 am
Thanks! That was I need. It's detecting the cross compiler with a few adjustments in the xml files. Will work with the options to see if it's working.
Contributions of new compilers to (public) C::B are welcome, btw... ;-)
Title: Re: Setting codeblocks to auto-detect MinGW32 & MinGW64 cross compilers.
Post by: PerryWerneck on July 16, 2014, 02:15:54 am
Hi,

Great! I'll submit the xml file as soon as I have time to test it better. Just had to delay the tests 'cause of a big project who starts this days but I'll back to it as soon as it finishes.


By the way I'm keeping the source in my personal codeblocks package, comments will be appreciated.  ;D

https://build.opensuse.org/package/show/home:PerryWerneck/codeblocks