@@ -2,6 +2,16 @@ diff --git a/swift/utils/build-script-impl b/swift/utils/build-script-impl
2
2
index 16e05052609..7ab8cebfab8 100755
3
3
--- a/swift/utils/build-script-impl
4
4
+++ b/swift/utils/build-script-impl
5
+ @@ -828,6 +828,9 @@ function set_build_options_for_host() {
6
+ # and it must be the same for both LLVM and Swift
7
+
8
+ if [[ "${SWIFT_HOST_TRIPLE}" ]] ; then
9
+ + SWIFT_TARGET_CMAKE_OPTIONS+=(
10
+ + -DCMAKE_Swift_COMPILER_TARGET:STRING="${SWIFT_HOST_TRIPLE}"
11
+ + )
12
+ llvm_cmake_options+=(
13
+ -DLLVM_HOST_TRIPLE:STRING="${SWIFT_HOST_TRIPLE}"
14
+ )
5
15
@@ -2622,6 +2622,7 @@ for host in "${ALL_HOSTS[@]}"; do
6
16
echo "Cleaning the libdispatch build directory"
7
17
call rm -rf "${LIBDISPATCH_BUILD_DIR}"
@@ -24,15 +34,16 @@ index 324d1a77eea..e88601a8701 100644
24
34
25
35
from . import cmake_product
26
36
from . import product
27
- @@ -115,6 +117,22 @@ class SwiftTestingCMakeShim(cmake_product.CMakeProduct):
37
+ @@ -115,6 +117,24 @@ class SwiftTestingCMakeShim(cmake_product.CMakeProduct):
28
38
# FIXME: If we build macros for the builder, specify the path.
29
39
self.cmake_options.define('SwiftTesting_MACRO', 'NO')
30
40
31
41
+ if host_target.startswith('android') and self.is_cross_compile_target(host_target):
32
42
+ host_config = HostSpecificConfiguration(host_target, self.args)
33
43
+ self.cmake_options.extend(host_config.cmake_options)
34
- + flags = '-target %s-unknown-linux-android%s ' % (self.args.android_arch,
35
- + self.args.android_api_level)
44
+ + triple = '%s-unknown-linux-android%s' % (self.args.android_arch,
45
+ + self.args.android_api_level)
46
+ + flags = '-target %s ' % (triple)
36
47
+
37
48
+ flags += '-resource-dir %s/lib/swift ' % (
38
49
+ self.host_install_destdir(host_target) + self.args.install_prefix)
@@ -41,6 +52,7 @@ index 324d1a77eea..e88601a8701 100644
41
52
+ flags += '-sdk %s/sysroot ' % (ndk_path)
42
53
+ flags += '-tools-directory %s/bin' % (ndk_path)
43
54
+ self.cmake_options.define('CMAKE_Swift_FLAGS', flags)
55
+ + self.cmake_options.define('CMAKE_Swift_COMPILER_TARGET', triple)
44
56
+ self.cmake_options.define('CMAKE_CXX_COMPILER_WORKS', 'True')
45
57
+ self.cmake_options.define('CMAKE_FIND_ROOT_PATH', self.args.cross_compile_deps_path)
46
58
+
@@ -100,21 +112,6 @@ index 758dd1df..02970992 100644
100
112
guard var spawnAttrs else {
101
113
throw NSError(domain: NSPOSIXErrorDomain, code: Int(errno),
102
114
userInfo: [NSURLErrorKey:self.executableURL!])
103
- diff --git a/swift-foundation/cmake/modules/SwiftFoundationSwiftSupport.cmake b/swift-foundation/cmake/modules/SwiftFoundationSwiftSupport.cmake
104
- index cbdfc2a..bb4121d 100644
105
- --- a/swift-foundation/cmake/modules/SwiftFoundationSwiftSupport.cmake
106
- +++ b/swift-foundation/cmake/modules/SwiftFoundationSwiftSupport.cmake
107
- @@ -37,6 +37,10 @@ function(_swift_foundation_install_target module)
108
- set(module_triple_command "${CMAKE_Swift_COMPILER}" -print-target-info)
109
- if(CMAKE_Swift_COMPILER_TARGET)
110
- list(APPEND module_triple_command -target ${CMAKE_Swift_COMPILER_TARGET})
111
- + else()
112
- + set(arg_list ${CMAKE_Swift_FLAGS})
113
- + separate_arguments(arg_list)
114
- + list(APPEND module_triple_command ${arg_list})
115
- endif()
116
- execute_process(COMMAND ${module_triple_command} OUTPUT_VARIABLE target_info_json)
117
- string(JSON module_triple GET "${target_info_json}" "target" "moduleTriple")
118
115
diff --git a/swift-testing/CMakeLists.txt b/swift-testing/CMakeLists.txt
119
116
index 1be9a4b..bd7b1bd 100644
120
117
--- a/swift-testing/CMakeLists.txt
@@ -143,18 +140,3 @@ index e40cb1b..ff2f920 100644
143
140
endif()
144
141
target_link_libraries(Testing PUBLIC
145
142
Foundation)
146
- diff --git a/swift-testing/cmake/modules/TargetTriple.cmake b/swift-testing/cmake/modules/TargetTriple.cmake
147
- index e087cc4..02f3a95 100644
148
- --- a/swift-testing/cmake/modules/TargetTriple.cmake
149
- +++ b/swift-testing/cmake/modules/TargetTriple.cmake
150
- @@ -10,6 +10,10 @@
151
- set(SWT_TARGET_INFO_COMMAND "${CMAKE_Swift_COMPILER}" -print-target-info)
152
- if(CMAKE_Swift_COMPILER_TARGET)
153
- list(APPEND SWT_TARGET_INFO_COMMAND -target ${CMAKE_Swift_COMPILER_TARGET})
154
- + else()
155
- + set(arg_list ${CMAKE_Swift_FLAGS})
156
- + separate_arguments(arg_list)
157
- + list(APPEND SWT_TARGET_INFO_COMMAND ${arg_list})
158
- endif()
159
- execute_process(COMMAND ${SWT_TARGET_INFO_COMMAND} OUTPUT_VARIABLE SWT_TARGET_INFO_JSON)
160
- string(JSON SWT_TARGET_TRIPLE GET "${SWT_TARGET_INFO_JSON}" "target" "unversionedTriple")
0 commit comments