>From bf82e18ffda883843268638b51af28bf951d610b Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 3 Mar 2020 12:48:39 +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 ad6ecdf2..a4c98ccb 100644 --- a/win32/Makefile.mingw +++ b/win32/Makefile.mingw @@ -66,9 +66,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 # Libxslt object files. XSLT_OBJS = $(XSLT_INTDIR)/attributes.o\ diff --git a/win32/Makefile.msvc b/win32/Makefile.msvc index 2e4742bb..7d09356b 100644 --- a/win32/Makefile.msvc +++ b/win32/Makefile.msvc @@ -69,8 +69,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 !endif # Libxslt object files. diff --git a/win32/configure.js b/win32/configure.js index 549b942e..62c93b3a 100644 --- a/win32/configure.js +++ b/win32/configure.js @@ -54,6 +54,7 @@ var compiler = "msvc"; var cruntime = "/MD"; var vcmanifest = false; var buildDebug = 0; +var buildSymbols = 0; var buildStatic = 0; var buildPrefix = "."; var buildBinPrefix = ""; @@ -113,6 +114,7 @@ function usage() txt += " cruntime: C-runtime compiler option (only msvc) (" + cruntime + ")\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 xsltproc statically to libxslt (" + (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"; @@ -196,6 +198,7 @@ function discoverVersion() vf.WriteLine("WITH_MODULES=" + (withModules? "1" : "0")); vf.WriteLine("WITH_PROFILER=" + (withProfiler? "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); @@ -340,6 +343,8 @@ for (i = 0; (i < WScript.Arguments.length) && (error == 0); i++) { withDebugger = 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 == "iconv") withIconv = strToBool(arg.substring(opt.length + 1, arg.length)); else if (opt == "zlib") @@ -490,7 +495,8 @@ txtOut += " Compiler: " + compiler + "\n"; if (compiler == "msvc") txtOut += " C-Runtime option: " + cruntime + "\n"; txtOut += " Embed Manifest: " + boolToStr(vcmanifest) + "\n"; -txtOut += " Debug symbols: " + boolToStr(buildDebug) + "\n"; +txtOut += " Debug: " + boolToStr(buildDebug) + "\n"; +txtOut += " Symbols: " + boolToStr(buildSymbols) + "\n"; txtOut += " Static xsltproc: " + boolToStr(buildStatic) + "\n"; txtOut += " Install prefix: " + buildPrefix + "\n"; txtOut += " Put tools in: " + buildBinPrefix + "\n"; -- 2.17.0