File tree Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -434,9 +434,8 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" AND BOOTSTRAPPING_MODE STREQUAL "HO
434434endif ()
435435
436436if (BRIDGING_MODE STREQUAL "DEFAULT" OR NOT BRIDGING_MODE)
437- if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR " ${SWIFT_HOST_VARIANT_SDK} " STREQUAL "WINDOWS" OR (CMAKE_Swift_COMPILER AND CMAKE_Swift_COMPILER_VERSION VERSION_LESS 5.8))
437+ if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR (CMAKE_Swift_COMPILER AND CMAKE_Swift_COMPILER_VERSION VERSION_LESS 5.8))
438438 # In debug builds, to workaround a problem with LLDB's `po` command (rdar://115770255).
439- # On Windows, to workaround a build problem.
440439 # If the host Swift version is less than 5.8, use pure mode to workaround a C++ interop compiler crash.
441440 set (BRIDGING_MODE "PURE" )
442441 else ()
Original file line number Diff line number Diff line change @@ -177,6 +177,8 @@ function(add_swift_compiler_modules_library name)
177177 if (CMAKE_SYSTEM_NAME STREQUAL "Windows" )
178178 list (APPEND swift_compile_options "-static" )
179179 list (APPEND sdk_option "-sdk" "${SWIFT_PATH_TO_SWIFT_SDK} " )
180+ # For "swift/shims/*.h".
181+ list (APPEND sdk_option "-I" "${SWIFT_PATH_TO_SWIFT_SDK} /usr/lib" )
180182
181183 # Workaround a crash in the LoadableByAddress pass
182184 # https://github.com/apple/swift/issues/73254
@@ -188,6 +190,12 @@ function(add_swift_compiler_modules_library name)
188190 if (CMAKE_Swift_COMPILER_VERSION VERSION_LESS 6.0)
189191 list (APPEND swift_compile_options "-Xcc" "-D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH" )
190192 endif ()
193+
194+ # Make 'offsetof()' a const value.
195+ list (APPEND swift_compile_options "-Xcc" "-D_CRT_USE_BUILTIN_OFFSETOF" )
196+
197+ # Workaround for https://github.com/swiftlang/llvm-project/issues/7172
198+ list (APPEND swift_compile_options "-Xcc" "-Xclang" "-Xcc" "-fmodule-format=raw" )
191199 else ()
192200 list (APPEND sdk_option "-I" "${swift_exec_bin_dir} /../lib" "-I" "${sdk_path} /usr/lib" )
193201 endif ()
Original file line number Diff line number Diff line change @@ -93,13 +93,19 @@ set(compile_options
9393
9494 # Necessary to avoid treating IBOutlet and IBAction as keywords
9595 "SHELL:-Xcc -UIBOutlet -Xcc -UIBAction -Xcc -UIBInspectable"
96-
97- "SHELL:-Xcc -D_CRT_USE_BUILTIN_OFFSETOF"
9896)
9997
98+ if (CMAKE_SYSTEM_NAME STREQUAL "Windows" )
99+ list (APPEND compile_options
100+ # Make 'offsetof()' a const value.
101+ "SHELL:-Xcc -D_CRT_USE_BUILTIN_OFFSETOF"
102+ # Workaround for https://github.com/swiftlang/llvm-project/issues/7172
103+ "SHELL:-Xcc -Xclang -Xcc -fmodule-format=raw" )
104+ endif ()
105+
100106# Prior to 5.9, we have to use the experimental flag for C++ interop.
101107if (CMAKE_Swift_COMPILER_VERSION VERSION_LESS 5.9)
102- list (APPEND compile_options "-Xfrontend" " -enable-experimental-cxx-interop" )
108+ list (APPEND compile_options "SHELL: -Xfrontend -enable-experimental-cxx-interop" )
103109else ()
104110 list (APPEND compile_options "-cxx-interoperability-mode=default" )
105111endif ()
You can’t perform that action at this time.
0 commit comments