Skip to content

Commit 8bf745b

Browse files
[static-stdlib] Explicit autolink for RegexParser in StringProcessing (#60319)
_RegexParser is used only in StringProcessing and it's imported with @_implementationOnly. Modules imported with @_implementationOnly are not autolinked, so build system let the importer module how to link it. When building a shared library, _RegexParser is already linked into StringProcessing. But when building a static library, it's not. So we need to add autolink entry explicitly.
1 parent 9e4a00d commit 8bf745b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

stdlib/public/StringProcessing/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ set(swift_string_processing_link_libraries
1414
swiftCore
1515
swift_RegexParser)
1616

17+
set(swift_string_processing_compile_flags)
18+
if(SWIFT_BUILD_STATIC_STDLIB)
19+
# Explicitly autolink swift_RegexParser because it's imported with @_implementationOnly
20+
list(APPEND swift_string_processing_compile_flags
21+
"-Xfrontend" "-public-autolink-library" "-Xfrontend" "swift_RegexParser")
22+
endif()
23+
1724
file(GLOB_RECURSE _STRING_PROCESSING_SOURCES
1825
"${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}/Sources/_StringProcessing/*.swift"
1926
"${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}/Sources/_CUnicode/*.h"
@@ -40,6 +47,7 @@ add_swift_target_library(swift_StringProcessing ${SWIFT_STDLIB_LIBRARY_BUILD_TYP
4047
C_COMPILE_FLAGS
4148
-Dswift_StringProcessing_EXPORTS
4249
SWIFT_COMPILE_FLAGS
50+
${swift_string_processing_compile_flags}
4351
${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
4452
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
4553

0 commit comments

Comments
 (0)