Skip to content

Commit 83efc88

Browse files
committed
Merge pull request #2060 from bitjammer/reflection-dump-host-build
Ensure swiftReflection is always built for the host
2 parents 5a4db8e + e1eca69 commit 83efc88

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,7 @@ endfunction()
13471347
# Sources to add into this library.
13481348
function(add_swift_library name)
13491349
set(SWIFTLIB_options
1350-
SHARED IS_STDLIB IS_STDLIB_CORE IS_SDK_OVERLAY TARGET_LIBRARY
1350+
SHARED IS_STDLIB IS_STDLIB_CORE IS_SDK_OVERLAY TARGET_LIBRARY IS_HOST
13511351
API_NOTES_NON_OVERLAY DONT_EMBED_BITCODE)
13521352
cmake_parse_arguments(SWIFTLIB
13531353
"${SWIFTLIB_options}"
@@ -1426,6 +1426,9 @@ function(add_swift_library name)
14261426
# SDKs building the variants of this library.
14271427
list_intersect(
14281428
"${SWIFTLIB_TARGET_SDKS}" "${SWIFT_SDKS}" SWIFTLIB_TARGET_SDKS)
1429+
if(SWIFTLIB_IS_HOST)
1430+
list_union("${SWIFTLIB_TARGET_SDKS}" "${SWIFT_HOST_VARIANT_SDK}" SWIFTLIB_TARGET_SDKS)
1431+
endif()
14291432
foreach(sdk ${SWIFTLIB_TARGET_SDKS})
14301433
set(THIN_INPUT_TARGETS)
14311434

@@ -1632,13 +1635,15 @@ function(add_swift_library name)
16321635
if(SWIFTLIB_IS_STDLIB)
16331636
foreach(arch ${SWIFT_SDK_${sdk}_ARCHITECTURES})
16341637
set(VARIANT_SUFFIX "-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}")
1635-
add_dependencies("swift-stdlib${VARIANT_SUFFIX}"
1636-
${lipo_target}
1637-
${lipo_target_static})
1638-
if(NOT "${name}" STREQUAL "swiftStdlibCollectionUnittest")
1639-
add_dependencies("swift-test-stdlib${VARIANT_SUFFIX}"
1638+
if(TARGET "swift-stdlib${VARIANT_SUFFIX}" AND TARGET "swift-test-stdlib${VARIANT_SUFFIX}")
1639+
add_dependencies("swift-stdlib${VARIANT_SUFFIX}"
16401640
${lipo_target}
16411641
${lipo_target_static})
1642+
if(NOT "${name}" STREQUAL "swiftStdlibCollectionUnittest")
1643+
add_dependencies("swift-test-stdlib${VARIANT_SUFFIX}"
1644+
${lipo_target}
1645+
${lipo_target_static})
1646+
endif()
16421647
endif()
16431648
endforeach()
16441649
endif()

cmake/modules/SwiftList.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,13 @@ function(list_intersect lhs rhs result_var_name)
2020
set("${result_var_name}" "${result}" PARENT_SCOPE)
2121
endfunction()
2222

23+
function(list_union lhs rhs result_var_name)
24+
set(result)
25+
foreach(item IN LISTS lhs rhs)
26+
list(FIND result "${item}" index)
27+
if(${index} EQUAL -1)
28+
list(APPEND result "${item}")
29+
endif()
30+
endforeach()
31+
set("${result_var_name}" "${result}" PARENT_SCOPE)
32+
endfunction()

stdlib/public/Reflection/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
add_swift_library(swiftReflection IS_STDLIB
1+
add_swift_library(swiftReflection IS_STDLIB IS_HOST
22
Demangle.cpp
33
Remangle.cpp
44
TypeRef.cpp

0 commit comments

Comments
 (0)