Projucer defines _DEBUG and DEBUG in Release build


#1

I can not figure out, why this happens. When I save the project, magically DEBUG=1 and _DEBUG=1 is added to the preprocessor defines of both the Debug AND Release configurations of the Xcode MacOS project, although they are not defined in Projucer.


#2

I figured it out myself. There is a checkbox in the Release configuration for enabling Debugging. This probably causes the defines to be made. What I really wanted when I check this, was symbol files. The Release configuration should have DWARF+DSYM set, so that you have symbols for your release build, but they are external to the binary. The same is true for Windows, where I do want PDB file for the release build. These symbol files are needed to match addresses to symbols, when you got crash dumps from testers or users.

The way it is right now, each time I save the project in Projucer, I have to correct these settings.


#3

@wkundrus in Projucer, you can define “Custom Xcode flags” per configuration. Put DEBUG_INFORMATION_FORMAT=dwarf-with-dsym there, that should do what you want.


#4

Yes, that did it. Thanks !


#5

Unfortunately, Projucer ignores these flags when it defines the same flag with a different value. In this case, it i GCC_GENERATE_DEBUGGING_SYMBOLS, which it sets to NO for release builds. If I add that in custom flags with the value YES, Projucer still sets it NO.


#6

I put GCC_GENERATE_DEBUGGING_SYMBOLS = TRUE in the “Custom Xcode flags” field of the Release configuration of the HelloWorld project:

And that changed the setting in Xcode as expected:


#7

Try to add several custom flags separated by semicolon


#8

Flags should be separated by commas, not semicolons.

image


#9

Thanks !