Skip to content

Commit 0a67867

Browse files
committed
[embedded] Add a CMake setting for building Embedded Swift stdlib for custom target triples
1 parent 0721124 commit 0a67867

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

stdlib/public/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ option(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB_CROSS_COMPILING
152152
"Enable build of the embedded Swift standard library and runtime for cross-compiling targets"
153153
FALSE)
154154

155+
set(SWIFT_EMBEDDED_STDLIB_EXTRA_TARGET_TRIPLES "" CACHE STRING
156+
"List of extra target triples to build the embedded Swift standard library for")
157+
155158
if((NOT SWIFT_HOST_VARIANT STREQUAL "macosx") AND (NOT SWIFT_HOST_VARIANT STREQUAL "linux") AND (NOT SWIFT_HOST_VARIANT STREQUAL "windows"))
156159
set(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB FALSE)
157160
elseif(BOOTSTRAPPING_MODE STREQUAL "OFF")
@@ -250,6 +253,24 @@ if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
250253
endif()
251254
endif()
252255

256+
foreach(triple ${SWIFT_EMBEDDED_STDLIB_EXTRA_TARGET_TRIPLES})
257+
if(triple STREQUAL "")
258+
continue()
259+
endif()
260+
261+
string(REGEX REPLACE "-" ";" list "${triple}")
262+
list(GET list 0 arch)
263+
list(GET list 1 vendor)
264+
list(GET list 2 os)
265+
string(REGEX REPLACE "[0-9]+(\\.[0-9]+)+" " " mod "${triple}")
266+
267+
list(FILTER EMBEDDED_STDLIB_TARGET_TRIPLES EXCLUDE REGEX " ${mod} ")
268+
269+
list(APPEND EMBEDDED_STDLIB_TARGET_TRIPLES
270+
"${arch} ${mod} ${triple}"
271+
)
272+
endforeach()
273+
253274
if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
254275
set(triples)
255276
foreach(entry ${EMBEDDED_STDLIB_TARGET_TRIPLES})

0 commit comments

Comments
 (0)