@@ -160,33 +160,6 @@ macro(configure_sdk_darwin
160
160
_report_sdk ("${prefix} " )
161
161
endmacro ()
162
162
163
- macro (_configure_sdk_android_specific
164
- prefix name lib_subdir triple_name architectures triple sdkpath )
165
-
166
- foreach (arch ${architectures} )
167
- if ("${arch} " STREQUAL "armv7" )
168
- set (SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_TRIPLE "arm-linux-androideabi" )
169
- set (SWIFT_SDK_ANDROID_ARCH_${arch}_ALT_SPELLING "arm" )
170
- else ()
171
- message (FATAL_ERROR "unkonwn arch for android SDK: ${arch} " )
172
- endif ()
173
-
174
- # Get the prebuilt suffix to create the correct toolchain path when using the NDK
175
- if ("${CMAKE_HOST_SYSTEM_NAME} " STREQUAL "Darwin" )
176
- set (_swift_android_prebuilt_suffix "darwin-x86_64" )
177
- elseif ("${CMAKE_HOST_SYSTEM_NAME} " STREQUAL "Linux" )
178
- set (_swift_android_prebuilt_suffix "linux-x86_64" )
179
- endif ()
180
- set (SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_PREBUILT_PATH
181
- "${SWIFT_ANDROID_NDK_PATH} /toolchains/${SWIFT_SDK_ANDROID_ARCH_${arch} _NDK_TRIPLE}-${SWIFT_ANDROID_NDK_GCC_VERSION} /prebuilt/${_swift_android_prebuilt_suffix} " )
182
-
183
- # Resolve the correct linker based on the file name of CMAKE_LINKER (being 'ld' or 'ld.gold' the options)
184
- get_filename_component (SWIFT_ANDROID_LINKER_NAME "${CMAKE_LINKER} " NAME )
185
- set (SWIFT_SDK_ANDROID_ARCH_${arch}_LINKER
186
- "${SWIFT_SDK_ANDROID_ARCH_${arch} _NDK_PREBUILT_PATH}/bin/${SWIFT_SDK_ANDROID_ARCH_${arch} _NDK_TRIPLE}-${SWIFT_ANDROID_LINKER_NAME} " )
187
- endforeach ()
188
- endmacro ()
189
-
190
163
macro (configure_sdk_unix
191
164
prefix name lib_subdir triple_name architectures triple sdkpath )
192
165
# Note: this has to be implemented as a macro because it sets global
@@ -207,17 +180,43 @@ macro(configure_sdk_unix
207
180
endif ()
208
181
209
182
foreach (arch ${architectures} )
210
- set (SWIFT_SDK_${prefix}_ARCH_${arch}_PATH "${sdkpath} " )
211
- set (SWIFT_SDK_${prefix}_ARCH_${arch}_TRIPLE "${triple} " )
183
+ if ("${prefix} " STREQUAL "ANDROID" )
184
+ if ("${arch} " STREQUAL "armv7" )
185
+ set (SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_TRIPLE "arm-linux-androideabi" )
186
+ set (SWIFT_SDK_ANDROID_ARCH_${arch}_ALT_SPELLING "arm" )
187
+ set (SWIFT_SDK_ANDROID_ARCH_${arch}_PATH "${SWIFT_ANDROID_NDK_PATH} /platforms/android-${SWIFT_ANDROID_API_LEVEL} /arch-arm" )
188
+ set (SWIFT_SDK_ANDROID_ARCH_${arch}_TRIPLE "armv7-none-linux-androideabi" )
189
+ elseif ("${arch} " STREQUAL "aarch64" )
190
+ set (SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_TRIPLE "aarch64-linux-android" )
191
+ set (SWIFT_SDK_ANDROID_ARCH_${arch}_ALT_SPELLING "aarch64" )
192
+ set (SWIFT_SDK_ANDROID_ARCH_${arch}_PATH "${SWIFT_ANDROID_NDK_PATH} /platforms/android-${SWIFT_ANDROID_API_LEVEL} /arch-arm64" )
193
+ set (SWIFT_SDK_ANDROID_ARCH_${arch}_TRIPLE "aarch64-unknown-linux-android" )
194
+ else ()
195
+ message (FATAL_ERROR "unknown arch for android SDK: ${arch} " )
196
+ endif ()
197
+
198
+ # Get the prebuilt suffix to create the correct toolchain path when using the NDK
199
+ if ("${CMAKE_HOST_SYSTEM_NAME} " STREQUAL "Darwin" )
200
+ set (_swift_android_prebuilt_build "darwin-x86_64" )
201
+ elseif ("${CMAKE_HOST_SYSTEM_NAME} " STREQUAL "Linux" )
202
+ set (_swift_android_prebuilt_build "linux-x86_64" )
203
+ endif ()
204
+ set (SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_PREBUILT_PATH
205
+ "${SWIFT_ANDROID_NDK_PATH} /toolchains/${SWIFT_SDK_ANDROID_ARCH_${arch} _NDK_TRIPLE}-${SWIFT_ANDROID_NDK_GCC_VERSION} /prebuilt/${_swift_android_prebuilt_build} " )
206
+
207
+ # Resolve the correct linker based on the file name of CMAKE_LINKER (being 'ld' or 'ld.gold' the options)
208
+ get_filename_component (SWIFT_ANDROID_LINKER_NAME "${CMAKE_LINKER} " NAME )
209
+ set (SWIFT_SDK_ANDROID_ARCH_${arch}_LINKER
210
+ "${SWIFT_SDK_ANDROID_ARCH_${arch} _NDK_PREBUILT_PATH}/bin/${SWIFT_SDK_ANDROID_ARCH_${arch} _NDK_TRIPLE}-${SWIFT_ANDROID_LINKER_NAME} " )
211
+ else ()
212
+ set (SWIFT_SDK_${prefix}_ARCH_${arch}_PATH "${sdkpath} " )
213
+ set (SWIFT_SDK_${prefix}_ARCH_${arch}_TRIPLE "${triple} " )
214
+ endif ()
212
215
endforeach ()
213
216
214
217
# Add this to the list of known SDKs.
215
218
list (APPEND SWIFT_CONFIGURED_SDKS "${prefix} " )
216
219
217
- if ("${prefix} " STREQUAL "ANDROID" )
218
- _configure_sdk_android_specific (${prefix} ${name} ${lib_subdir} ${triple_name} ${architectures} ${triple} ${sdkpath} )
219
- endif ()
220
-
221
220
_report_sdk ("${prefix} " )
222
221
endmacro ()
223
222
0 commit comments