Skip to content

Commit a2f5472

Browse files
committed
Runtimes: attempt to embed a SxS manifest for swiftCore
This will allow us to have multiple parallel installations of swiftCore with the same DLL name allowing us to side-step the ABI instability without resorting to SOVERSIONing.
1 parent 772cff1 commit a2f5472

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

Runtimes/Core/core/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,14 @@ if(NOT POLICY CMP0157)
318318
$<TARGET_OBJECTS:swiftThreading>)
319319
endif()
320320

321+
if(WIN32 AND BUILD_SHARED_LIBS)
322+
configure_file(swiftCore.1.manifest.in
323+
swiftCore-${PROJECT_VERSION}.1.manifest
324+
@ONLY NEWLINE_STYLE WIN32)
325+
add_custom_command(TARGET swiftCore POST_BUILD
326+
COMMAND ${CMAKE_MT} -nologo -manifest "${CMAKE_CURRENT_BINARY_DIR}/swiftCore-${PROJECT_VERSION}.1.manifest" "-outputresource:$<TARGET_FILE:swiftCore>;#1")
327+
endif()
328+
321329
if(NOT ANDROID AND NOT APPLE AND NOT LINUX AND NOT WIN32 AND UNIX)
322330
find_library(EXECINFO_LIBRARY execinfo)
323331
target_link_libraries(swiftCore PRIVATE "${EXECINFO_LIBRARY}")

Runtimes/Resync.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ if(_output)
7171
"Copy ${StdlibSources}/Info.plist.in] -> Core/Info.plist.in Failed: ${_output}")
7272
endif()
7373

74+
message(STATUS "manifest[${StdlibSources}/swiftCore.1.manifest.in] -> Core/core/swiftCore.1.manifest.in")
75+
file(COPY_FILE
76+
"${StdlibSources}/public/core/swiftCore.1.manifest.in" # From
77+
"${CMAKE_CURRENT_LIST_DIR}/Core/core/swiftCore.1.manifest.in" # To
78+
RESULT _output
79+
ONLY_IF_DIFFERENT)
80+
if(_output)
81+
message(SEND_ERROR
82+
"Copy ${StdlibSources}/public/core/swiftCore.1.manifest.in -> Core/core/swiftCore.1.manifest.in Failed; ${_output}")
83+
endif()
84+
7485
set(CoreLibs
7586
LLVMSupport
7687
SwiftShims
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='yes'?>
2+
<assembly manifestversion='1.0' xmlns="urn:schemas-microsoft-com:asm.v1">
3+
<assemblyIdentity
4+
name='swiftCore'
5+
processorArchitecture='@CMAKE_SYSTEM_PROCESSOR@'
6+
type='win32'
7+
version='@PROJECT_VERSION@' />
8+
<file name='swiftCore.dll' />
9+
</assembly>

0 commit comments

Comments
 (0)