Skip to content

Commit f3500e4

Browse files
committed
lib/SwiftReflection shouldn't link libswiftCore
Although this is a target library, it does not need to link against the standard library, because it doesn't have any Swift content in it. We need to add a separate build flag for having CMake content because saying a library "IS_STDLIB" isn't correct for this case. rdar://problem/26399625
1 parent 8e7bcb1 commit f3500e4

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ endfunction()
443443
function(_add_swift_library_single target name)
444444
set(SWIFTLIB_SINGLE_options
445445
SHARED IS_STDLIB IS_STDLIB_CORE IS_SDK_OVERLAY
446-
API_NOTES_NON_OVERLAY DONT_EMBED_BITCODE)
446+
API_NOTES_NON_OVERLAY DONT_EMBED_BITCODE TARGET_LIBRARY)
447447
cmake_parse_arguments(SWIFTLIB_SINGLE
448448
"${SWIFTLIB_SINGLE_options}"
449449
"SDK;ARCHITECTURE;INSTALL_IN_COMPONENT;DEPLOYMENT_VERSION_IOS"
@@ -603,7 +603,7 @@ function(_add_swift_library_single target name)
603603
SUFFIX ${LLVM_PLUGIN_EXT})
604604
endif()
605605

606-
if(SWIFTLIB_SINGLE_IS_STDLIB)
606+
if(SWIFTLIB_SINGLE_TARGET_LIBRARY)
607607
# Install runtime libraries to lib/swift instead of lib. This works around
608608
# the fact that -isysroot prevents linking to libraries in the system
609609
# /usr/lib if Swift is installed in /usr.
@@ -981,7 +981,7 @@ endfunction()
981981
function(add_swift_library name)
982982
set(SWIFTLIB_options
983983
SHARED IS_STDLIB IS_STDLIB_CORE IS_SDK_OVERLAY TARGET_LIBRARY IS_HOST
984-
API_NOTES_NON_OVERLAY DONT_EMBED_BITCODE)
984+
API_NOTES_NON_OVERLAY DONT_EMBED_BITCODE HAS_SWIFT_CONTENT)
985985
cmake_parse_arguments(SWIFTLIB
986986
"${SWIFTLIB_options}"
987987
"INSTALL_IN_COMPONENT;DEPLOYMENT_VERSION_IOS"
@@ -992,6 +992,7 @@ function(add_swift_library name)
992992
# Infer arguments.
993993

994994
if(SWIFTLIB_IS_SDK_OVERLAY)
995+
set(SWIFTLIB_HAS_SWIFT_CONTENT TRUE)
995996
set(SWIFTLIB_SHARED TRUE)
996997
set(SWIFTLIB_IS_STDLIB TRUE)
997998
set(SWIFTLIB_TARGET_LIBRARY TRUE)
@@ -1002,6 +1003,7 @@ function(add_swift_library name)
10021003

10031004
# Standard library is always a target library.
10041005
if(SWIFTLIB_IS_STDLIB)
1006+
set(SWIFTLIB_HAS_SWIFT_CONTENT TRUE)
10051007
set(SWIFTLIB_TARGET_LIBRARY TRUE)
10061008
endif()
10071009

@@ -1016,7 +1018,7 @@ function(add_swift_library name)
10161018

10171019
# All Swift code depends on the standard library, except for the standard
10181020
# library itself.
1019-
if(SWIFTLIB_TARGET_LIBRARY AND NOT SWIFTLIB_IS_STDLIB_CORE)
1021+
if(SWIFTLIB_TARGET_LIBRARY AND SWIFTLIB_HAS_SWIFT_CONTENT AND NOT SWIFTLIB_IS_STDLIB_CORE)
10201022
list(APPEND SWIFTLIB_SWIFT_MODULE_DEPENDS Core)
10211023
endif()
10221024

@@ -1161,6 +1163,7 @@ function(add_swift_library name)
11611163
${SWIFTLIB_IS_STDLIB_keyword}
11621164
${SWIFTLIB_IS_STDLIB_CORE_keyword}
11631165
${SWIFTLIB_IS_SDK_OVERLAY_keyword}
1166+
${SWIFTLIB_TARGET_LIBRARY_keyword}
11641167
INSTALL_IN_COMPONENT "${SWIFTLIB_INSTALL_IN_COMPONENT}"
11651168
DEPLOYMENT_VERSION_IOS "${SWIFTLIB_DEPLOYMENT_VERSION_IOS}"
11661169
)

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 IS_HOST
1+
add_swift_library(swiftReflection TARGET_LIBRARY IS_HOST
22
Demangle.cpp
33
MetadataSource.cpp
44
Remangle.cpp

stdlib/public/SwiftRemoteMirror/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
add_swift_library(swiftRemoteMirror SHARED IS_STDLIB
1+
add_swift_library(swiftRemoteMirror SHARED TARGET_LIBRARY
22
SwiftRemoteMirror.cpp
33
LINK_LIBRARIES swiftReflection
44
INSTALL_IN_COMPONENT stdlib)

0 commit comments

Comments
 (0)