Skip to content

Commit f87f900

Browse files
authored
Merge pull request swiftlang#20720 from compnerd/windows-arch
build: specify architecture when building for Windows
2 parents 720153a + adfb508 commit f87f900

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1863,6 +1863,12 @@ function(add_swift_target_library name)
18631863
set(swiftlib_swift_compile_private_frameworks_flag "-Fsystem" "${SWIFT_SDK_${sdk}_ARCH_${arch}_PATH}/System/Library/PrivateFrameworks/")
18641864
endif()
18651865

1866+
if("${sdk}" STREQUAL WINDOWS)
1867+
if(arch STREQUAL x86_64)
1868+
set(swiftlib_swift_compile_flags_arch -Xcc -D_AMD64_)
1869+
endif()
1870+
endif()
1871+
18661872
# Add this library variant.
18671873
_add_swift_library_single(
18681874
${VARIANT_NAME}
@@ -1881,7 +1887,7 @@ function(add_swift_target_library name)
18811887
LLVM_COMPONENT_DEPENDS ${SWIFTLIB_LLVM_COMPONENT_DEPENDS}
18821888
FILE_DEPENDS ${SWIFTLIB_FILE_DEPENDS} ${swiftlib_module_dependency_targets}
18831889
C_COMPILE_FLAGS ${SWIFTLIB_C_COMPILE_FLAGS}
1884-
SWIFT_COMPILE_FLAGS ${swiftlib_swift_compile_flags_all} ${swiftlib_swift_compile_private_frameworks_flag}
1890+
SWIFT_COMPILE_FLAGS ${swiftlib_swift_compile_flags_all} ${swiftlib_swift_compile_flags_arch} ${swiftlib_swift_compile_private_frameworks_flag}
18851891
LINK_FLAGS ${swiftlib_link_flags_all}
18861892
PRIVATE_LINK_LIBRARIES ${swiftlib_private_link_libraries_targets}
18871893
INCORPORATE_OBJECT_LIBRARIES ${SWIFTLIB_INCORPORATE_OBJECT_LIBRARIES}

0 commit comments

Comments
 (0)