configure: Add switch for adding coverage info
Change-Id: If6f3d4f29233206ef911f48e63872d28bf7b8e71 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
parent
0330b967f2
commit
cc9645f11b
@ -135,6 +135,9 @@ Build options:
|
||||
for example, -sanitize address cannot be combined with
|
||||
-sanitize thread.
|
||||
|
||||
-coverage {trace-pc-guard}
|
||||
Add code coverage instrumentation (Clang only)
|
||||
|
||||
-c++std <edition> .... Select C++ standard <edition> [c++1z/c++14/c++11]
|
||||
(Not supported with MSVC)
|
||||
|
||||
|
@ -67,6 +67,7 @@
|
||||
"commercial": "void",
|
||||
"compile-examples": { "type": "boolean", "name": "compile_examples" },
|
||||
"confirm-license": "void",
|
||||
"coverage": "coverage",
|
||||
"dbus": { "type": "optionalString", "values": [ "no", "yes", "linked", "runtime" ] },
|
||||
"dbus-linked": { "type": "void", "name": "dbus", "value": "linked" },
|
||||
"dbus-runtime": { "type": "void", "name": "dbus", "value": "runtime" },
|
||||
@ -791,6 +792,16 @@
|
||||
"condition": "features.sanitize_address || features.sanitize_thread || features.sanitize_memory || features.sanitize_undefined",
|
||||
"output": [ "sanitizer", "publicConfig" ]
|
||||
},
|
||||
"coverage_trace_pc_guard": {
|
||||
"label": "trace-pc-guard",
|
||||
"autoDetect": false,
|
||||
"output": [ "publicConfig" ]
|
||||
},
|
||||
"coverage": {
|
||||
"label": "Code Coverage Instrumentation",
|
||||
"condition": "features.coverage_trace_pc_guard",
|
||||
"output": [ "publicConfig" ]
|
||||
},
|
||||
"GNUmake": {
|
||||
"label": "GNU make",
|
||||
"autoDetect": false,
|
||||
@ -1268,6 +1279,11 @@ Qt can be built in release mode with separate debug information, so
|
||||
"type": "error",
|
||||
"condition": "(features.rpath || features.rpath_dir) && var.QMAKE_LFLAGS_RPATH == ''",
|
||||
"message": "This platform does not support RPATH"
|
||||
},
|
||||
{
|
||||
"type": "error",
|
||||
"condition": "features.coverage && !config.clang",
|
||||
"message": "Command line option -coverage is only supported with clang compilers."
|
||||
}
|
||||
],
|
||||
|
||||
@ -1401,6 +1417,12 @@ Configure with '-qreal float' to create a build that is binary-compatible with 5
|
||||
"condition": "features.sanitizer",
|
||||
"entries": [ "sanitize_address", "sanitize_thread", "sanitize_memory", "sanitize_undefined" ]
|
||||
},
|
||||
{
|
||||
"message": "Code Coverage Instrumentation",
|
||||
"type": "firstAvailableFeature",
|
||||
"args": "coverage_trace_pc_guard",
|
||||
"condition": "features.coverage"
|
||||
},
|
||||
{
|
||||
"message": "Build parts",
|
||||
"type": "buildParts"
|
||||
|
@ -58,6 +58,21 @@ defineTest(qtConfCommandline_sanitize) {
|
||||
}
|
||||
}
|
||||
|
||||
defineTest(qtConfCommandline_coverage) {
|
||||
arg = $${1}
|
||||
val = $${2}
|
||||
isEmpty(val): val = $$qtConfGetNextCommandlineArg()
|
||||
!contains(val, "^-.*"):!isEmpty(val) {
|
||||
equals(val, "trace-pc-guard") {
|
||||
qtConfCommandlineSetInput("coverage_trace_pc_guard", "yes")
|
||||
} else {
|
||||
qtConfAddError("Invalid argument $$val to command line parameter $$arg")
|
||||
}
|
||||
} else {
|
||||
qtConfAddError("Missing argument to command line parameter $$arg")
|
||||
}
|
||||
}
|
||||
|
||||
# callbacks
|
||||
|
||||
defineReplace(qtConfFunc_crossCompile) {
|
||||
|
@ -44,3 +44,7 @@ QMAKE_LFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
|
||||
QMAKE_AR_LTCG = llvm-ar cqs
|
||||
QMAKE_NM_LTCG = llvm-nm -P
|
||||
QMAKE_RANLIB_LTCG = true # No need to run, since llvm-ar has "s"
|
||||
|
||||
QMAKE_CFLAGS_COVERAGE_TRACE_PC_GUARD = -fsanitize-coverage=trace-pc-guard
|
||||
QMAKE_CXXFLAGS_COVERAGE_TRACE_PC_GUARD = -fsanitize-coverage=trace-pc-guard
|
||||
QMAKE_LFLAGS_COVERAGE_TRACE_PC_GUARD = -fsanitize-coverage=trace-pc-guard
|
||||
|
7
mkspecs/features/coverage.prf
Normal file
7
mkspecs/features/coverage.prf
Normal file
@ -0,0 +1,7 @@
|
||||
# Coverage flags
|
||||
|
||||
coverage_trace_pc_guard {
|
||||
QMAKE_CFLAGS += $$QMAKE_CFLAGS_COVERAGE_TRACE_PC_GUARD
|
||||
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_COVERAGE_TRACE_PC_GUARD
|
||||
QMAKE_LFLAGS += $$QMAKE_LFLAGS_COVERAGE_TRACE_PC_GUARD
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user