From c8d3f939b4a2944dfee4a9e284cb3a3305229d42 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Thu, 6 Aug 2015 15:08:39 +0200 Subject: [PATCH] WinRT: Link against correct c-runtime We need to move adding ucrt(d).lib out of the various qmake.conf as qmake.conf is only parsed once by qmake and does not differentiate between debug and release. Hence use default_pre.prf which is the earliest prf to use. This one also is being parsed multiple times and does what it is supposed to do. This allows API certification tests for Win10 to suceed, another sideeffect is that it is much cleaner at a single location now. Change-Id: Id899f4bbd063a3191c8f139857abf90efa827ffc Reviewed-by: Andrew Knight --- mkspecs/features/winrt/default_pre.prf | 12 ++++++++++++ mkspecs/winrt-arm-msvc2015/qmake.conf | 10 ---------- mkspecs/winrt-x64-msvc2015/qmake.conf | 10 ---------- mkspecs/winrt-x86-msvc2015/qmake.conf | 10 ---------- 4 files changed, 12 insertions(+), 30 deletions(-) create mode 100644 mkspecs/features/winrt/default_pre.prf diff --git a/mkspecs/features/winrt/default_pre.prf b/mkspecs/features/winrt/default_pre.prf new file mode 100644 index 00000000000..44e3c94b8a6 --- /dev/null +++ b/mkspecs/features/winrt/default_pre.prf @@ -0,0 +1,12 @@ +*msvc2015 { + # Note that the order is important, ucrt(d) has to be first + # Otherwise the linker might use malloc from a different library + # but free_dbg() from the runtime, causing assert when deleting + # items from different heaps + CONFIG(debug, debug|release): \ + QMAKE_LIBS = ucrtd.lib $$QMAKE_LIBS + else: \ + QMAKE_LIBS = ucrt.lib $$QMAKE_LIBS +} + +load(default_pre) diff --git a/mkspecs/winrt-arm-msvc2015/qmake.conf b/mkspecs/winrt-arm-msvc2015/qmake.conf index b86958a084b..44c91a5e808 100644 --- a/mkspecs/winrt-arm-msvc2015/qmake.conf +++ b/mkspecs/winrt-arm-msvc2015/qmake.conf @@ -14,16 +14,6 @@ QMAKE_LFLAGS += /MACHINE:ARM QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib kernel32.lib -# Note that the order is important, ucrt(d) has to be first -# Otherwise the linker might use malloc from a different library -# but free_dbg() from the runtime, causing assert when deleting -# items from different heaps -CONFIG(debug, debug|release) { - QMAKE_LIBS = ucrtd.lib $$QMAKE_LIBS -} else { - QMAKE_LIBS = ucrt.lib $$QMAKE_LIBS -} - VCPROJ_ARCH = ARM MSVC_VER = 14.0 WINSDK_VER = 10.0 diff --git a/mkspecs/winrt-x64-msvc2015/qmake.conf b/mkspecs/winrt-x64-msvc2015/qmake.conf index 0f3f16a8195..a6c5db6f0f5 100644 --- a/mkspecs/winrt-x64-msvc2015/qmake.conf +++ b/mkspecs/winrt-x64-msvc2015/qmake.conf @@ -14,16 +14,6 @@ QMAKE_LFLAGS += /MACHINE:X64 QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib kernel32.lib -# Note that the order is important, ucrt(d) has to be first -# Otherwise the linker might use malloc from a different library -# but free_dbg() from the runtime, causing assert when deleting -# items from different heaps -CONFIG(debug, debug|release) { - QMAKE_LIBS = ucrtd.lib $$QMAKE_LIBS -} else { - QMAKE_LIBS = ucrt.lib $$QMAKE_LIBS -} - VCPROJ_ARCH = x64 MSVC_VER = 14.0 WINSDK_VER = 10.0 diff --git a/mkspecs/winrt-x86-msvc2015/qmake.conf b/mkspecs/winrt-x86-msvc2015/qmake.conf index 51a4ec93668..dfeaf63e2c3 100644 --- a/mkspecs/winrt-x86-msvc2015/qmake.conf +++ b/mkspecs/winrt-x86-msvc2015/qmake.conf @@ -14,16 +14,6 @@ QMAKE_LFLAGS += /SAFESEH /MACHINE:X86 QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib kernel32.lib -# Note that the order is important, ucrt(d) has to be first -# Otherwise the linker might use malloc from a different library -# but free_dbg() from the runtime, causing assert when deleting -# items from different heaps -CONFIG(debug, debug|release) { - QMAKE_LIBS = ucrtd.lib $$QMAKE_LIBS -} else { - QMAKE_LIBS = ucrt.lib $$QMAKE_LIBS -} - VCPROJ_ARCH = Win32 MSVC_VER = 14.0 WINSDK_VER = 10.0