>From 2edae180d78b8568af28097d5111f9f9d50a5256 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 3 Mar 2020 12:42:28 +0100 Subject: [PATCH] win32: add "symbols" flag to configure.js Currently 2 build modes are supported out of the box: release (default) and "debug". This adds "symbols", which enables creating a PDB file that can be used to resolve stack traces, but does not disable optimization. /OPT:REF is used so the DLL doesn't become larger. --- win32/Makefile.mingw | 5 +++++ win32/Makefile.msvc | 5 ++++- win32/configure.js | 8 +++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/win32/Makefile.mingw b/win32/Makefile.mingw index 9dfa4abe..8f5528cc 100644 --- a/win32/Makefile.mingw +++ b/win32/Makefile.mingw @@ -99,9 +99,14 @@ ifeq ($(DEBUG),1) CFLAGS += -D_DEBUG -g LDFLAGS += else +ifeq ($(SYMBOLS),1) +CFLAGS += -DNDEBUG -O2 -g +LDFLAGS += +else CFLAGS += -DNDEBUG -O2 LDFLAGS += endif +endif # Libxml object files. diff --git a/win32/Makefile.msvc b/win32/Makefile.msvc index f6a0182d..04e48229 100644 --- a/win32/Makefile.msvc +++ b/win32/Makefile.msvc @@ -99,8 +99,11 @@ ARFLAGS = /nologo !if "$(DEBUG)" == "1" CFLAGS = $(CFLAGS) /D "_DEBUG" /Od /Z7 LDFLAGS = $(LDFLAGS) /DEBUG +!else if "$(SYMBOLS)" == "1" +CFLAGS = $(CFLAGS) /D "NDEBUG" /O2 +LDFLAGS = $(LDFLAGS) /DEBUG /OPT:REF !else -CFLAGS = $(CFLAGS) /D "NDEBUG" /O2 +CFLAGS = $(CFLAGS) /D "NDEBUG" /O2 # commented out as this break VC10 c.f. 634846 # LDFLAGS = $(LDFLAGS) /OPT:NOWIN98 LDFLAGS = $(LDFLAGS) diff --git a/win32/configure.js b/win32/configure.js index ed1e0618..c8bf9b4b 100644 --- a/win32/configure.js +++ b/win32/configure.js @@ -69,6 +69,7 @@ var cruntime = "/MD"; var dynruntime = true; var vcmanifest = false; var buildDebug = 0; +var buildSymbols = 0; var buildStatic = 0; var buildPrefix = "."; var buildBinPrefix = ""; @@ -154,6 +155,7 @@ function usage() txt += " dynruntime: Use the dynamic RTL (only bcb) (" + dynruntime + ")\n"; txt += " vcmanifest: Embed VC manifest (only msvc) (" + (vcmanifest? "yes" : "no") + ")\n"; txt += " debug: Build unoptimised debug executables (" + (buildDebug? "yes" : "no") + ")\n"; + txt += " symbols: Build optimised but with debug info (" + (buildSymbols ? "yes" : "no") + ")\n"; txt += " static: Link xmllint statically to libxml2 (" + (buildStatic? "yes" : "no") + ")\n"; txt += " Note: automatically enabled if cruntime is not /MD or /MDd\n"; txt += " prefix: Base directory for the installation (" + buildPrefix + ")\n"; @@ -260,6 +262,7 @@ function discoverVersion() vf.WriteLine("WITH_OUTPUT=" + (withOutput? "1" : "0")); vf.WriteLine("WITH_PYTHON=" + (withPython? "1" : "0")); vf.WriteLine("DEBUG=" + (buildDebug? "1" : "0")); + vf.WriteLine("SYMBOLS=" + (buildSymbols ? "1" : "0")); vf.WriteLine("STATIC=" + (buildStatic? "1" : "0")); vf.WriteLine("PREFIX=" + buildPrefix); vf.WriteLine("BINPREFIX=" + buildBinPrefix); @@ -540,6 +543,8 @@ for (i = 0; (i < WScript.Arguments.length) && (error == 0); i++) { vcmanifest = strToBool(arg.substring(opt.length + 1, arg.length)); else if (opt == "debug") buildDebug = strToBool(arg.substring(opt.length + 1, arg.length)); + else if (opt == "symbols") + buildSymbols = strToBool(arg.substring(opt.length + 1, arg.length)); else if (opt == "static") buildStatic = strToBool(arg.substring(opt.length + 1, arg.length)); else if (opt == "prefix") @@ -703,7 +708,8 @@ if (compiler == "msvc") { txtOut += " Embed Manifest: " + boolToStr(vcmanifest) + "\n"; } else if (compiler == "bcb") txtOut += " Use dynamic RTL: " + dynruntime + "\n"; -txtOut += " Debug symbols: " + boolToStr(buildDebug) + "\n"; +txtOut += " Debug: " + boolToStr(buildDebug) + "\n"; +txtOut += " Symbols: " + boolToStr(buildSymbols) + "\n"; txtOut += " Static xmllint: " + boolToStr(buildStatic) + "\n"; txtOut += " Install prefix: " + buildPrefix + "\n"; txtOut += " Put tools in: " + buildBinPrefix + "\n"; -- 2.17.0