Browse Source

Merge pull request #54364 from skimmedsquare/osx-coverage

Adds support for 'use_coverage' flag in OSX.
Rémi Verschelde 3 years ago
parent
commit
9307808987
1 changed files with 5 additions and 0 deletions
  1. 5 0
      platform/osx/detect.py

+ 5 - 0
platform/osx/detect.py

@@ -31,6 +31,7 @@ def get_opts():
         BoolVariable("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", False),
         BoolVariable("use_asan", "Use LLVM/GCC compiler address sanitizer (ASAN)", False),
         BoolVariable("use_tsan", "Use LLVM/GCC compiler thread sanitizer (TSAN)", False),
+        BoolVariable("use_coverage", "Use instrumentation codes in the binary (e.g. for code coverage)", False),
     ]
 
 
@@ -142,6 +143,10 @@ def configure(env):
             env.Append(CCFLAGS=["-fsanitize=thread"])
             env.Append(LINKFLAGS=["-fsanitize=thread"])
 
+    if env["use_coverage"]:
+        env.Append(CCFLAGS=["-ftest-coverage", "-fprofile-arcs"])
+        env.Append(LINKFLAGS=["-ftest-coverage", "-fprofile-arcs"])
+
     ## Dependencies
 
     if env["builtin_libtheora"]: