afwbkbc / glsmac

Unofficial open-source OpenGL/SDL2 reimplementation of Sid Meier's Alpha Centauri ( + Alien Crossfire )
GNU Affero General Public License v3.0
400 stars 12 forks source link

added Release With Debug option #11

Closed Yitzi2 closed 1 year ago

Yitzi2 commented 1 year ago

When developing, sometimes a Debug branch will be slower than is ideal for testing, but it is also desirable to be able to breakpoint and step through the running code. For this purpose, many systems have a Release with Debug Info, which uses Release-like levels of optimization but also compiles with the necessary information to be able to run it through a debugger in the IDE. (The result is somewhat more obtuse than in full Debug mode, as some information is lost, but it can be worth it to many people.) This PR adds this as an option alongside Debug and Release.

afwbkbc commented 1 year ago

The better course of action here is not disabling DEBUG=1 completely, but finding what exactly slows things down and disable exactly that, making optional via parameter (that's what I did with MemoryDebug). And if it's -O0 itself slowing things down then there is no way to make it work, because debugging in anything other than -O0 is inconsistent, is a waste of time and confusing for new users (basically, things that 'slow down' are those that are needed for debugging, such as unoptimized code).

l29ah commented 1 year ago

I think the RelWithDebInfo option should be default for user builds/distributions, as it would make users able to supply meaningful stacktraces when reporting bugs at the cost of slight binary size increase and no performance impact.