Files
swift-mirror/utils/windows-clang-overrides.cmake
Saleem Abdulrasool a4c76ff3a1 utils: bind staged Windows tools to private SxS runtimes
Stage each Swift runtime DLL needed by the laid-out toolchain as a private
per-DLL SxS assembly under usr/bin.

Compute each EXE's static import graph and write the full Swift runtime
closure into the EXE's application manifest. Disable linker-generated DLL
manifests for Swift's CMake-built DLLs and for the mimalloc MSBuild project,
then validate existing DLL manifest resources before binding: reject UAC
execution-level metadata and unexpected reserved RT_MANIFEST resource IDs so
implicit linker manifests cannot poison SxS activation.

Keep the checked-in WiX authoring canonical and warn when the live import
graph drifts from bld/cli/dbg/ide package ownership.
2026-05-21 08:44:45 -07:00

30 lines
1.4 KiB
CMake

# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2026 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
# Included via CMAKE_USER_MAKE_RULES_OVERRIDE for Windows builds. CMake can
# add an explicit /MANIFEST:EMBED to compiler-driver shared-library rules. The
# build script passes /MANIFEST:NO for shared/module links so linker-generated
# RT_MANIFEST #2 resources do not poison private SxS activation; strip the
# explicit embed spelling so it cannot override that flag.
foreach(lang IN ITEMS C CXX Swift)
foreach(rule IN ITEMS
CMAKE_${lang}_CREATE_SHARED_LIBRARY
CMAKE_${lang}_CREATE_SHARED_MODULE)
if(DEFINED ${rule})
string(REPLACE " --manifests " " " ${rule} "${${rule}}")
string(REPLACE " -Xlinker /MANIFEST:EMBED" "" ${rule} "${${rule}}")
string(REPLACE "-Xlinker /MANIFEST:EMBED " "" ${rule} "${${rule}}")
string(REPLACE "-Xlinker /MANIFEST:EMBED" "" ${rule} "${${rule}}")
string(REPLACE " /MANIFEST:EMBED" "" ${rule} "${${rule}}")
string(REPLACE "/MANIFEST:EMBED " "" ${rule} "${${rule}}")
string(REPLACE "/MANIFEST:EMBED" "" ${rule} "${${rule}}")
endif()
endforeach()
endforeach()