Skip to content

Commit 56d6955

Browse files
bitjammertkremenek
authored andcommitted
lib/SwiftReflection shouldn't link libswiftCore (#2627)
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 9a69799 commit 56d6955

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.
@@ -984,7 +984,7 @@ endfunction()
984984
function(add_swift_library name)
985985
set(SWIFTLIB_options
986986
SHARED IS_STDLIB IS_STDLIB_CORE IS_SDK_OVERLAY TARGET_LIBRARY IS_HOST
987-
API_NOTES_NON_OVERLAY DONT_EMBED_BITCODE)
987+
API_NOTES_NON_OVERLAY DONT_EMBED_BITCODE HAS_SWIFT_CONTENT)
988988
cmake_parse_arguments(SWIFTLIB
989989
"${SWIFTLIB_options}"
990990
"INSTALL_IN_COMPONENT;DEPLOYMENT_VERSION_IOS"
@@ -995,6 +995,7 @@ function(add_swift_library name)
995995
# Infer arguments.
996996

997997
if(SWIFTLIB_IS_SDK_OVERLAY)
998+
set(SWIFTLIB_HAS_SWIFT_CONTENT TRUE)
998999
set(SWIFTLIB_SHARED TRUE)
9991000
set(SWIFTLIB_IS_STDLIB TRUE)
10001001
set(SWIFTLIB_TARGET_LIBRARY TRUE)
@@ -1005,6 +1006,7 @@ function(add_swift_library name)
10051006

10061007
# Standard library is always a target library.
10071008
if(SWIFTLIB_IS_STDLIB)
1009+
set(SWIFTLIB_HAS_SWIFT_CONTENT TRUE)
10081010
set(SWIFTLIB_TARGET_LIBRARY TRUE)
10091011
endif()
10101012

@@ -1019,7 +1021,7 @@ function(add_swift_library name)
10191021

10201022
# All Swift code depends on the standard library, except for the standard
10211023
# library itself.
1022-
if(SWIFTLIB_TARGET_LIBRARY AND NOT SWIFTLIB_IS_STDLIB_CORE)
1024+
if(SWIFTLIB_TARGET_LIBRARY AND SWIFTLIB_HAS_SWIFT_CONTENT AND NOT SWIFTLIB_IS_STDLIB_CORE)
10231025
list(APPEND SWIFTLIB_SWIFT_MODULE_DEPENDS Core)
10241026
endif()
10251027

@@ -1164,6 +1166,7 @@ function(add_swift_library name)
11641166
${SWIFTLIB_IS_STDLIB_keyword}
11651167
${SWIFTLIB_IS_STDLIB_CORE_keyword}
11661168
${SWIFTLIB_IS_SDK_OVERLAY_keyword}
1169+
${SWIFTLIB_TARGET_LIBRARY_keyword}
11671170
INSTALL_IN_COMPONENT "${SWIFTLIB_INSTALL_IN_COMPONENT}"
11681171
DEPLOYMENT_VERSION_IOS "${SWIFTLIB_DEPLOYMENT_VERSION_IOS}"
11691172
)

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)