summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-04-11 14:43:19 +0200
committerMichael Stahl <mstahl@redhat.com>2013-04-15 15:26:32 +0200
commit3b65852f37f1c8daf8c5c0af1d810c68cc71d8e3 (patch)
treee724da7f17cffec4a5e68897c8e34857dd8bf354 /solenv
parent54ba172dc13ababef911550a88083452832b4744 (diff)
gbuild: add support for building against MSVC debug runtime
Mainly this means using /MDd instead of /MD and /MTd instead of /MT in the CFLAGS, and also re-mapping of .lib files to ones with "d". Change-Id: Ifc56b53a66d5eb522c1695a34d68b08cad1d8338
Diffstat (limited to 'solenv')
-rw-r--r--solenv/gbuild/gbuild.mk7
-rwxr-xr-xsolenv/gbuild/platform/com_MSC_class.mk6
-rw-r--r--solenv/gbuild/platform/com_MSC_defs.mk4
-rw-r--r--solenv/gcc-wrappers/wrapper.cxx6
4 files changed, 15 insertions, 8 deletions
diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk
index 87a5c6570fb5..def5ff81db9a 100644
--- a/solenv/gbuild/gbuild.mk
+++ b/solenv/gbuild/gbuild.mk
@@ -224,11 +224,10 @@ gb_GLOBALDEFS += \
-DLIBO_INTERNAL_ONLY \
ifeq ($(gb_ENABLE_DBGUTIL),$(true))
-gb_GLOBALDEFS += -DDBG_UTIL \
-
-ifneq ($(COM),MSC)
-gb_GLOBALDEFS += -D_DEBUG \
+gb_GLOBALDEFS += -DDBG_UTIL
+ifneq ($(COM)-$(MSVC_USE_DEBUG_RUNTIME),MSC-)
+gb_GLOBALDEFS += -D_DEBUG
endif
endif
diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk
index 861626bd7e2f..8b5421fe54e4 100755
--- a/solenv/gbuild/platform/com_MSC_class.mk
+++ b/solenv/gbuild/platform/com_MSC_class.mk
@@ -218,8 +218,12 @@ $(call gb_Helper_abbreviate_dirs,\
; exit $$RC)
endef
+define gb_MSVCRT_subst
+$(if $(MSVC_USE_DEBUG_RUNTIME),$(subst msvcrt,msvcrtd,$(subst msvcprt,msvcprtd,$(subst libcmt,libcmtd,$(subst libcpmt,libcpmtd,$(subst msvcmrt,msvcmrtd,$(1)))))),$(1))
+endef
+
define gb_LinkTarget_use_system_win32_libs
-$(call gb_LinkTarget_add_libs,$(1),$(foreach lib,$(2),$(lib).lib))
+$(call gb_LinkTarget_add_libs,$(1),$(foreach lib,$(2),$(call gb_MSVCRT_subst,$(lib)).lib))
endef
# Flags common for PE executables (EXEs and DLLs)
diff --git a/solenv/gbuild/platform/com_MSC_defs.mk b/solenv/gbuild/platform/com_MSC_defs.mk
index 18e1f0a375bf..439afa51feaf 100644
--- a/solenv/gbuild/platform/com_MSC_defs.mk
+++ b/solenv/gbuild/platform/com_MSC_defs.mk
@@ -148,7 +148,7 @@ gb_CFLAGS := \
-GR \
-Gs \
-GS \
- -MD \
+ $(if $(MSVC_USE_DEBUG_RUNTIME),-MDd,-MD) \
-nologo \
-W4 \
-wd4127 \
@@ -181,7 +181,7 @@ gb_CXXFLAGS := \
-Gs \
-GS \
-Gy \
- -MD \
+ $(if $(MSVC_USE_DEBUG_RUNTIME),-MDd,-MD) \
-nologo \
-W4 \
-wd4127 \
diff --git a/solenv/gcc-wrappers/wrapper.cxx b/solenv/gcc-wrappers/wrapper.cxx
index a768eefaa362..151979ca7991 100644
--- a/solenv/gcc-wrappers/wrapper.cxx
+++ b/solenv/gcc-wrappers/wrapper.cxx
@@ -72,7 +72,11 @@ string processccargs(vector<string> rawargs) {
string args=" -nologo";
// TODO: should these options be enabled globally?
args.append(" -EHsc");
- args.append(" -MD");
+ const char *const pDebugRuntime(getenv("MSVC_USE_DEBUG_RUNTIME"));
+ if (pDebugRuntime && !strcmp(pDebugRuntime, "TRUE"))
+ args.append(" -MDd");
+ else
+ args.append(" -MD");
args.append(" -Gy");
args.append(" -Zc:wchar_t-");
args.append(" -Ob1 -Oxs -Oy-");