From 723802d21915b874c8c22efb6f77a774abfdf841 Mon Sep 17 00:00:00 2001
From: Andrea Shepard <andrea@special-circumstanc.es>
Date: Sat, 11 Jan 2020 17:46:06 +0000
Subject: [PATCH] Add --force-debug build option

---
 SConstruct | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/SConstruct b/SConstruct
index fd1a7e3e..7979b339 100644
--- a/SConstruct
+++ b/SConstruct
@@ -73,6 +73,12 @@ AddOption('--coverage',
           action='store_true',
           help='Build with coverage instrumentation')
 
+AddOption('--force-debug',
+          dest='force_debug',
+          default=False,
+          action='store_true',
+          help='Build with debug symbols, even in the opt variant')
+
 AddOption('--gprof',
           dest='gprof',
           default=False,
@@ -135,6 +141,12 @@ if GetOption('coverage'):
     else:
         env.ParseConfig('llvm-config --ldflags')
 
+if GetOption('force_debug'):
+    if env['CC'] == 'cl':
+        env.Append(CCFLAGS=['/Z7'])
+    else:
+        env.Append(CCFLAGS=['-g'])
+
 if GetOption('gprof'):
     if env['CC'] == 'gcc' and env['CXX'] == 'g++':
         env.Append(CCFLAGS=['-pg'],
-- 
GitLab