Skip to content

Commit

Permalink
Fix sanitized build options
Browse files Browse the repository at this point in the history
  • Loading branch information
iakov committed Aug 23, 2018
1 parent 8546f77 commit e58aa40
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions global.pri
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ CONFIG(debug, debug | release) {

#CHECK_GCC_VERSION=$$system("$$QMAKE_CXX --version")
#!CONFIG(nosanitizers):!clang:gcc:*-g++*:system(test \"x$${CHECK_GCC_VERSION}\" = x || echo \"$$CHECK_GCC_VERSION\" | grep -qe \'\\<4\\.[0-9]\\+\\.\')
!clang:gcc:*-g++*:system($$QMAKE_CXX --version | grep -qEe '"\\<5\\.[0-9]+\\."' ){ CONFIG += gcc5 }
!clang:gcc:*-g++*:system($$QMAKE_CXX --version | grep -qEe '"\\<[5-9]\\.[0-9]+\\."' ){ CONFIG += gcc5 }
!clang:gcc:*-g++*:system($$QMAKE_CXX --version | grep -qEe '"\\<4\\.[0-9]+\\."' ){ CONFIG += gcc4 }

CONFIG += link_pkgconfig
Expand All @@ -90,7 +90,7 @@ isEmpty(TARGET) {
equals(TEMPLATE, app) {
unix:!macx {
QMAKE_LFLAGS += -Wl,-rpath-link,$$DESTDIR
!CONFIG(no_rpath) QMAKE_LFLAGS += -Wl,-O1,-rpath,.
!CONFIG(no_rpath) QMAKE_LFLAGS += -Wl,-O1,-rpath=.
}
macx:!CONFIG(no_rpath) {
QMAKE_LFLAGS += -rpath . -rpath @executable_path/../Lib -rpath @executable_path/../Frameworks -rpath @executable_path/../../../
Expand All @@ -102,12 +102,18 @@ macx-clang {
QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/
}

CONFIG(no-sanitizers):CONFIG+=nosanitizers

!CONFIG(nosanitizers):!clang:gcc:*-g++*:gcc4{
warning("Disabled sanitizers, failed to detect compiler version or too old compiler: $$QMAKE_CXX")
CONFIG += nosanitizers
}

unix:!CONFIG(nosanitizers):!CONFIG(no-sanitizers) {
!CONFIG(nosanitizers) {
CONFIG += sanitizer
}

unix:!CONFIG(nosanitizers) {

# seems like we want USan always, but are afraid of ....
!CONFIG(sanitize_address):!CONFIG(sanitize_thread):!CONFIG(sanitize_memory):!CONFIG(sanitize_kernel_address) {
Expand All @@ -118,7 +124,7 @@ unix:!CONFIG(nosanitizers):!CONFIG(no-sanitizers) {

#LSan can be used without performance degrade even in release build
#But at the moment we can not, because of Qt problems
CONFIG(debug, debug | release):!CONFIG(sanitize_address):!macx-clang { CONFIG += sanitize_leak }
CONFIG(debug, debug | release):!CONFIG(sanitize_address):!CONFIG(sanitize_thread):!macx-clang { CONFIG += sanitize_leak }

CONFIG(sanitize_leak) {
QMAKE_CFLAGS += -fsanitize=leak
Expand Down Expand Up @@ -154,6 +160,10 @@ unix:!CONFIG(nosanitizers):!CONFIG(no-sanitizers) {

}


#Workaround for a known gcc/ld (before 7.3/bionic) issue
CONFIG(sanitizer):!clang: QMAKE_LFLAGS += -fuse-ld=gold

OBJECTS_DIR = .build/$$CONFIGURATION/obj
MOC_DIR = .build/$$CONFIGURATION/moc
RCC_DIR = .build/$$CONFIGURATION/rcc
Expand Down

0 comments on commit e58aa40

Please sign in to comment.