From 4fd3eb82cf0a2514d40c58120367531dba514051 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 6 Feb 2014 08:04:59 +0000 Subject: [PATCH] Add option for buildign release mode binaries that include debug info/symbols. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@75816 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- build.py | 9 +++++++-- wscript | 13 +++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/build.py b/build.py index d31e1bd4..70e0f622 100755 --- a/build.py +++ b/build.py @@ -387,6 +387,7 @@ def makeOptionParser(): ("cairo", (False, "Allow Cairo use with wxGraphicsContext (Windows only)")), ("x64", (False, "Use and build for the 64bit version of Python on Windows")), ("jom", (False, "Use jom instead of nmake for the wxMSW build")), + ("relwithdebug", (False, "Turn on the generation of debug info for release builds on MSW.")), ] parser = optparse.OptionParser("build options:") @@ -1099,6 +1100,8 @@ def copyWxDlls(options): dlls = list() if not options.debug or options.both: dlls += glob.glob(os.path.join(msw.dllDir, "wx*%su_*.dll" % ver)) + if options.relwithdebug: + dlls += glob.glob(os.path.join(msw.dllDir, "wx*%su_*.pdb" % ver)) if options.debug or options.both: dlls += glob.glob(os.path.join(msw.dllDir, "wx*%sud_*.dll" % ver)) dlls += glob.glob(os.path.join(msw.dllDir, "wx*%sud_*.pdb" % ver)) @@ -1187,9 +1190,11 @@ def cmd_build_py(options, args): build_options.append('--verbose') if options.jobs: build_options.append('--jobs=%s' % options.jobs) - + if options.relwithdebug: + build_options.append('--msvc_relwithdebug') + build_options.append('--python="%s"' % PYTHON) - build_options.append('--out=%s' % wafBuildDir) + build_options.append('--out=%s' % wafBuildDir) # this needs to be the last option if not isWindows and not isDarwin and not options.no_magic and not options.use_syswx: # Using $ORIGIN in the rpath will cause the dynamic linker to look diff --git a/wscript b/wscript index c5352c2a..28d09026 100644 --- a/wscript +++ b/wscript @@ -57,6 +57,8 @@ def options(opt): # already. We should just switch to those instead of adding our own # option names... + opt.add_option('--msvc_relwithdebug', dest='msvc_relwithdebug', action='store_true', default=False, + help='Turn on debug info for release builds for MSVC builds.') @@ -131,8 +133,7 @@ def configure(conf): _copyEnvGroup(conf.env, '_WX', '_WXRICHTEXT') conf.env.LIB_WXRICHTEXT += cfg.makeLibName('richtext') - # ** Add code for new modules here - + # ** Add code for new modules here (and below for non-MSW) # tweak the PYEXT compile and link flags if making a --debug build if conf.env.debug: @@ -148,6 +149,14 @@ def configure(conf): conf.env['LINKFLAGS_PYEXT'].append('/DEBUG') conf.env['LIB_PYEXT'][0] += '_d' + # And similar tweaks for non-debug builds with the relwithdebug flag + # turned on. + elif conf.options.msvc_relwithdebug: + for listname in ['CFLAGS_PYEXT', 'CXXFLAGS_PYEXT']: + lst = conf.env[listname] + lst[1:1] = ['/Z7'] + conf.env['LINKFLAGS_PYEXT'].append('/DEBUG') + else: # Configuration stuff for non-Windows ports using wx-config conf.env.CFLAGS_WX = list()