Skip to content

Conversation

@jack-pappas
Copy link
Collaborator

When compiling a CMake release build, CMake doesn't invoke the compiler / linker with flags needed to preserve debugging information. There is a RelWithDebInfo target which does set these flags, but it sets the optimization a bit lower than Release to favor better debugging over performance optimizations. This change forces the flags to be enabled in all builds (even Release), while keeping all release optimizations enabled. (Note: this can mean the debugging information isn't completely accurate or has some missing information due to compiler optimizations; but it will be enough to decode the stack frames with gdb or windbg to see the function names.)

This change also enables link-time code generation (LTCG) / interprocedural optimization (IPO) when supported by the compiler.

set_target_properties(riptide_cpp PROPERTIES PDB_NAME ${_PYTHON_EXTENSION_PDB_NAME})
endif()

################################################################################
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not add these into the appropriate compiler sections on lines 3+?
The correct compiler detection is already done up there, and the debug flags can simply be added to the right section.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, these compile flags were lifted from the main flags in the toplevel CMakeLists.txt.
The dups should be removed and they should be converted over into target-based flags/etc...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants