From 0fe066925a324f9cc12d2ccd0af6dd984ffba634 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 16 May 2015 20:38:05 +0300 Subject: [PATCH] Oprion for disable debug symbols or(and) strip debug symbols in release mode. --HG-- branch : develop --- src/app/app.pro | 51 +++++++++++-------- src/libs/qmuparser/qmuparser.pro | 32 ++++++++---- .../vpropertyexplorer/vpropertyexplorer.pro | 26 ++++++---- src/test/ParserTest/ParserTest.pro | 32 ++++++++---- 4 files changed, 92 insertions(+), 49 deletions(-) diff --git a/src/app/app.pro b/src/app/app.pro index 3e66587da..6f18ab6bd 100644 --- a/src/app/app.pro +++ b/src/app/app.pro @@ -129,12 +129,16 @@ CONFIG(debug, debug|release){ QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll } - # Turn on debug symbols in release mode on Unix systems. - # On Mac OS X temporarily disabled. Need find way how to strip binary file. - !macx:!win32-msvc*{ - QMAKE_CXXFLAGS_RELEASE += -g -gdwarf-3 - QMAKE_CFLAGS_RELEASE += -g -gdwarf-3 - QMAKE_LFLAGS_RELEASE = + noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols + # do nothing + } else { + # Turn on debug symbols in release mode on Unix systems. + # On Mac OS X temporarily disabled. Need find way how to strip binary file. + !macx:!win32-msvc*{ + QMAKE_CXXFLAGS_RELEASE += -g -gdwarf-3 + QMAKE_CFLAGS_RELEASE += -g -gdwarf-3 + QMAKE_LFLAGS_RELEASE = + } } macx{ @@ -595,25 +599,32 @@ DEPENDPATH += $$PWD/../libs/vgeometry win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vgeometry/$${DESTDIR}/vgeometry.lib else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vgeometry/$${DESTDIR}/libvgeometry.a -# Strip after you link all libaries. -CONFIG(release, debug|release){ - win32:!win32-msvc*{ - # Strip debug symbols. - QMAKE_POST_LINK += objcopy --only-keep-debug bin/${TARGET} bin/${TARGET}.dbg && - QMAKE_POST_LINK += objcopy --strip-debug bin/${TARGET} && - QMAKE_POST_LINK += objcopy --add-gnu-debuglink="bin/${TARGET}.dbg" bin/${TARGET} - } +noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols + # do nothing +} else { + noStripDebugSymbols { # For enable run qmake with CONFIG+=noStripDebugSymbols + # do nothing + } else { + # Strip after you link all libaries. + CONFIG(release, debug|release){ + win32:!win32-msvc*{ + # Strip debug symbols. + QMAKE_POST_LINK += objcopy --only-keep-debug bin/${TARGET} bin/${TARGET}.dbg && + QMAKE_POST_LINK += objcopy --strip-debug bin/${TARGET} && + QMAKE_POST_LINK += objcopy --add-gnu-debuglink="bin/${TARGET}.dbg" bin/${TARGET} + } - unix:!macx{ - # Strip debug symbols. - QMAKE_POST_LINK += objcopy --only-keep-debug ${TARGET} ${TARGET}.dbg && - QMAKE_POST_LINK += objcopy --strip-debug ${TARGET} && - QMAKE_POST_LINK += objcopy --add-gnu-debuglink="${TARGET}.dbg" ${TARGET} + unix:!macx{ + # Strip debug symbols. + QMAKE_POST_LINK += objcopy --only-keep-debug ${TARGET} ${TARGET}.dbg && + QMAKE_POST_LINK += objcopy --strip-debug ${TARGET} && + QMAKE_POST_LINK += objcopy --add-gnu-debuglink="${TARGET}.dbg" ${TARGET} + } + } } } - macx{ # run macdeployqt to include all qt libraries in packet QMAKE_POST_LINK += $$[QT_INSTALL_BINS]/macdeployqt $${OUT_PWD}/$${DESTDIR}/$${TARGET}.app diff --git a/src/libs/qmuparser/qmuparser.pro b/src/libs/qmuparser/qmuparser.pro index 483319775..62994578c 100644 --- a/src/libs/qmuparser/qmuparser.pro +++ b/src/libs/qmuparser/qmuparser.pro @@ -104,16 +104,28 @@ CONFIG(debug, debug|release){ QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll } - !macx:!win32-msvc*{ - # Turn on debug symbols in release mode on Unix systems. - # On Mac OS X temporarily disabled. TODO: find way how to strip binary file. - QMAKE_CXXFLAGS_RELEASE += -g -gdwarf-3 - QMAKE_CFLAGS_RELEASE += -g -gdwarf-3 - QMAKE_LFLAGS_RELEASE = + noStripDebugSymbols { + # do nothing + } else { + !macx:!win32-msvc*{ + noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols + # do nothing + } else { + # Turn on debug symbols in release mode on Unix systems. + # On Mac OS X temporarily disabled. TODO: find way how to strip binary file. + QMAKE_CXXFLAGS_RELEASE += -g -gdwarf-3 + QMAKE_CFLAGS_RELEASE += -g -gdwarf-3 + QMAKE_LFLAGS_RELEASE = - # Strip debug symbols. - QMAKE_POST_LINK += objcopy --only-keep-debug bin/${TARGET} bin/${TARGET}.dbg && - QMAKE_POST_LINK += objcopy --strip-debug bin/${TARGET} && - QMAKE_POST_LINK += objcopy --add-gnu-debuglink="bin/${TARGET}.dbg" bin/${TARGET} + noStripDebugSymbols { # For enable run qmake with CONFIG+=noStripDebugSymbols + # do nothing + } else { + # Strip debug symbols. + QMAKE_POST_LINK += objcopy --only-keep-debug bin/${TARGET} bin/${TARGET}.dbg && + QMAKE_POST_LINK += objcopy --strip-debug bin/${TARGET} && + QMAKE_POST_LINK += objcopy --add-gnu-debuglink="bin/${TARGET}.dbg" bin/${TARGET} + } + } + } } } diff --git a/src/libs/vpropertyexplorer/vpropertyexplorer.pro b/src/libs/vpropertyexplorer/vpropertyexplorer.pro index c74e5740a..b50ee6a29 100644 --- a/src/libs/vpropertyexplorer/vpropertyexplorer.pro +++ b/src/libs/vpropertyexplorer/vpropertyexplorer.pro @@ -114,15 +114,23 @@ CONFIG(debug, debug|release){ } !macx:!win32-msvc*{ - # Turn on debug symbols in release mode on Unix systems. - # On Mac OS X temporarily disabled. TODO: find way how to strip binary file. - QMAKE_CXXFLAGS_RELEASE += -g -gdwarf-3 - QMAKE_CFLAGS_RELEASE += -g -gdwarf-3 - QMAKE_LFLAGS_RELEASE = + noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols + # do nothing + } else { + # Turn on debug symbols in release mode on Unix systems. + # On Mac OS X temporarily disabled. TODO: find way how to strip binary file. + QMAKE_CXXFLAGS_RELEASE += -g -gdwarf-3 + QMAKE_CFLAGS_RELEASE += -g -gdwarf-3 + QMAKE_LFLAGS_RELEASE = - # Strip debug symbols. - QMAKE_POST_LINK += objcopy --only-keep-debug bin/${TARGET} bin/${TARGET}.dbg && - QMAKE_POST_LINK += objcopy --strip-debug bin/${TARGET} && - QMAKE_POST_LINK += objcopy --add-gnu-debuglink="bin/${TARGET}.dbg" bin/${TARGET} + noStripDebugSymbols { # For enable run qmake with CONFIG+=noStripDebugSymbols + # do nothing + } else { + # Strip debug symbols. + QMAKE_POST_LINK += objcopy --only-keep-debug bin/${TARGET} bin/${TARGET}.dbg && + QMAKE_POST_LINK += objcopy --strip-debug bin/${TARGET} && + QMAKE_POST_LINK += objcopy --add-gnu-debuglink="bin/${TARGET}.dbg" bin/${TARGET} + } + } } } diff --git a/src/test/ParserTest/ParserTest.pro b/src/test/ParserTest/ParserTest.pro index 2ca4cac45..54bf69fff 100644 --- a/src/test/ParserTest/ParserTest.pro +++ b/src/test/ParserTest/ParserTest.pro @@ -83,9 +83,13 @@ CONFIG(debug, debug|release){ # Release mode DEFINES += QT_NO_DEBUG_OUTPUT - # Turn on debug symbols in release mode on Unix systems. - # On Mac OS X temporarily disabled. Need find way how to strip binary file. - unix:!macx:QMAKE_CXXFLAGS_RELEASE += -g -gdwarf-3 + noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols + # do nothing + } else { + # Turn on debug symbols in release mode on Unix systems. + # On Mac OS X temporarily disabled. Need find way how to strip binary file. + unix:!macx:QMAKE_CXXFLAGS_RELEASE += -g -gdwarf-3 + } } win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../../libs/qmuparser/bin/ -lqmuparser2 @@ -95,12 +99,20 @@ else:unix: LIBS += -L$$OUT_PWD/../../libs/qmuparser/bin/ -lqmuparser INCLUDEPATH += $$PWD/../../libs/qmuparser DEPENDPATH += $$PWD/../../libs/qmuparser -# Strip after you link all libaries. -CONFIG(release, debug|release){ - unix:!macx{ - # Strip debug symbols. - QMAKE_POST_LINK += objcopy --only-keep-debug $(TARGET) $(TARGET).debug && - QMAKE_POST_LINK += strip --strip-debug --strip-unneeded $(TARGET) && - QMAKE_POST_LINK += objcopy --add-gnu-debuglink $(TARGET).debug $(TARGET) +noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols + # do nothing +} else { + noStripDebugSymbols { # For enable run qmake with CONFIG+=noStripDebugSymbols + # do nothing + } else { + # Strip after you link all libaries. + CONFIG(release, debug|release){ + unix:!macx{ + # Strip debug symbols. + QMAKE_POST_LINK += objcopy --only-keep-debug $(TARGET) $(TARGET).debug && + QMAKE_POST_LINK += strip --strip-debug --strip-unneeded $(TARGET) && + QMAKE_POST_LINK += objcopy --add-gnu-debuglink $(TARGET).debug $(TARGET) + } + } } }