Skip to content

Commit 45cfb07

Browse files
committed
Overlay: perform micro-optimization on Windows, correct export
The `CRT` and `WinSDK` overlays do not expose protocols (and should not). Avoid force load symbols for these modules. This is a minor micro-optimization for clients. Correct the exported interface to allow building against these modules by propagating the workaround from Core to expose the swift interface.
1 parent 5664fd6 commit 45cfb07

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Runtimes/Overlay/Windows/CRT/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@ set_target_properties(swiftCRT PROPERTIES
1212
target_compile_definitions(swiftCRT PRIVATE
1313
$<$<BOOL:${SwiftOverlay_ENABLE_REFLECTION}>:SWIFT_ENABLE_REFLECTION>)
1414
target_compile_options(swiftCRT PRIVATE
15+
"SHELL:-Xfrontend -disable-force-load-symbols"
1516
"SHELL:-Xcc -D_USE_MATH_DEFINES")
1617
target_link_libraries(swiftCRT PRIVATE
1718
ClangModules
1819
swiftCore)
1920

21+
# FIXME: Why is this not implicitly in the interface flags?
22+
target_include_directories(swiftCRT INTERFACE
23+
"$<$<COMPILE_LANGUAGE:Swift>:$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${SwiftCore_INSTALL_SWIFTMODULEDIR}>>")
24+
2025
install(TARGETS swiftCRT
2126
EXPORT SwiftOverlayTargets
2227
ARCHIVE DESTINATION "${SwiftOverlay_INSTALL_LIBDIR}"

Runtimes/Overlay/Windows/WinSDK/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@ add_library(swiftWinSDK
33
WinSDK.swift)
44
set_target_properties(swiftWinSDK PROPERTIES
55
Swift_MODULE_NAME WinSDK)
6-
target_compile_definitions(swiftCRT PRIVATE
6+
target_compile_definitions(swiftWinSDK PRIVATE
77
$<$<BOOL:${SwiftOverlay_ENABLE_REFLECTION}>:SWIFT_ENABLE_REFLECTION>)
8+
target_compile_options(swiftWinSDK PRIVATE
9+
"SHELL:-Xfrontend -disable-force-load-symbols")
810
target_link_libraries(swiftWinSDK PRIVATE
911
ClangModules
1012
swiftCore)
1113

14+
# FIXME: Why is this not implicitly in the interface flags?
15+
target_include_directories(swiftWinSDK INTERFACE
16+
"$<$<COMPILE_LANGUAGE:Swift>:$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${SwiftCore_INSTALL_SWIFTMODULEDIR}>>")
17+
1218
install(TARGETS swiftWinSDK
1319
EXPORT SwiftOverlayTargets
1420
ARCHIVE DESTINATION "${SwiftOverlay_INSTALL_LIBDIR}"

0 commit comments

Comments
 (0)