Disable optimizations per file or classes


#1

Projucer doen’t supports to set optimizations per file.
My anticrack/licenser has many cpp/h files, and for security reasons, I do not want these files to be compiled with optimizations.
Before juce, I set this option from the IDE (vs/xcode) but now, every time
when I save the project with projucer I lost these options.

Ok, on visual studio “#pragma optimize( “”, off )” I think it will work. But with clang is not clear how to do that (Apple LLVM version 7.3.0 (clang-703.0.29)).

Any advice?


#2

As a longshot/workaround would it work compile this part of the code as a static lib, then include/link to that?


#3

mmmh, I would not risk, anyway I think that would be a mess in my case, for each product, a script generates the cpps files for the licenser.
pragma optimize does not works on clang? some talk about it works and others that it doent work.


#4

I agree with martin, I think a static lib is the only way to go here.


#5

I was thinking about this, and looking for alternatives, I have not found anything.

Thanks guys, I’ll do as static lib.


#6

An other question, in the final compiled product, the static lib exported symbols can be striped?


#7

Yes. A static lib is just an archive of .o files. So linking to a static lib or having the .cpp file in your project is really no different. If you strip your symbols at the very end of your build you will be fine.


#8

Great! thanks!