File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -12,8 +12,26 @@ function(add_swift_target target)
12
12
set (link_flags )
13
13
14
14
if ("${CMAKE_SYSTEM_NAME} " STREQUAL "Android" )
15
- if ("${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN} " STREQUAL "" )
16
- set (CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN "${CMAKE_ANDROID_NDK} /toolchains/${CMAKE_ANDROID_ARCH_HEADER_TRIPLE} -4.9/prebuilt/linux-x86_64" )
15
+ if ("${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN} " STREQUAL "" )
16
+ if (CMAKE_HOST_SYSTEM_NAME STREQUAL Linux )
17
+ set (android_host_tag linux-x86_64 )
18
+ elseif (CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin )
19
+ set (android_host_tag darwin-x86_64 )
20
+ elseif (CMAKE_HOST_SYSTEM_NAME STREQUAL Windows )
21
+ set (android_host_tag windows-x86_64 )
22
+ endif ()
23
+
24
+ if (CMAKE_ANDROID_ARCH_ABI STREQUAL armeabi-v7a )
25
+ set (android_toolchain_root ${CMAKE_ANDROID_ARCH_HEADER_TRIPLE} )
26
+ elseif (CMAKE_ANDROID_ARCH_ABI STREQUAL arm64-v8a )
27
+ set (android_toolchain_root ${CMAKE_ANDROID_ARCH_HEADER_TRIPLE} )
28
+ elseif (CMAKE_ANDROID_ARCH_ABI STREQUAL x86 )
29
+ set (android_toolchain_root ${CMAKE_ANDROID_ARCH_ABI} )
30
+ elseif (CMAKE_ANDROID_ARCH_ABI STREQUAL x86_64 )
31
+ set (android_toolchain_root ${CMAKE_ANDROID_ARCH_ABI} )
32
+ endif ()
33
+
34
+ set (CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN "${CMAKE_ANDROID_NDK} /toolchains/${android_toolchain_root} -4.9/prebuilt/${android_host_tag} " )
17
35
endif ()
18
36
19
37
list (APPEND compile_flags "-sdk" "${CMAKE_ANDROID_NDK} /platforms/android-${CMAKE_SYSTEM_VERSION} /arch-${CMAKE_ANDROID_ARCH} " )
You can’t perform that action at this time.
0 commit comments