Browse Source

Don't generate debugging symbols in release builds

Marc Gilleron 5 years ago
parent
commit
c02747d909
1 changed files with 9 additions and 7 deletions
  1. 9 7
      SConstruct

+ 9 - 7
SConstruct

@@ -179,11 +179,11 @@ if env['platform'] == 'linux':
     if env['use_llvm']:
     if env['use_llvm']:
         env['CXX'] = 'clang++'
         env['CXX'] = 'clang++'
 
 
-    env.Append(CCFLAGS=['-fPIC', '-g', '-std=c++14', '-Wwrite-strings'])
+    env.Append(CCFLAGS=['-fPIC', '-std=c++14', '-Wwrite-strings'])
     env.Append(LINKFLAGS=["-Wl,-R,'$$ORIGIN'"])
     env.Append(LINKFLAGS=["-Wl,-R,'$$ORIGIN'"])
 
 
     if env['target'] == 'debug':
     if env['target'] == 'debug':
-        env.Append(CCFLAGS=['-Og'])
+        env.Append(CCFLAGS=['-Og', '-g'])
     elif env['target'] == 'release':
     elif env['target'] == 'release':
         env.Append(CCFLAGS=['-O3'])
         env.Append(CCFLAGS=['-O3'])
 
 
@@ -203,7 +203,7 @@ elif env['platform'] == 'osx':
             'Only 64-bit builds are supported for the macOS target.'
             'Only 64-bit builds are supported for the macOS target.'
         )
         )
 
 
-    env.Append(CCFLAGS=['-g', '-std=c++14', '-arch', 'x86_64'])
+    env.Append(CCFLAGS=['-std=c++14', '-arch', 'x86_64'])
     env.Append(LINKFLAGS=[
     env.Append(LINKFLAGS=[
         '-arch',
         '-arch',
         'x86_64',
         'x86_64',
@@ -213,7 +213,7 @@ elif env['platform'] == 'osx':
     ])
     ])
 
 
     if env['target'] == 'debug':
     if env['target'] == 'debug':
-        env.Append(CCFLAGS=['-Og'])
+        env.Append(CCFLAGS=['-Og', '-g'])
     elif env['target'] == 'release':
     elif env['target'] == 'release':
         env.Append(CCFLAGS=['-O3'])
         env.Append(CCFLAGS=['-O3'])
 
 
@@ -238,7 +238,7 @@ elif env['platform'] == 'ios':
     env['AR'] = compiler_path + 'ar'
     env['AR'] = compiler_path + 'ar'
     env['RANLIB'] = compiler_path + 'ranlib'
     env['RANLIB'] = compiler_path + 'ranlib'
 
 
-    env.Append(CCFLAGS=['-g', '-std=c++14', '-arch', env['ios_arch'], '-isysroot', sdk_path])
+    env.Append(CCFLAGS=['-std=c++14', '-arch', env['ios_arch'], '-isysroot', sdk_path])
     env.Append(LINKFLAGS=[
     env.Append(LINKFLAGS=[
         '-arch',
         '-arch',
         env['ios_arch'],
         env['ios_arch'],
@@ -250,7 +250,7 @@ elif env['platform'] == 'ios':
     ])
     ])
 
 
     if env['target'] == 'debug':
     if env['target'] == 'debug':
-        env.Append(CCFLAGS=['-Og'])
+        env.Append(CCFLAGS=['-Og', '-g'])
     elif env['target'] == 'release':
     elif env['target'] == 'release':
         env.Append(CCFLAGS=['-O3'])
         env.Append(CCFLAGS=['-O3'])
 
 
@@ -281,13 +281,15 @@ elif env['platform'] == 'windows':
 
 
     # Native or cross-compilation using MinGW
     # Native or cross-compilation using MinGW
     if host_platform == 'linux' or host_platform == 'osx' or env['use_mingw']:
     if host_platform == 'linux' or host_platform == 'osx' or env['use_mingw']:
-        env.Append(CCFLAGS=['-g', '-O3', '-std=c++14', '-Wwrite-strings'])
+        # These options are for a release build even using target=debug
+        env.Append(CCFLAGS=['-O3', '-std=c++14', '-Wwrite-strings'])
         env.Append(LINKFLAGS=[
         env.Append(LINKFLAGS=[
             '--static',
             '--static',
             '-Wl,--no-undefined',
             '-Wl,--no-undefined',
             '-static-libgcc',
             '-static-libgcc',
             '-static-libstdc++',
             '-static-libstdc++',
         ])
         ])
+
 elif env['platform'] == 'android':
 elif env['platform'] == 'android':
     if host_platform == 'windows':
     if host_platform == 'windows':
         env = env.Clone(tools=['mingw'])
         env = env.Clone(tools=['mingw'])