From 7e85e7ced7079d620ae73f8664a68530992c6af1 Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Wed, 10 Feb 2016 13:05:26 +0100 Subject: Add initial clang-cl support to Qt This adds the functionality to build Qt with clang under Windows against the Microsoft Visual Studio 2015 runtime. In order to replicate this, a Clang 3.8 build with Visual Studio 2015 Update 1 is needed. Adds compiler detection to Qt to distinguish correctly the clang compiler and Windows with Visual Studio. Clang has some built-in numeric functions, there is no need to use the Microsoft versions, which also conflict here. Task-number: QTBUG-50804 Change-Id: Ia4b267a298310ac7d73edf473b12792991249d8a Reviewed-by: Oswald Buddenhagen Reviewed-by: Friedemann Kleint --- qmake/Makefile.win32 | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'qmake') diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 1e8c5129be..1d50f872d9 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -14,6 +14,10 @@ QMKSRC = $(SOURCE_PATH)\qmake CXX = icl LINKER = link CFLAGS_EXTRA = /Zc:forScope /Qstd=c++11 +!elseif "$(QMAKESPEC)" == "win32-clang-msvc2015" +CXX = clang-cl +LINKER = link +CFLAGS_EXTRA = -fms-compatibility-version=19.00.23506 -Wno-microsoft-enum-value !else CXX = cl LINKER = link @@ -21,13 +25,18 @@ LINKER = link CFLAGS_EXTRA = /Zc:wchar_t- ! elseif "$(QMAKESPEC)" == "win32-msvc2008" || "$(QMAKESPEC)" == "win32-msvc2010" || "$(QMAKESPEC)" == "win32-msvc2012" || "$(QMAKESPEC)" == "win32-msvc2013" CFLAGS_EXTRA = /MP /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS $(CFLAGS_CRT) -! elseif "$(QMAKESPEC)" == "win32-msvc2015" +! elseif "$(QMAKESPEC)" == "win32-msvc2015" || "$(QMAKESPEC)" == "win32-clang-msvc2015" CFLAGS_EXTRA = /MP /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS /Zc:strictStrings /w44456 /w44457 /w44458 /wd4577 $(CFLAGS_CRT) ! else ! error Unsupported compiler for this Makefile ! endif !endif # !win32-icc +!if "$(QMAKESPEC)" != "win32-clang-msvc2015" +CFLAGS_PCH = -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch +PCH_OBJECT = qmake_pch.obj +!endif + CFLAGS_BARE = -c -Fo./ -Fdqmake.pdb \ -W3 -nologo -O1 \ $(CFLAGS_EXTRA) \ @@ -41,7 +50,7 @@ CFLAGS_BARE = -c -Fo./ -Fdqmake.pdb \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS \ -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ -DUNICODE -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_JSON_READONLY -DQT_NO_STANDARDPATHS -CFLAGS = -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch $(CFLAGS_BARE) $(CFLAGS) +CFLAGS = $(CFLAGS_PCH) $(CFLAGS_BARE) $(CFLAGS) CXXFLAGS_BARE = $(CFLAGS_BARE) CXXFLAGS = $(CFLAGS) @@ -129,7 +138,7 @@ QTOBJS= \ first all: qmake.exe qmake.exe: $(OBJS) $(QTOBJS) - $(LINKQMAKE) qmake_pch.obj + $(LINKQMAKE) $(PCH_OBJECT) -copy qmake.exe $(BUILD_PATH)\bin\qmake.exe clean:: @@ -158,9 +167,9 @@ distclean:: clean .cxx.obj: $(CXX) $(CXXFLAGS) $< -$(OBJS): qmake_pch.obj +$(OBJS): $(PCH_OBJECT) -$(QTOBJS): qmake_pch.obj +$(QTOBJS): $(PCH_OBJECT) qlibraryinfo.obj: $(BUILD_PATH)\src\corelib\global\qconfig.cpp -- cgit v1.2.3