1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
From 20b3eb0fd8b5f82cf432f2c06e7c5d3f533df0a5 Mon Sep 17 00:00:00 2001
From: Cristian Adam <cristian.adam@qt.io>
Date: Thu, 03 Jun 2021 12:42:07 +0200
Subject: [PATCH] CMake: Add support for building with clang-cl
qmake had support for building with clang-cl as the win32-clang-msvc mkspec.
Task-number: QTBUG-89642
Task-number: QTBUG-88081
Change-Id: I0709c289f90fedb121620d1e67ef841602219816
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
---
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index bb8b146..792276e 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -285,7 +285,9 @@
list(APPEND QT_DEFAULT_PLATFORM_DEFINITIONS WIN64 _WIN64)
endif()
if(MSVC)
- if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
+ if (CLANG)
+ set(QT_DEFAULT_MKSPEC win32-clang-msvc)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
set(QT_DEFAULT_MKSPEC win32-arm64-msvc)
else()
set(QT_DEFAULT_MKSPEC win32-msvc)
diff --git a/cmake/QtFlagHandlingHelpers.cmake b/cmake/QtFlagHandlingHelpers.cmake
index 0c57d9e..0eeccce 100644
--- a/cmake/QtFlagHandlingHelpers.cmake
+++ b/cmake/QtFlagHandlingHelpers.cmake
@@ -235,7 +235,7 @@
function(qt_set_msvc_cplusplus_options target visibility)
# For MSVC we need to explicitly pass -Zc:__cplusplus to get correct __cplusplus.
# Check qt_config_compile_test for more info.
- if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND MSVC_VERSION GREATER_EQUAL 1913)
+ if(MSVC AND MSVC_VERSION GREATER_EQUAL 1913)
target_compile_options("${target}" ${visibility} "-Zc:__cplusplus" "-permissive-")
endif()
endfunction()
diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt
index 2c991f7..9f0c95e 100644
--- a/src/corelib/CMakeLists.txt
+++ b/src/corelib/CMakeLists.txt
@@ -263,4 +263,24 @@
# special case end
)
+if (MSVC AND CLANG)
+ foreach(subarch sse4_1 rdrnd rdseed)
+ if (TEST_subarch_${subarch})
+ qt_internal_add_simd_part(Core SIMD ${subarch}
+ SOURCES
+ global/qsimd.cpp
+ )
+ endif()
+ endforeach()
+
+ foreach(subarch sse4_1 aesni)
+ if (TEST_subarch_${subarch})
+ qt_internal_add_simd_part(Core SIMD ${subarch}
+ SOURCES
+ tools/qhash.cpp
+ )
+ endif()
+ endforeach()
+endif()
+
# special case begin
diff --git a/src/corelib/global/qt_pch.h b/src/corelib/global/qt_pch.h
index 5869751..6108b07 100644
--- a/src/corelib/global/qt_pch.h
+++ b/src/corelib/global/qt_pch.h
@@ -62,17 +62,22 @@
# define _POSIX_
# include <limits.h>
# undef _POSIX_
-#endif
-#include <qcoreapplication.h>
-#include <qcoreevent.h>
-#include <qiodevice.h>
-#include <qlist.h>
-#include <qvariant.h> /* All moc genereated code has this include */
-#include <qobject.h>
-#include <qregularexpression.h>
-#include <qscopedpointer.h>
-#include <qshareddata.h>
-#include <qstring.h>
-#include <qstringlist.h>
-#include <qtimer.h>
+# if defined(Q_CC_CLANG) && defined(Q_CC_MSVC)
+// See https://bugs.llvm.org/show_bug.cgi?id=41226
+# include <wchar.h>
+__declspec(selectany) auto *__wmemchr_symbol_loader_value = wmemchr(L"", L'0', 0);
+# endif
+# endif
+# include <qcoreapplication.h>
+# include <qcoreevent.h>
+# include <qiodevice.h>
+# include <qlist.h>
+# include <qvariant.h> /* All moc genereated code has this include */
+# include <qobject.h>
+# include <qregularexpression.h>
+# include <qscopedpointer.h>
+# include <qshareddata.h>
+# include <qstring.h>
+# include <qstringlist.h>
+# include <qtimer.h>
#endif
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index 5fe4d59..04f58dd 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -577,6 +577,15 @@
)
endif()
+ if (MSVC AND CLANG AND TEST_subarch_sse4_1)
+ qt_internal_add_simd_part(Gui SIMD sse4_1
+ SOURCES
+ painting/qdrawhelper.cpp
+ painting/qdrawhelper_sse2.cpp
+ painting/qdrawhelper_ssse3.cpp
+ )
+ endif()
+
qt_internal_add_simd_part(Gui SIMD ssse3
SOURCES
image/qimage_ssse3.cpp
|