Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
522df84
utils: rename `Build-SDK` to `Build-LegacySDK`
compnerd Apr 28, 2026
b4744d3
utils: avoid re-cloning the sources for EarlySwiftDriver
compnerd May 12, 2026
e3b65d4
utils: remove `-TraceExpand` argument for build.ps1
compnerd Apr 28, 2026
df16913
utils: silence output of New-Item
compnerd Apr 30, 2026
f11509e
utils: Report -Clean removal failures
compnerd May 7, 2026
88bf438
utils: move compiler flags into compiler definitions
compnerd Apr 28, 2026
a6dc071
utils: let SDK leaf builders select compilers
compnerd May 6, 2026
e9e606a
utils: build the stage0 bootstrap compiler
compnerd Apr 28, 2026
1e0abf6
utils: build a bootstrap SDK with stage0
compnerd May 6, 2026
312e8b7
utils: build stage1 with the bootstrap SDK
compnerd Apr 30, 2026
e59f25e
utils: build an intermediate host SDK with stage1
compnerd Apr 30, 2026
fc92174
utils: build the stage2 compiler and toolchain
compnerd May 1, 2026
0ddcca7
utils: use Build-SDK for staged SDK construction
compnerd May 6, 2026
3601a12
utils: make the staged SDK the canonical platform SDK
compnerd May 6, 2026
de83bdb
utils: avoid clang-cache launcher for Android SDK builds
compnerd May 6, 2026
c5695c0
utils: use GNU drivers for non-Windows SDK builds
compnerd May 6, 2026
632d189
utils: pass GNU drivers to Android swift-inspect
compnerd May 6, 2026
48b7b05
utils: add Windows manifest dependency helper
compnerd May 13, 2026
bdcafb7
utils: bind staged Windows tools to private SxS runtimes
compnerd May 8, 2026
a03a349
utils: bind Stage2 test tools to the SDK runtime
compnerd May 13, 2026
f153311
utils: use staged toolchain inputs for package tests
compnerd May 18, 2026
0f770fd
build: avoid compiler-local libdispatch builds
compnerd May 14, 2026
be1ee97
utils: stage mimalloc to NoAsserts toolchain as well
compnerd May 27, 2026
d0738cd
utils: replace `-Skip` flags with positive forms
compnerd May 27, 2026
656f7b8
utils: enable WMO on Windows toolchain builds
compnerd May 26, 2026
8bf9e12
Runtimes: propagate SwiftRT objects via swiftCore
compnerd May 18, 2026
e5b9baf
cmake: reuse prebuilt libdispatch package
compnerd May 14, 2026
90cb3fb
test: Use host SDK resources for Windows host-build-swift
compnerd May 6, 2026
dff241e
Runtimes: adjust resource embedding for runtimes on Windows
compnerd May 12, 2026
55555fd
test: Allow overriding the lit host SDK
compnerd May 6, 2026
43bf616
[windows] stabilize lldb test runtime resolution
charles-zablit Jun 11, 2026
b9eec22
[windows] prefer the SDK runtime over the flat build bin on the lldb …
charles-zablit Jun 11, 2026
064c699
[windows] bind lldb to the full Swift runtime SxS bundle
charles-zablit Jun 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Runtimes/Core/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -354,16 +354,25 @@ target_link_libraries(swiftCore
swiftRuntimeCoreCMakeConfig)

string(TOLOWER "${SwiftCore_OBJECT_FORMAT}" SwiftCore_OBJECT_FORMAT_lc)
# Runtime clients need the Swift image-registration object on their link lines
# (on COFF this supplies pSwiftImageConstructor and the .sw5* section ranges).
# CMake propagates usage requirements for an OBJECT library that appears in an
# INTERFACE_LINK_LIBRARIES chain, but it does not also add the object's payload to
# the final link line. Keep the swiftrt target for its usage requirements, and
# explicitly propagate the object payload through swiftCore's interface.
if("${SwiftCore_OBJECT_FORMAT_lc}" STREQUAL "elf")
target_link_libraries(swiftCore INTERFACE
swiftrt)
swiftrt
$<TARGET_OBJECTS:swiftrt>)
elseif("${SwiftCore_OBJECT_FORMAT_lc}" STREQUAL "coff")
if(BUILD_SHARED_LIBS)
target_link_libraries(swiftCore INTERFACE
swiftrt)
swiftrt
$<TARGET_OBJECTS:swiftrt>)
else()
target_link_libraries(swiftCore INTERFACE
swiftrtT)
swiftrtT
$<TARGET_OBJECTS:swiftrtT>)
endif()
endif()

Expand Down
2 changes: 0 additions & 2 deletions Runtimes/Overlay/Android/Android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,3 @@ install(TARGETS swiftAndroid
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
emit_swift_interface(swiftAndroid)
install_swift_interface(swiftAndroid)

embed_manifest(swiftAndroid)
2 changes: 0 additions & 2 deletions Runtimes/Overlay/Android/Math/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,3 @@ install(TARGETS swift_math
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
emit_swift_interface(swift_math)
install_swift_interface(swift_math)

embed_manifest(swift_math)
1 change: 0 additions & 1 deletion Runtimes/Overlay/Linux/glibc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ install(TARGETS swiftGlibc
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
emit_swift_interface(swiftGlibc)
install_swift_interface(swiftGlibc)
embed_manifest(swiftGlibc)
2 changes: 2 additions & 0 deletions Runtimes/Supplemental/StackWalker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ find_package(SwiftDarwin)
endif()

include(GNUInstallDirs)
include(ResourceEmbedding)

# NOTE: we disable availability checking because we need to use code from the
# RuntimeModule, but we also need to build with an availability version below
Expand Down Expand Up @@ -92,3 +93,4 @@ target_link_libraries(swift-backtrace PRIVATE

install(TARGETS swift-backtrace
RUNTIME DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/swift")
embed_version_info(swift-backtrace)
175 changes: 160 additions & 15 deletions Runtimes/cmake/modules/ResourceEmbedding.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,41 +30,186 @@ function(generate_plist project_name project_version target)
endif()
endfunction()

# FIXME: it appears that `CMAKE_MT` evaluates to an empty string which prevents
# the use of the variable. This aliases `MT` to `CMAKE_MT` and tries to fallback
# to known spellings for the tool.
if(WIN32 AND BUILD_SHARED_LIBS)
find_program(MT HINTS ${CMAKE_MT} NAMES mt llvm-mt REQUIRED)
endif()
function(embed_version_info target)
if(NOT WIN32)
return()
endif()

get_target_property(_EM_TARGET_TYPE ${target} TYPE)
if(NOT "${_EM_TARGET_TYPE}" MATCHES "SHARED_LIBRARY|EXECUTABLE")
return()
endif()

cmake_parse_arguments(PARSE_ARGV 1 _EVI
""
"FILE_DESCRIPTION;INTERNAL_NAME;ORIGINAL_FILENAME;PRODUCT_NAME"
"")

if(NOT _EVI_INTERNAL_NAME)
set(_EVI_INTERNAL_NAME "${target}")
endif()
if(NOT _EVI_FILE_DESCRIPTION)
set(_EVI_FILE_DESCRIPTION "${_EVI_INTERNAL_NAME}")
endif()
if(NOT _EVI_PRODUCT_NAME)
set(_EVI_PRODUCT_NAME "Swift")
endif()
if(NOT _EVI_ORIGINAL_FILENAME)
set(_EVI_ORIGINAL_FILENAME "$<TARGET_FILE_NAME:${target}>")
endif()

get_target_property(_EVI_BINARY_DIR ${target} BINARY_DIR)
get_target_property(_EVI_NAME ${target} NAME)

# Pad the project version to a four-part `MAJOR.MINOR.PATCH.TWEAK`
string(REGEX MATCHALL "[0-9]+" version_parts "${PROJECT_VERSION}")
list(LENGTH version_parts version_part_count)
while(version_part_count LESS 4)
list(APPEND version_parts "0")
math(EXPR version_part_count "${version_part_count} + 1")
endwhile()
list(GET version_parts 0 _EVI_VERSION_MAJOR)
list(GET version_parts 1 _EVI_VERSION_MINOR)
list(GET version_parts 2 _EVI_VERSION_PATCH)
list(GET version_parts 3 _EVI_VERSION_TWEAK)
set(_EVI_VERSION_STRING "${_EVI_VERSION_MAJOR}.${_EVI_VERSION_MINOR}.${_EVI_VERSION_PATCH}.${_EVI_VERSION_TWEAK}")

file(CONFIGURE
OUTPUT ${_EVI_BINARY_DIR}/${_EVI_NAME}.rc.in
CONTENT [[
1 VERSIONINFO
FILEVERSION @_EVI_VERSION_MAJOR@,@_EVI_VERSION_MINOR@,@_EVI_VERSION_PATCH@,@_EVI_VERSION_TWEAK@
PRODUCTVERSION @_EVI_VERSION_MAJOR@,@_EVI_VERSION_MINOR@,@_EVI_VERSION_PATCH@,@_EVI_VERSION_TWEAK@
BEGIN
BLOCK "StringFileInfo"
BEGIN
// U.S. English (LangID 0x0409), UTF-8 (CP 65001)
BLOCK "0409FDE9"
BEGIN
VALUE "CompanyName", "Swift Open Source Project"
VALUE "FileDescription", "@_EVI_FILE_DESCRIPTION@"
VALUE "FileVersion", "@_EVI_VERSION_STRING@"
VALUE "InternalName", "@_EVI_INTERNAL_NAME@"
VALUE "LegalCopyright", "Copyright (c) Apple Inc. and the Swift project authors. Licensed under Apache License v2.0 with Runtime Library Exception."
VALUE "OriginalFilename", "@_EVI_ORIGINAL_FILENAME@"
VALUE "ProductName", "@_EVI_PRODUCT_NAME@"
VALUE "ProductVersion", "@_EVI_VERSION_STRING@"
END
END

BLOCK "VarFileInfo"
BEGIN
// Translation must match the StringFileInfo BLOCK key above.
VALUE "Translation", 0x0409, 0xFDE9
END
END
]])
file(GENERATE
OUTPUT ${_EVI_BINARY_DIR}/${_EVI_NAME}.rc
INPUT ${_EVI_BINARY_DIR}/${_EVI_NAME}.rc.in)
target_sources(${target} PRIVATE
${_EVI_BINARY_DIR}/${_EVI_NAME}.rc)
endfunction()

function(embed_manifest target)
if(NOT WIN32)
return()
endif()

get_target_property(_EM_TARGET_TYPE ${target} TYPE)
if(NOT "${_EM_TARGET_TYPE}" MATCHES "SHARED_LIBRARY|EXECUTABLE")
return()
endif()

cmake_parse_arguments(PARSE_ARGV 1 _EM
""
"FILE_DESCRIPTION;INTERNAL_NAME;ORIGINAL_FILENAME;PRODUCT_NAME"
"")

if(NOT _EM_INTERNAL_NAME)
set(_EM_INTERNAL_NAME "${target}")
endif()
if(NOT _EM_FILE_DESCRIPTION)
set(_EM_FILE_DESCRIPTION "${_EM_INTERNAL_NAME}")
endif()
if(NOT _EM_PRODUCT_NAME)
set(_EM_PRODUCT_NAME "Swift")
endif()
if(NOT _EM_ORIGINAL_FILENAME)
set(_EM_ORIGINAL_FILENAME "$<TARGET_FILE_NAME:${target}>")
endif()

get_target_property(_EM_BINARY_DIR ${target} BINARY_DIR)
get_target_property(_EM_NAME ${target} NAME)

# Pad the project version to a four-part `MAJOR.MINOR.PATCH.TWEAK`
string(REGEX MATCHALL "[0-9]+" version_parts "${PROJECT_VERSION}")
list(LENGTH version_parts version_part_count)
while(version_part_count LESS 4)
list(APPEND version_parts "0")
math(EXPR version_part_count "${version_part_count} + 1")
endwhile()
list(GET version_parts 0 _EM_VERSION_MAJOR)
list(GET version_parts 1 _EM_VERSION_MINOR)
list(GET version_parts 2 _EM_VERSION_PATCH)
list(GET version_parts 3 _EM_VERSION_TWEAK)
set(_EM_VERSION_STRING "${_EM_VERSION_MAJOR}.${_EM_VERSION_MINOR}.${_EM_VERSION_PATCH}.${_EM_VERSION_TWEAK}")

# Evaluate variables
file(CONFIGURE
OUTPUT ${_EM_BINARY_DIR}/${_EM_NAME}-${PROJECT_VERSION}.1.manifest.in
OUTPUT ${_EM_BINARY_DIR}/${_EM_NAME}-${_EM_VERSION_STRING}.1.manifest.in
CONTENT [[<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly manifestversion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity
name="$<TARGET_NAME:@target@>"
processorArchitecture="@CMAKE_SYSTEM_PROCESSOR@"
type="win32"
version="@PROJECT_VERSION@" />
version="@_EM_VERSION_STRING@" />
<file name="$<TARGET_FILE_NAME:@target@>" />
</assembly>]])
# Evaluate generator expression
file(GENERATE
OUTPUT ${_EM_BINARY_DIR}/${_EM_NAME}-${PROJECT_VERSION}.1.manifest
INPUT ${_EM_BINARY_DIR}/${_EM_NAME}-${PROJECT_VERSION}.1.manifest.in)
OUTPUT ${_EM_BINARY_DIR}/${_EM_NAME}-${_EM_VERSION_STRING}.1.manifest
INPUT ${_EM_BINARY_DIR}/${_EM_NAME}-${_EM_VERSION_STRING}.1.manifest.in)

if(WIN32)
add_custom_command(TARGET ${target} POST_BUILD
COMMAND "${MT}" -nologo -manifest "${_EM_BINARY_DIR}/${_EM_NAME}-${PROJECT_VERSION}.1.manifest" "-outputresource:$<TARGET_FILE:${target}>;#1")
endif()
file(CONFIGURE
OUTPUT ${_EM_BINARY_DIR}/${_EM_NAME}.rc.in
CONTENT [[
1 VERSIONINFO
FILEVERSION @_EM_VERSION_MAJOR@,@_EM_VERSION_MINOR@,@_EM_VERSION_PATCH@,@_EM_VERSION_TWEAK@
PRODUCTVERSION @_EM_VERSION_MAJOR@,@_EM_VERSION_MINOR@,@_EM_VERSION_PATCH@,@_EM_VERSION_TWEAK@
BEGIN
BLOCK "StringFileInfo"
BEGIN
// U.S. English (LangID 0x0409), UTF-8 (CP 65001)
BLOCK "0409FDE9"
BEGIN
VALUE "CompanyName", "Swift Open Source Project"
VALUE "FileDescription", "@_EM_FILE_DESCRIPTION@"
VALUE "FileVersion", "@_EM_VERSION_STRING@"
VALUE "InternalName", "@_EM_INTERNAL_NAME@"
VALUE "LegalCopyright", "Copyright (c) Apple Inc. and the Swift project authors. Licensed under Apache License v2.0 with Runtime Library Exception."
VALUE "OriginalFilename", "@_EM_ORIGINAL_FILENAME@"
VALUE "ProductName", "@_EM_PRODUCT_NAME@"
VALUE "ProductVersion", "@_EM_VERSION_STRING@"
END
END

BLOCK "VarFileInfo"
BEGIN
// Translation must match the StringFileInfo BLOCK key above.
VALUE "Translation", 0x0409, 0xFDE9
END
END

LANGUAGE 0, 0
1 RT_MANIFEST "@_EM_NAME@-@_EM_VERSION_STRING@.1.manifest"
]])
file(GENERATE
OUTPUT ${_EM_BINARY_DIR}/${_EM_NAME}.rc
INPUT ${_EM_BINARY_DIR}/${_EM_NAME}.rc.in)
target_sources(${target} PRIVATE
${_EM_BINARY_DIR}/${_EM_NAME}.rc)
target_link_options(${target} PRIVATE
$<$<PLATFORM_ID:Windows>:LINKER:/MANIFEST:NO>)
endfunction()
53 changes: 53 additions & 0 deletions cmake/caches/Windows-Bootstrap-Core.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
set(LLVM_EXTERNAL_PROJECTS
swift
CACHE STRING "")

set(LLVM_ENABLE_RUNTIMES "" CACHE STRING "")

set(ENABLE_X86_RELAX_RELOCATIONS YES CACHE BOOL "")

set(LLVM_APPEND_VC_REV NO CACHE BOOL "")
set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR YES CACHE BOOL "")
set(LLVM_ENABLE_PYTHON NO CACHE BOOL "")

set(LLVM_BUILD_LLVM_DYLIB NO CACHE BOOL "")
set(LLVM_BUILD_LLVM_C_DYLIB NO CACHE BOOL "")
set(LLVM_ENABLE_LIBEDIT NO CACHE BOOL "")
set(LLVM_ENABLE_LIBXML2 YES CACHE BOOL "")
set(LLVM_ENABLE_OCAMLDOC NO CACHE BOOL "")
set(LLVM_ENABLE_TERMINFO NO CACHE BOOL "")
set(LLVM_ENABLE_Z3_SOLVER NO CACHE BOOL "")
set(LLVM_ENABLE_ZLIB NO CACHE BOOL "")
set(LLVM_INCLUDE_BENCHMARKS NO CACHE BOOL "")
set(LLVM_INCLUDE_DOCS NO CACHE BOOL "")
set(LLVM_INCLUDE_EXAMPLES NO CACHE BOOL "")
set(LLVM_INCLUDE_GO_TESTS NO CACHE BOOL "")
set(LLVM_INCLUDE_TESTS NO CACHE BOOL "")
set(LLVM_TOOL_GOLD_BUILD NO CACHE BOOL "")
set(LLVM_TOOL_LLVM_SHLIB_BUILD NO CACHE BOOL "")

set(CLANG_ENABLE_LIBXML2 NO CACHE BOOL "")
set(CLANG_INCLUDE_TESTS NO CACHE BOOL "")
set(LLD_INCLUDE_TESTS NO CACHE BOOL "")

set(SWIFT_INCLUDE_DOCS NO CACHE BOOL "")
set(SWIFT_BUILD_ENABLE_PARSER_LIB YES CACHE BOOL "")
set(SWIFT_BUILD_REMOTE_MIRROR NO CACHE BOOL "")
set(SWIFT_BUILD_SOURCEKIT NO CACHE BOOL "")
set(SWIFT_ENABLE_DISPATCH NO CACHE BOOL "")
set(SWIFT_BUILD_STDLIB_EXTRA_TOOLCHAIN_CONTENT NO CACHE BOOL "")
set(SWIFT_BUILD_STDLIB_CXX_MODULE NO CACHE BOOL "")
set(SWIFT_BUILD_STATIC_STDLIB NO CACHE BOOL "")
set(SWIFT_BUILD_STATIC_SDK_OVERLAY NO CACHE BOOL "")
set(SWIFT_ENABLE_SOURCEKIT_TESTS NO CACHE BOOL "")
set(SWIFT_INCLUDE_TESTS NO CACHE BOOL "")
set(SWIFT_INCLUDE_TEST_BINARIES NO CACHE BOOL "")

set(LLVM_INSTALL_BINUTILS_SYMLINKS NO CACHE BOOL "")
set(LLVM_INSTALL_TOOLCHAIN_ONLY YES CACHE BOOL "")

set(CLANG_TOOLS
clang
clang-resource-headers
clang-scan-deps
CACHE STRING "")
4 changes: 4 additions & 0 deletions cmake/caches/Windows-Bootstrap-Stage0-aarch64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include("${CMAKE_CURRENT_LIST_DIR}/Windows-Bootstrap-Stage0.cmake")

set(LLVM_DEFAULT_TARGET_TRIPLE aarch64-unknown-windows-msvc CACHE STRING "")
set(LLVM_TARGETS_TO_BUILD AArch64 CACHE STRING "")
4 changes: 4 additions & 0 deletions cmake/caches/Windows-Bootstrap-Stage0-x86_64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include("${CMAKE_CURRENT_LIST_DIR}/Windows-Bootstrap-Stage0.cmake")

set(LLVM_DEFAULT_TARGET_TRIPLE x86_64-unknown-windows-msvc CACHE STRING "")
set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "")
26 changes: 26 additions & 0 deletions cmake/caches/Windows-Bootstrap-Stage0.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
include("${CMAKE_CURRENT_LIST_DIR}/Windows-Bootstrap-Core.cmake")

set(LLVM_ENABLE_PROJECTS
clang
lld
CACHE STRING "")

set(LLVM_TOOLCHAIN_TOOLS "" CACHE STRING "")

set(LLD_TOOLS
lld
CACHE STRING "")

set(SWIFT_INSTALL_COMPONENTS
compiler
compiler-swift-syntax-lib
swift-syntax-lib
clang-builtin-headers
CACHE STRING "")

set(LLVM_DISTRIBUTION_COMPONENTS
${LLVM_TOOLCHAIN_TOOLS}
${CLANG_TOOLS}
${LLD_TOOLS}
${SWIFT_INSTALL_COMPONENTS}
CACHE STRING "")
3 changes: 3 additions & 0 deletions cmake/caches/Windows-Bootstrap-Stage1-aarch64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include("${CMAKE_CURRENT_LIST_DIR}/Windows-Bootstrap-Stage1.cmake")

set(LLVM_DEFAULT_TARGET_TRIPLE aarch64-unknown-windows-msvc CACHE STRING "")
3 changes: 3 additions & 0 deletions cmake/caches/Windows-Bootstrap-Stage1-x86_64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include("${CMAKE_CURRENT_LIST_DIR}/Windows-Bootstrap-Stage1.cmake")

set(LLVM_DEFAULT_TARGET_TRIPLE x86_64-unknown-windows-msvc CACHE STRING "")
32 changes: 32 additions & 0 deletions cmake/caches/Windows-Bootstrap-Stage1.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
include("${CMAKE_CURRENT_LIST_DIR}/Windows-Bootstrap-Core.cmake")

set(LLVM_ENABLE_PROJECTS
clang
lld
CACHE STRING "")

set(LLVM_TARGETS_TO_BUILD AArch64 ARM WebAssembly X86 CACHE STRING "")

set(LLVM_TOOLCHAIN_TOOLS
llvm-ar
llvm-ranlib
CACHE STRING "")

set(LLD_TOOLS
lld
CACHE STRING "")

set(SWIFT_INSTALL_COMPONENTS
autolink-driver
compiler
compiler-swift-syntax-lib
swift-syntax-lib
clang-builtin-headers
CACHE STRING "")

set(LLVM_DISTRIBUTION_COMPONENTS
${LLVM_TOOLCHAIN_TOOLS}
${CLANG_TOOLS}
${LLD_TOOLS}
${SWIFT_INSTALL_COMPONENTS}
CACHE STRING "")
Loading