Skip to content

Commit 2eaa806

Browse files
authored
Merge branch 'main' into maxd/bump-wasmkit
2 parents 669c328 + 778be22 commit 2eaa806

File tree

1,023 files changed

+22451
-10511
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,023 files changed

+22451
-10511
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ And the module structure to support such applications looks like this:
447447

448448
* [SE-0430][]:
449449

450-
Region Based Isolation is now extended to enable the application of an
450+
Region-Based Isolation is now extended to enable the application of an
451451
explicit `sending` annotation to function parameters and results. A function
452452
parameter or result that is annotated with `sending` is required to be
453453
disconnected at the function boundary and thus possesses the capability of
@@ -485,7 +485,7 @@ And the module structure to support such applications looks like this:
485485

486486
func useValue() {
487487
let x = NonSendableType()
488-
let a = await MyActor(x) // Error without Region Based Isolation!
488+
let a = await MyActor(x) // Error without Region-Based Isolation!
489489
}
490490
```
491491

CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,13 +1665,14 @@ if(SWIFT_ENABLE_NEW_RUNTIME_BUILD)
16651665

16661666
ExternalProject_Get_Property("${stdlib_target}-core" INSTALL_DIR)
16671667

1668-
ExternalProject_Add("${stdlib_target}-StringProcessing"
1669-
SOURCE_DIR
1670-
"${CMAKE_CURRENT_SOURCE_DIR}/Runtimes/Supplemental/StringProcessing"
1668+
ExternalProject_Add("${stdlib_target}-Supplemental"
1669+
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Runtimes/Supplemental"
16711670
DEPENDS "${stdlib_target}-core"
16721671
INSTALL_DIR "${INSTALL_DIR}"
1673-
INSTALL_COMMAND "" # No install story set up yet
1672+
INSTALL_COMMAND ""
1673+
LIST_SEPARATOR "|"
16741674
CMAKE_ARGS
1675+
-DSwift_ENABLE_RUNTIMES=StringProcessing
16751676
-DBUILD_SHARED_LIBS=YES
16761677
-DCMAKE_Swift_COMPILER_WORKS:BOOLEAN=YES
16771678
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
| **Universal Base Image 9** | x86_64 |[![Build Status](https://ci.swift.org/job/oss-swift-package-ubi-9/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-ubi-9)|
2121
| **Debian 12** | x86_64 |[![Build Status](https://ci.swift.org/job/oss-swift-package-debian-12/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-debian-12)|
2222
| **Debian 12** | AArch64 |[![Build Status](https://ci.swift.org/job/oss-swift-package-debian-12-aarch64/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-debian-12-aarch64)|
23-
| **Fedora 39** | x86_64 |[![Build Status](https://ci.swift.org/job/oss-swift-package-fedora-39/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-fedora-39)|
24-
| **Fedora 39** | AArch64 |[![Build Status](https://ci.swift.org/job/oss-swift-package-fedora-39-aarch64/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-fedora-39-aarch64)|
2523
| **Windows 10** | x86_64 |[![Build Status](https://ci-external.swift.org/job/swift-main-windows-toolchain/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/swift-main-windows-toolchain)|
2624
| **Windows 10** | ARM64 |[![Build Status](https://ci-external.swift.org/job/swift-main-windows-toolchain-arm64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/swift-main-windows-toolchain-arm64)|
2725

Runtimes/Core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ add_compile_definitions(
159159
$<$<BOOL:${SwiftCore_HAS_DARWIN_LIBMALLOC}>:-DSWIFT_STDLIB_HAS_DARWIN_LIBMALLOC> # Anything that includes include/swift/Runtime/Config.h
160160
$<$<COMPILE_LANGUAGE:C,CXX>:-DSWIFT_THREADING_${SwiftCore_THREADING_PACKAGE}>
161161
$<$<COMPILE_LANGUAGE:C,CXX>:-DSWIFT_RUNTIME_ENABLE_LEAK_CHECKER=$<BOOL:${SwiftCore_ENABLE_RUNTIME_LEAK_CHECKER}>>
162-
$<$<COMPILE_LANGUAGE:C,CXX>:-DSWIFT_RUNTIME_CLOBBER_FREED_OBJECTS=$<BOOL:${SwiftCore_ENABLE_CLOBBER_FREED_OBJECTS}>>)
162+
$<$<BOOL:${SwiftCore_ENABLE_CLOBBER_FREED_OBJECTS}>:-DSWIFT_RUNTIME_CLOBBER_FREED_OBJECTS>)
163163

164164
add_compile_options(
165165
$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>

Runtimes/Core/Concurrency/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ add_library(swift_Concurrency
8181
PartialAsyncTask.swift
8282
PlatformExecutorDarwin.swift
8383
PlatformExecutorLinux.swift
84+
PlatformExecutorFreeBSD.swift
85+
PlatformExecutorOpenBSD.swift
8486
PlatformExecutorWindows.swift
8587
PriorityQueue.swift
8688
SourceCompatibilityShims.swift
@@ -130,6 +132,10 @@ target_link_libraries(swift_Concurrency PRIVATE
130132
set_target_properties(swift_Concurrency PROPERTIES
131133
Swift_MODULE_NAME _Concurrency
132134
LINKER_LANGUAGE CXX)
135+
if(NOT BUILD_SHARED_LIBS AND CMAKE_STATIC_LIBRARY_PREFIX_Swift)
136+
set_target_properties(swift_Concurrency PROPERTIES
137+
PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX_Swift})
138+
endif()
133139

134140
install(TARGETS swift_Concurrency
135141
EXPORT SwiftCoreTargets

Runtimes/Core/core/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,10 @@ endif()
281281
set_target_properties(swiftCore PROPERTIES
282282
Swift_MODULE_NAME Swift
283283
LINKER_LANGUAGE CXX)
284+
if(NOT BUILD_SHARED_LIBS AND CMAKE_STATIC_LIBRARY_PREFIX_Swift)
285+
set_target_properties(swiftCore PROPERTIES
286+
PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX_Swift})
287+
endif()
284288

285289
target_compile_definitions(swiftCore
286290
PRIVATE
@@ -301,7 +305,8 @@ target_compile_options(swiftCore PRIVATE
301305
$<$<COMPILE_LANGUAGE:Swift>:-nostdimport>
302306
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -group-info-path -Xfrontend ${CMAKE_CURRENT_SOURCE_DIR}/GroupInfo.json>"
303307
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-objc-attr-requires-foundation-module>"
304-
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -require-explicit-availability=ignore>")
308+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -require-explicit-availability=ignore>"
309+
"$<$<AND:$<PLATFORM_ID:Darwin>,$<COMPILE_LANGUAGE:Swift>>:SHELL:-Xfrontend -previous-module-installname-map-file -Xfrontend ${CMAKE_CURRENT_SOURCE_DIR}/PreviousModuleInstallName.json>")
305310
if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel")
306311
# Using these in MinSizeRel would result in a 15% increase in the binary size
307312
target_compile_options(swiftCore PRIVATE
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
cmake_minimum_required(VERSION 3.29)
2+
3+
project(SwiftRuntime LANGUAGES Swift C CXX)
4+
5+
include(ExternalProject)
6+
include(GNUInstallDirs)
7+
8+
set(SwiftRuntime_SWIFTC_SOURCE_DIR "${PROJECT_SOURCE_DIR}/../../")
9+
10+
foreach(lib ${Swift_ENABLE_RUNTIMES})
11+
string(TOLOWER ${lib} name)
12+
set(SwiftRuntime_ENABLE_${name} YES)
13+
endforeach()
14+
15+
if(SwiftCore_DIR)
16+
set(SwiftCore_DIR_FLAG "-DSwiftCore_DIR=${SwiftCore_DIR}")
17+
endif()
18+
19+
if(CMAKE_MAKE_PROGRAM)
20+
set(MAKE_PROGRAM_FLAG "-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}")
21+
endif()
22+
23+
set(COMMON_OPTIONS
24+
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
25+
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
26+
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
27+
-DCMAKE_INSTALL_NAME_DIR=${CMAKE_INSTALL_NAME_DIR}
28+
-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=${CMAKE_BUILD_WITH_INSTALL_NAME_DIR}
29+
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
30+
-DCMAKE_COLOR_DIAGNOSTICS=${CMAKE_COLOR_DIAGNOSTICS}
31+
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
32+
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
33+
-DCMAKE_Swift_COMPILER=${CMAKE_Swift_COMPILER}
34+
-DCMAKE_C_COMPILER_TARGET=${CMAKE_C_COMPILER_TARGET}
35+
-DCMAKE_CXX_COMPILER_TARGET=${CMAKE_CXX_COMPILER_TARGET}
36+
-DCMAKE_Swift_COMPILER_TARGET=${CMAKE_Swift_COMPILER_TARGET}
37+
${SwiftCore_DIR_FLAG}
38+
${MAKE_PROGRAM_FLAG})
39+
40+
# StringProcessing
41+
if(SwiftRuntime_ENABLE_stringprocessing)
42+
ExternalProject_Add(StringProcessing
43+
PREFIX "StringProcessing"
44+
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/StringProcessing"
45+
INSTALL_DIR "${CMAKE_INSTALL_PREFIX}"
46+
INSTALL_COMMAND ""
47+
CMAKE_ARGS
48+
${COMMON_OPTIONS})
49+
endif()

Runtimes/Supplemental/Readme.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Swift Supplemental Libraries
2+
3+
The supplemental libraries are all libraries that are not one of the Core or
4+
overlay libraries. Each supplemental library builds as an independent project.
5+
6+
The supplemental libraries are:
7+
- CxxInterop
8+
- Differentiation
9+
- Distributed
10+
- Observation
11+
- StringProcessing
12+
- Runtime
13+
- Synchronization
14+
15+
The top-level Supplemental CMakeLists supplies a super-build pattern for
16+
configuring and compiling each of the supplemental library projects through a
17+
single CMake invocation. The `Swift_ENABLE_RUNTIMES` CMake option enables the
18+
specified supplemental libraries. All libraries configured this way are built
19+
with the same compilers, against the same sysroot, with the same target triple
20+
and installed into the same location.
21+
22+
## Super-Build
23+
24+
Configuring each project independently is tedious. The Supplemental directory
25+
contains a Super-Build CMakeLists that invokes the build of each of the
26+
supplemental libraries in the appropriate order, simplifying the process of
27+
building each library.
28+
29+
Important configuration variables:
30+
- `Swift_ENABLE_RUNTIMES`: Used to configure which runtime libraries are built.
31+
32+
The super-build forwards the following variables to each sub-project
33+
unconditionally:
34+
- `BUILD_SHARED_LIBS`
35+
- `CMAKE_BUILD_TYPE`
36+
- `CMAKE_INSTALL_PREFIX`
37+
- `CMAKE_COLOR_DIAGNOSTICS`
38+
- `CMAKE_C_COMPILER`
39+
- `CMAKE_C_COMPILER_TARGET`
40+
- `CMAKE_CXX_COMPILER`
41+
- `CMAKE_CXX_COMPILER_TARGET`
42+
- `CMAKE_Swift_COMPILER`
43+
- `CMAKE_Swift_COMPILER_TARGET`
44+
45+
If set, the super-build forwards the following values to each sub-project:
46+
47+
- `SwiftCore_DIR`: Path to the SwiftCore build directory
48+
- `CMAKE_MAKE_PROGRAM`: Path to `ninja`
49+
50+
The super-build is for convenience. If more fine-grained control is desired for
51+
configuring a specific runtime library, you may configure that library
52+
independently.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Add flags for generating the zippered target variant in the build
2+
3+
# Initialize `${PROJECT_NAME}_VARIANT_MODULE_TRIPLE` if the driver is able to emit
4+
# modules for the target variant.
5+
6+
if(${PROJECT_NAME}_COMPILER_VARIANT_TARGET)
7+
add_compile_options(
8+
"$<$<COMPILE_LANGUAGE:C,CXX>:SHELL:-darwin-target-variant ${${PROJECT_NAME}_COMPILER_VARIANT_TARGET}>"
9+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-target-variant ${${PROJECT_NAME}_COMPILER_VARIANT_TARGET}>"
10+
11+
# TODO: Remove me once we have a driver with
12+
# https://github.com/swiftlang/swift-driver/pull/1803
13+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xclang-linker -darwin-target-variant -Xclang-linker ${${PROJECT_NAME}_COMPILER_VARIANT_TARGET}>")
14+
15+
add_link_options(
16+
"$<$<LINK_LANGUAGE:C,CXX>:SHELL:-darwin-target-variant ${${PROJECT_NAME}_COMPILER_VARIANT_TARGET}>"
17+
"$<$<LINK_LANGUAGE:Swift>:SHELL:-target-variant ${${PROJECT_NAME}_COMPILER_VARIANT_TARGET}>"
18+
19+
# TODO: Remove me once we have a driver with
20+
# https://github.com/swiftlang/swift-driver/pull/1803
21+
"$<$<LINK_LANGUAGE:Swift>:SHELL:-Xclang-linker -darwin-target-variant -Xclang-linker ${${PROJECT_NAME}_COMPILER_VARIANT_TARGET}>")
22+
23+
# TODO: Once we are guaranteed to have a driver with the variant module path
24+
# support everywhere, we should integrate this into PlatformInfo.cmake
25+
check_compiler_flag(Swift "-emit-variant-module-path ${CMAKE_CURRENT_BINARY_DIR}/CompilerID/variant.swiftmodule" HAVE_Swift_VARIANT_MODULE_PATH_FLAG)
26+
if(HAVE_Swift_VARIANT_MODULE_PATH_FLAG)
27+
# Get variant module triple
28+
set(module_triple_command "${CMAKE_Swift_COMPILER}" -print-target-info -target ${${PROJECT_NAME}_COMPILER_VARIANT_TARGET})
29+
execute_process(COMMAND ${module_triple_command} OUTPUT_VARIABLE target_info_json)
30+
message(CONFIGURE_LOG "Swift target variant info: ${target_info_json}")
31+
32+
33+
string(JSON module_triple GET "${target_info_json}" "target" "moduleTriple")
34+
set(${PROJECT_NAME}_VARIANT_MODULE_TRIPLE "${module_triple}" CACHE STRING "Triple used for installed swift{module,interface} files for the target variant")
35+
mark_as_advanced(${PROJECT_NAME}_VARIANT_MODULE_TRIPLE)
36+
message(CONFIGURE_LOG "Swift target variant module triple: ${module_triple}")
37+
endif()
38+
endif()
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Generate and install swift interface files
2+
3+
# TODO: CMake should learn how to model library evolution and generate this
4+
# stuff automatically.
5+
6+
7+
# Generate a swift interface file for the target if library evolution is enabled
8+
function(emit_swift_interface target)
9+
# Generate the target-variant binary swift module when performing zippered
10+
# build
11+
if(${PROJECT_NAME}_VARIANT_MODULE_TRIPLE)
12+
set(variant_module_tmp_dir "${CMAKE_CURRENT_BINARY_DIR}/${target}-${${PROJECT_NAME}_VARIANT_MODULE_TRIPLE}")
13+
file(MAKE_DIRECTORY "${variant_module_tmp_dir}")
14+
target_compile_options(${target} PRIVATE
15+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-emit-variant-module-path ${variant_module_tmp_dir}/${target}.swiftmodule>")
16+
endif()
17+
18+
# Generate textual swift interfaces is library-evolution is enabled
19+
if(${PROJECT_NAME}_ENABLE_LIBRARY_EVOLUTION)
20+
target_compile_options(${target} PRIVATE
21+
$<$<COMPILE_LANGUAGE:Swift>:-emit-module-interface-path$<SEMICOLON>${CMAKE_CURRENT_BINARY_DIR}/$<TARGET_PROPERTY:${target},Swift_MODULE_NAME>.swiftinterface>
22+
$<$<COMPILE_LANGUAGE:Swift>:-emit-private-module-interface-path$<SEMICOLON>${CMAKE_CURRENT_BINARY_DIR}/$<TARGET_PROPERTY:${target},Swift_MODULE_NAME>.private.swiftinterface>
23+
$<$<COMPILE_LANGUAGE:Swift>:-library-level$<SEMICOLON>api>
24+
$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend$<SEMICOLON>-require-explicit-availability=ignore>)
25+
26+
# Emit catalyst swiftmodules and interfaces
27+
if(${PROJECT_NAME}_VARIANT_MODULE_TRIPLE)
28+
target_compile_options(${target} PRIVATE
29+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-emit-variant-module-interface-path ${variant_module_tmp_dir}/${target}.swiftinterface>"
30+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-emit-variant-private-module-interface-path ${variant_module_tmp_dir}/${target}.private.swiftinterface>")
31+
endif()
32+
endif()
33+
endfunction()
34+
35+
# Install the generated swift interface file for the target if library evolution
36+
# is enabled.
37+
function(install_swift_interface target)
38+
# Install binary swift modules
39+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/$<TARGET_PROPERTY:${target},Swift_MODULE_NAME>.swiftmodule"
40+
RENAME "${${PROJECT_NAME}_MODULE_TRIPLE}.swiftmodule"
41+
DESTINATION "${${PROJECT_NAME}_INSTALL_SWIFTMODULEDIR}/$<TARGET_PROPERTY:${target},Swift_MODULE_NAME>.swiftmodule"
42+
COMPONENT ${PROJECT_NAME}_development)
43+
if(${PROJECT_NAME}_VARIANT_MODULE_TRIPLE)
44+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${target}-${${PROJECT_NAME}_VARIANT_MODULE_TRIPLE}/${target}.swiftmodule"
45+
RENAME "${${PROJECT_NAME}_VARIANT_MODULE_TRIPLE}.swiftmodule"
46+
DESTINATION "${${PROJECT_NAME}_INSTALL_SWIFTMODULEDIR}/$<TARGET_PROPERTY:${target},Swift_MODULE_NAME>.swiftmodule"
47+
COMPONENT ${PROJECT_NAME}_development)
48+
endif()
49+
50+
# Install Swift interfaces if library-evolution is enabled
51+
if(${PROJECT_NAME}_ENABLE_LIBRARY_EVOLUTION)
52+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/$<TARGET_PROPERTY:${target},Swift_MODULE_NAME>.swiftinterface"
53+
RENAME "${${PROJECT_NAME}_MODULE_TRIPLE}.swiftinterface"
54+
DESTINATION "${${PROJECT_NAME}_INSTALL_SWIFTMODULEDIR}/$<TARGET_PROPERTY:${target},Swift_MODULE_NAME>.swiftmodule"
55+
COMPONENT ${PROJECT_NAME}_development)
56+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/$<TARGET_PROPERTY:${target},Swift_MODULE_NAME>.private.swiftinterface"
57+
RENAME "${${PROJECT_NAME}_MODULE_TRIPLE}.private.swiftinterface"
58+
DESTINATION "${${PROJECT_NAME}_INSTALL_SWIFTMODULEDIR}/$<TARGET_PROPERTY:${target},Swift_MODULE_NAME>.swiftmodule"
59+
COMPONENT ${PROJECT_NAME}_development)
60+
61+
# Install catalyst interface files
62+
if(${PROJECT_NAME}_VARIANT_MODULE_TRIPLE)
63+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${target}-${${PROJECT_NAME}_VARIANT_MODULE_TRIPLE}/${target}.swiftinterface"
64+
RENAME "${${PROJECT_NAME}_VARIANT_MODULE_TRIPLE}.swiftinterface"
65+
DESTINATION "${${PROJECT_NAME}_INSTALL_SWIFTMODULEDIR}/$<TARGET_PROPERTY:${target},Swift_MODULE_NAME>.swiftmodule"
66+
COMPONENT ${PROJECT_NAME}_development)
67+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${target}-${${PROJECT_NAME}_VARIANT_MODULE_TRIPLE}/${target}.private.swiftinterface"
68+
RENAME "${${PROJECT_NAME}_VARIANT_MODULE_TRIPLE}.private.swiftinterface"
69+
DESTINATION "${${PROJECT_NAME}_INSTALL_SWIFTMODULEDIR}/$<TARGET_PROPERTY:${target},Swift_MODULE_NAME>.swiftmodule"
70+
COMPONENT ${PROJECT_NAME}_development)
71+
endif()
72+
endif()
73+
endfunction()

0 commit comments

Comments
 (0)