Page 1 of 1

Per file compiler flags

Posted: Thu May 21, 2015 6:57 pm
by teknogrebo
Hi there,

I am porting a project from osx to linux and unfortunately it requires one of our compilation units to be unoptimised when doing an otherwise optimised build. It was possible in XCode to set some compilation options on a per file basis, but I can't find a way of doing this in codelite, short of manually editing the make file that get's generated. Am I missing something in the IDE, or is it just not supported? If not, then are there plans to support it in the future?

Thanks,

Tom

Re: Per file compiler flags

Posted: Thu May 21, 2015 8:44 pm
by eranif
This is not supported. TBH, the requirement for this never arise
Feel free to either submit a feature request or even better a PR (Pull Request)

Eran

Re: Per file compiler flags

Posted: Fri May 22, 2015 6:36 am
by Gibbon1
I've had to this on occasion for debugging complicated switch statements. The -Os turns the code into something that is unpossible to comprehend. -O0 turns the code into something that won't fit in 64k of flash memory.

What I did was compile everything with -Os. Then change -Os to -O0 in the project settings, delete the particular object file and recompile. At least for now since the makefile isn't part of the dependency it'll just recompile and link the file you're debugging.

Probably doesn't help you if it's required for production.

Might be possible to do some magic, create a second project in the workspace with the alternative flags to just compile the offending file. At least that gives your the object file you need. Then maybe use a prepossessing script to copy it into the main project before compiling. Of course this is evil and ugly and might not work, but... no will work. There isn't any reason you can't compile the same file in two projects in codelite (most of my projects do that). The object files end up in different ./Debug ./Release directories. So you should be able to use a pre-post build command to copy the object file to the other projects ./Debug or ./Release directory. And then because it's current the file won't be compiled and the linker will happily link it into the executable.

I hope this make sense.

Re: Per file compiler flags

Posted: Fri May 22, 2015 12:22 pm
by teknogrebo
Thanks for the replies. I;ll try Gibbon's approach - as I can probably pull all the non optimised bits into a separate project fairly easily. I can probably find out with a bit more browsing, but how do I make a feature request? I may have a poke around in the codebase myself in the near future, but I can't do it in work hours :)

Re: Per file compiler flags

Posted: Fri May 22, 2015 2:26 pm
by eranif