Skip to content

Commit

Permalink
Added support for static release build. Cleaned up override system. C…
Browse files Browse the repository at this point in the history
…leaned up protection
  • Loading branch information
mrdeveloperdude committed Oct 12, 2018
1 parent cf7eabd commit ec67f30
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 59 deletions.
2 changes: 1 addition & 1 deletion OctoMY.pro
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ doc.depends= $${SRCS}/libs $${SRCS}/hub $${SRCS}/remote $${SRCS}/agent $${TESTS

include($$PRIS/status.pri)

OTHER_FILES+= $$files(pri/overrides/*, true)
OTHER_FILES+= $$files(pri/*, true)
OTHER_FILES+= $$files(integration/local/*, true)
OTHER_FILES+= $$files(integration/multidocker/*, true)
OTHER_FILES+= $$files(integration/deb/*, true)
Expand Down
37 changes: 0 additions & 37 deletions pri/asan.pri

This file was deleted.

1 change: 1 addition & 0 deletions pri/common.pri
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include( standard.pri )
include( optimization.pri )
include( warnings.pri )
include( linkage.pri )
include( protection.pri )
include( ccache.pri )

Expand Down
4 changes: 4 additions & 0 deletions pri/linkage.pri
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

contains(DEFINES, USE_STATIC_LINKAGE){
CONFIG += static
}
26 changes: 15 additions & 11 deletions pri/overrides/default.pri
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,26 @@
# PLEASE NOTE: THIS FILE WILL BE COPIED TO local_overrides.pri
# BY common.pri UPON RUNNING OF qmake IF local_overrides.pri IS MISSING

#DEFINES += USE_DOCS
#DEFINES += USE_TESTS_BASIC
#DEFINES += USE_TESTS_WEB
#DEFINES += USE_TESTS_STRESS
#DEFINES += USE_TESTS_SELECTED
#DEFINES += USE_GEAR_DYNAMICS
#DEFINES += USE_QT3D
#DEFINES += EXTERNAL_LIB_ESPEAK
#DEFINES += EXTERNAL_LIB_OPENCV
#DEFINES += EXTERNAL_LIB_OPENCL
#DEFINES += EXTERNAL_LIB_OPENCV
#DEFINES += USE_ARDUINO
#DEFINES += USE_STATUS
#DEFINES += USE_ZBAR
#DEFINES += USE_PARSER
#DEFINES += USE_CRASH_HELP
#DEFINES += USE_DOCS
#DEFINES += USE_GEAR
#DEFINES += USE_GEAR_DYNAMICS
#DEFINES += USE_PARSER
#DEFINES += USE_QT3D
#DEFINES += USE_SANITIZER_MEMORY
#DEFINES += USE_SANITIZER_THREADS
#DEFINES += USE_STATIC_LINKAGE
#DEFINES += USE_STATUS
#DEFINES += USE_TESTS_BASIC
#DEFINES += USE_TESTS_SELECTED
#DEFINES += USE_TESTS_STRESS
#DEFINES += USE_TESTS_WEB
#DEFINES += USE_ZBAR


# Reduce build output to only warnings/errors
CONFIG += silent
Expand Down
27 changes: 19 additions & 8 deletions pri/overrides/release.pri
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
#DEFINES += USE_DOCS
#DEFINES += USE_TESTS_BASIC
#DEFINES += USE_TESTS_WEB
#DEFINES += USE_TESTS_STRESS
#DEFINES += USE_TESTS_SELECTED
#DEFINES += USE_GEAR_DYNAMICS
#DEFINES += USE_QT3D
# RELEASE OVERRIDES FILE
# PLEASE NOTE: THIS FILE WILL BE USED WHEN BUILDING RELEASES


#DEFINES += EXTERNAL_LIB_ESPEAK
#DEFINES += EXTERNAL_LIB_OPENCV
#DEFINES += EXTERNAL_LIB_OPENCL
#DEFINES += EXTERNAL_LIB_OPENCV
#DEFINES += USE_ARDUINO
#DEFINES += USE_CRASH_HELP
#DEFINES += USE_DOCS
#DEFINES += USE_GEAR
#DEFINES += USE_GEAR_DYNAMICS
#DEFINES += USE_PARSER
#DEFINES += USE_QT3D
#DEFINES += USE_SANITIZER_MEMORY
#DEFINES += USE_SANITIZER_THREADS
DEFINES += USE_STATIC_LINKAGE
#DEFINES += USE_STATUS
#DEFINES += USE_TESTS_BASIC
#DEFINES += USE_TESTS_SELECTED
#DEFINES += USE_TESTS_STRESS
#DEFINES += USE_TESTS_WEB
#DEFINES += USE_ZBAR

# Reduce build output to only warnings/errors
CONFIG += silent
Expand Down
39 changes: 39 additions & 0 deletions pri/protection.pri
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,42 @@
# Build in all available bug protection
#QMAKE_CXXFLAGS += -fstack-protector-all -fstrict-overflow -fstack-usage
#QMAKE_CXXFLAGS +=-fsanitize=address

USE_PROTECTION{
# Enable AddressSanitizer, a fast memory error detector. Memory access instructions will be instrumented to detect out-of-bounds and use-after-free bugs. See http://code.google.com/p/address-sanitizer/ for more details. The run-time behavior can be influenced using the ASAN_OPTIONS environment variable; see https://code.google.com/p/address-sanitizer/wiki/Flags#Run-time_flags for a list of supported options.
#QMAKE_CXXFLAGS +=-fsanitize=kernel-address
# Enable AddressSanitizer for Linux kernel. See http://code.google.com/p/address-sanitizer/wiki/AddressSanitizerForKernel for more details.
QMAKE_CXXFLAGS +=-fsanitize=thread
# Enable ThreadSanitizer, a fast data race detector. Memory access instructions will be instrumented to detect data race bugs. See http://code.google.com/p/thread-sanitizer/ for more details. The run-time behavior can be influenced using the TSAN_OPTIONS environment variable; see https://code.google.com/p/thread-sanitizer/wiki/Flags for a list of supported options.
QMAKE_CXXFLAGS +=-fsanitize=leak
# Enable LeakSanitizer, a memory leak detector. This option only matters for linking of executables and if neither -fsanitize=address nor -fsanitize=thread is used. In that case it will link the executable against a library that overrides malloc and other allocator functions. See https://code.google.com/p/address-sanitizer/wiki/LeakSanitizer for more details. The run-time behavior can be influenced using the LSAN_OPTIONS environment variable.
QMAKE_CXXFLAGS +=-fsanitize=undefined
# Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector. Various computations will be instrumented to detect undefined behavior at runtime. Current suboptions are:
QMAKE_CXXFLAGS += -fsanitize=shift
# This option enables checking that the result of a shift operation is not undefined. Note that what exactly is considered undefined differs slightly between C and C++, as well as between ISO C90 and C99, etc.
QMAKE_CXXFLAGS += -fsanitize=integer-divide-by-zero
# Detect integer division by zero as well as INT_MIN / -1 division.
QMAKE_CXXFLAGS += -fsanitize=unreachable
# With this option, the compiler will turn the __builtin_unreachable call into a diagnostics message call instead. When reaching the __builtin_unreachable call, the behavior is undefined.
QMAKE_CXXFLAGS += -fsanitize=vla-bound
# This option instructs the compiler to check that the size of a variable length array is positive. This option does not have any effect in -std=c++14 mode, as the standard requires the exception be thrown instead.
QMAKE_CXXFLAGS += -fsanitize=null
# This option enables pointer checking. Particularly, the application built with this option turned on will issue an error message when it tries to dereference a NULL pointer, or if a reference (possibly an rvalue reference) is bound to a NULL pointer, or if a method is invoked on an object pointed by a NULL pointer.
QMAKE_CXXFLAGS += -fsanitize=return
# This option enables return statement checking. Programs built with this option turned on will issue an error message when the end of a non-void function is reached without actually returning a value. This option works in C++ only.
QMAKE_CXXFLAGS += -fsanitize=signed-integer-overflow
# This option enables signed integer overflow checking. We check that the result of +, *, and both unary and binary - does not overflow in the signed arithmetics. Note, integer promotion rules must be taken into account. That is, the following is not an overflow:
QMAKE_CXXFLAGS += -fsanitize=bounds
# This option enables instrumentation of array bounds. Various out of bounds accesses are detected. Flexible array members and initializers of variables with static storage are not instrumented.
QMAKE_CXXFLAGS += -fsanitize=alignment
# This option enables checking of alignment of pointers when they are dereferenced, or when a reference is bound to insufficiently aligned target, or when a method or constructor is invoked on insufficiently aligned object.
QMAKE_CXXFLAGS += -fsanitize=float-divide-by-zero
# Detect floating-point division by zero. Unlike other similar options, -fsanitize=float-divide-by-zero is not enabled by -fsanitize=undefined, since floating-point division by zero can be a legitimate way of obtaining infinities and NaNs.
QMAKE_CXXFLAGS += -fsanitize=float-cast-overflow
# This option enables floating-point type to integer conversion checking. We check that the result of the conversion does not overflow. This option does not work well with FE_INVALID exceptions enabled.
QMAKE_CXXFLAGS += -fsanitize=nonnull-attribute
# This option enables instrumentation of calls, checking whether null values are not passed to arguments marked as requiring a non-null value by the nonnull function attribute.
QMAKE_CXXFLAGS += -fsanitize=returns-nonnull-attribute
# This option enables instrumentation of return statements in functions marked with returns_nonnull function attribute, to detect returning of null values from such functions.

}
3 changes: 1 addition & 2 deletions pri/standard.pri
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ CONFIG += qt # xcb debug thread 3dnow mmx stl sse sse2 largefile
CONFIG += c++14


#
#CONFIG += static

# Support all kinds of architectures (universal builds etc)
CONFIG += x86 x86_64
#CONFIG += console
Expand Down

0 comments on commit ec67f30

Please sign in to comment.