Skip to content

Commit ce68189

Browse files
committed
runtimes: add Android search handling for SwiftCore
This updates the search handling to account for Android SDK searches on Windows. This is required to repair the nightly builds.
1 parent db47bfd commit ce68189

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

Runtimes/Supplemental/cmake/modules/FindSwiftCore.cmake

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,48 @@ elseif(WIN32)
114114
INTERFACE_INCLUDE_DIRECTORIES "${SwiftCore_INCLUDE_DIR}")
115115
find_package_handle_standard_args(SwiftCore DEFAULT_MSG
116116
SwiftCore_LIBRARY SwiftCore_INCLUDE_DIR)
117+
elseif(ANDROID)
118+
if(BUILD_SHARED_LIBS)
119+
find_path(SwiftCore_INCLUDE_DIR
120+
"Swift.swiftmodule"
121+
NO_CMAKE_FIND_ROOT_PATH
122+
HINTS
123+
"${Swift_SDKROOT}/usr/lib/swift/android"
124+
"$ENV{SDKROOT}/usr/lib/swift/android")
125+
find_library(SwiftCore_LIBRARY
126+
NO_CMAKE_FIND_ROOT_PATH
127+
NAMES "libswiftCore.so"
128+
HINTS
129+
"${Swift_SDKROOT}/usr/lib/swift/android/${SwiftCore_ARCH_SUBDIR}"
130+
"${Swift_SDKROOT}/usr/lib/swift"
131+
"$ENV{SDKROOT}/usr/lib/swift/android/${SwiftCore_ARCH_SUBDIR}"
132+
"$ENV{SDKROOT}/usr/lib/swift")
133+
134+
add_library(swiftCore SHARED IMPORTED GLOBAL)
135+
else()
136+
find_path(SwiftCore_INCLUDE_DIR
137+
"Swift.swiftmodule"
138+
NO_CMAKE_FIND_ROOT_PATH
139+
HINTS
140+
"${Swift_SDKROOT}/usr/lib/swift_static/android"
141+
"$ENV{SDKROOT}/usr/lib/swift_static/android")
142+
find_library(SwiftCore_LIBRARY
143+
NO_CMAKE_FIND_ROOT_PATH
144+
NAMES "libswiftCore.a"
145+
HINTS
146+
"${Swift_SDKROOT}/usr/lib/swift_static/android/${SwiftCore_ARCH_SUBDIR}"
147+
"${Swift_SDKROOT}/usr/lib/swift_static"
148+
"$ENV{SDKROOT}/usr/lib/swift_static/android/${SwiftCore_ARCH_SUBDIR}"
149+
"$ENV{SDKROOT}/usr/lib/swift_static")
150+
151+
add_library(swiftCore STATIC IMPORTED GLOBAL)
152+
endif()
153+
154+
set_target_properties(swiftCore PROPERTIES
155+
IMPORTED_LOCATION "${SwiftCore_LIBRARY}"
156+
INTERFACE_INCLUDE_DIRECTORIES "${SwiftCore_INCLUDE_DIR}")
157+
find_package_handle_standard_args(SwiftCore DEFAULT_MSG
158+
SwiftCore_LIBRARY SwiftCore_INCLUDE_DIR)
117159
else()
118160
message(FATAL_ERROR "FindSwiftCore.cmake module search not implemented for targeted platform\n"
119161
" Build Core for your platform and set `SwiftCore_DIR` to"

0 commit comments

Comments
 (0)