@@ -10,6 +10,36 @@ index 16e05052609..7ab8cebfab8 100755
1010
1111 cmake_options=(
1212 -DENABLE_SWIFT=YES
13+ diff --git a/swift/utils/swift_build_support/swift_build_support/cmake.py b/swift/utils/swift_build_support/swift_build_support/cmake.py
14+ index bfb69965890..b5e9f5349c2 100644
15+ --- a/swift/utils/swift_build_support/swift_build_support/cmake.py
16+ +++ b/swift/utils/swift_build_support/swift_build_support/cmake.py
17+ @@ -153,10 +153,8 @@ class CMake(object):
18+ toolchain_path = product.native_toolchain_path(args.host_target)
19+ cmake_swiftc_path = os.getenv('CMAKE_Swift_COMPILER',
20+ os.path.join(toolchain_path, 'bin', 'swiftc'))
21+ - define("CMAKE_C_COMPILER:PATH", os.path.join(toolchain_path,
22+ - 'bin', 'clang'))
23+ - define("CMAKE_CXX_COMPILER:PATH", os.path.join(toolchain_path,
24+ - 'bin', 'clang++'))
25+ + define("CMAKE_C_COMPILER:PATH", toolchain.cc)
26+ + define("CMAKE_CXX_COMPILER:PATH", toolchain.cxx)
27+ define("CMAKE_Swift_COMPILER:PATH", cmake_swiftc_path)
28+ else:
29+ cmake_swiftc_path = os.getenv('CMAKE_Swift_COMPILER', toolchain.swiftc)
30+ diff --git a/swift/utils/swift_build_support/swift_build_support/products/product.py b/swift/utils/swift_build_support/swift_build_support/products/product.py
31+ index 274b6037305..bf0f7fcf671 100644
32+ --- a/swift/utils/swift_build_support/swift_build_support/products/product.py
33+ +++ b/swift/utils/swift_build_support/swift_build_support/products/product.py
34+ @@ -212,7 +212,7 @@ class Product(object):
35+ if self.args.cross_compile_hosts:
36+ if self.is_darwin_host(host_target):
37+ install_destdir = self.host_install_destdir(host_target)
38+ - else:
39+ + elif self.args.cross_compile_append_host_target_to_destdir:
40+ install_destdir = os.path.join(install_destdir, self.args.host_target)
41+ return targets.toolchain_path(install_destdir,
42+ self.args.install_prefix)
1343diff --git a/swift/utils/swift_build_support/swift_build_support/products/swift_testing.py b/swift/utils/swift_build_support/swift_build_support/products/swift_testing.py
1444index 324d1a77eea..e88601a8701 100644
1545--- a/swift/utils/swift_build_support/swift_build_support/products/swift_testing.py
@@ -59,6 +89,21 @@ index 7f290d16..95366592 100644
5989 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
6090 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
6191 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
92+ diff --git a/swift-corelibs-xctest/cmake/modules/PlatformInfo.cmake b/swift-corelibs-xctest/cmake/modules/PlatformInfo.cmake
93+ index 468dc61..a90ae3d 100644
94+ --- a/swift-corelibs-xctest/cmake/modules/PlatformInfo.cmake
95+ +++ b/swift-corelibs-xctest/cmake/modules/PlatformInfo.cmake
96+ @@ -2,6 +2,10 @@
97+ set(print_target_info_invocation "${CMAKE_Swift_COMPILER}" -print-target-info)
98+ if(CMAKE_Swift_COMPILER_TARGET)
99+ list(APPEND print_target_info_invocation -target ${CMAKE_Swift_COMPILER_TARGET})
100+ + else()
101+ + set(arg_list ${CMAKE_Swift_FLAGS})
102+ + separate_arguments(arg_list)
103+ + list(APPEND print_target_info_invocation ${arg_list})
104+ endif()
105+ execute_process(COMMAND ${print_target_info_invocation} OUTPUT_VARIABLE target_info_json)
106+ message(CONFIGURE_LOG "Swift Target Info: ${print_target_info_invocation}\n"
62107diff --git a/swift-foundation/cmake/modules/SwiftFoundationSwiftSupport.cmake b/swift-foundation/cmake/modules/SwiftFoundationSwiftSupport.cmake
63108index cbdfc2a..bb4121d 100644
64109--- a/swift-foundation/cmake/modules/SwiftFoundationSwiftSupport.cmake
@@ -86,6 +131,21 @@ index 1be9a4b..bd7b1bd 100644
86131 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
87132 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
88133 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
134+ diff --git a/swift-testing/cmake/modules/PlatformInfo.cmake b/swift-testing/cmake/modules/PlatformInfo.cmake
135+ index 94c60ef..ab8a491 100644
136+ --- a/swift-testing/cmake/modules/PlatformInfo.cmake
137+ +++ b/swift-testing/cmake/modules/PlatformInfo.cmake
138+ @@ -9,6 +9,10 @@
139+ set(print_target_info_invocation "${CMAKE_Swift_COMPILER}" -print-target-info)
140+ if(CMAKE_Swift_COMPILER_TARGET)
141+ list(APPEND print_target_info_invocation -target ${CMAKE_Swift_COMPILER_TARGET})
142+ + else()
143+ + set(arg_list ${CMAKE_Swift_FLAGS})
144+ + separate_arguments(arg_list)
145+ + list(APPEND print_target_info_invocation ${arg_list})
146+ endif()
147+ execute_process(COMMAND ${print_target_info_invocation} OUTPUT_VARIABLE target_info_json)
148+ message(CONFIGURE_LOG "Swift Target Info: ${print_target_info_invocation}\n"
89149diff --git a/swift-testing/cmake/modules/TargetTriple.cmake b/swift-testing/cmake/modules/TargetTriple.cmake
90150index e087cc4..02f3a95 100644
91151--- a/swift-testing/cmake/modules/TargetTriple.cmake
0 commit comments