Commit e6df6b4
Build fixes for Windows (#42138)
* cmake: Windows, adjust compiler identification on compiler swap
The latest CMake on Windows doesn't add `_CRT_USE_BUILTIN_OFFSETOF`
flag after we swap the compiler to clang-cl for targets like SourceKit. Also
`_add_host_variant_c_compile_flags` doesn't do so, because compiler
identification still points to MSVC compiler.
`_CRT_USE_BUILTIN_OFFSETOF` flag is necessary for `offsetof` calls to be
accepted as an integral constant expression.
This patch adjusts compiler identification on compiler swap and also
addresses some configuration issues related to clang-cl.
* [cmake] Add support for external clang/clang-cl
We need an option to pass external host clang location in case
we can't use just-built clang, e.g. when we are building for
different target architecture.
Also, this adds target options for clang-cl, enabling us to
build for arm64 on Windows@amd64.
* build: adjust the flags addition for the standard library
The standard library cannot be built with MSVC's compiler. However, if
it is built with the toolchain which uses MSVC, it would fail to add
this flag. With recent VS2022 toolsets, this is a problem as we would
fail to be able to use the `offsetof` macro. Unconditionally apply the
definition when building the standard library.
Co-authored-by: Alexander Smarus <bender@readdle.com>1 parent 4e118a1 commit e6df6b4
File tree
3 files changed
+51
-27
lines changed- cmake/modules
- stdlib/cmake/modules
3 files changed
+51
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
123 | 124 | | |
124 | 125 | | |
125 | 126 | | |
126 | | - | |
127 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
128 | 134 | | |
129 | 135 | | |
130 | 136 | | |
| |||
558 | 564 | | |
559 | 565 | | |
560 | 566 | | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
571 | 585 | | |
572 | 586 | | |
573 | 587 | | |
| |||
978 | 992 | | |
979 | 993 | | |
980 | 994 | | |
981 | | - | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
982 | 999 | | |
983 | | - | |
| 1000 | + | |
984 | 1001 | | |
985 | 1002 | | |
986 | 1003 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
| 86 | + | |
| 87 | + | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
| 91 | + | |
91 | 92 | | |
| 93 | + | |
92 | 94 | | |
93 | | - | |
94 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
95 | 101 | | |
96 | | - | |
97 | | - | |
| 102 | + | |
| 103 | + | |
98 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
99 | 108 | | |
100 | | - | |
| 109 | + | |
101 | 110 | | |
102 | 111 | | |
103 | 112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | | - | |
219 | | - | |
220 | | - | |
| 218 | + | |
221 | 219 | | |
222 | 220 | | |
223 | 221 | | |
| |||
0 commit comments