Skip to content

Commit f3f3ab8

Browse files
committed
Merge branch 'main' into issue75776
2 parents fe14b4f + e6b4e0f commit f3f3ab8

File tree

1,830 files changed

+49353
-15599
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,830 files changed

+49353
-15599
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,15 @@
261261

262262
# utils
263263
/utils/*windows* @compnerd
264+
/utils/generate-xcode @hamishknight
264265
/utils/gyb_sourcekit_support/ @ahoppen @bnbarham @hamishknight @rintaro
265266
/utils/sourcekit_fuzzer/ @ahoppen @bnbarham @hamishknight @rintaro
266267
/utils/swift_build_support/products/earlyswiftsyntax.py @ahoppen @bnbarham @hamishknight @rintaro
267268
/utils/swift_build_support/products/skstresstester.py @ahoppen @bnbarham @hamishknight @rintaro
268269
/utils/swift_build_support/products/sourcekitlsp.py @ahoppen @bnbarham @hamishknight @rintaro
269270
/utils/swift_build_support/products/swiftformat.py @ahoppen @allevato @bnbarham @hamishknight @rintaro
270271
/utils/swift_build_support/products/swiftsyntax.py @ahoppen @bnbarham @hamishknight @rintaro
272+
/utils/swift-xcodegen/ @hamishknight
271273
/utils/update-checkout* @shahmishal
272274
/utils/update_checkout/ @shahmishal
273275
/utils/vim/ @compnerd

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,20 @@ SortedCFDatabase.def
7878
htmlcov
7979
.coverage
8080
/benchmark/scripts/Benchmark_Driverc
81+
82+
#==============================================================================#
83+
# Ignore copied Swift Stdlib files while migrating stdlib
84+
#==============================================================================#
85+
Runtimes/**/*.swift
86+
Runtimes/**/*.h
87+
Runtimes/**/*.cpp
88+
Runtimes/**/*.c
89+
Runtimes/**/*.m
90+
Runtimes/**/*.mm
91+
Runtimes/**/*.def
92+
Runtimes/**/*.gyb
93+
Runtimes/**/*.apinotes
94+
Runtimes/**/*.yaml
95+
Runtimes/**/*.inc
96+
Runtimes/**/*.json
97+
Runtimes/**/*.modulemap

CMakeLists.txt

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,10 @@ option(SWIFT_ENABLE_EXPERIMENTAL_PARSER_VALIDATION
747747
"Enable experimental SwiftParser validation by default"
748748
FALSE)
749749

750+
option(SWIFT_ENABLE_EXPERIMENTAL_POINTER_BOUNDS
751+
"Enable experimental safe wrappers around external functions"
752+
FALSE)
753+
750754
cmake_dependent_option(SWIFT_BUILD_SOURCEKIT
751755
"Build SourceKit" TRUE
752756
"SWIFT_ENABLE_DISPATCH" FALSE)
@@ -1399,6 +1403,7 @@ if(SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
13991403
message(STATUS "Observation Support: ${SWIFT_ENABLE_EXPERIMENTAL_OBSERVATION}")
14001404
message(STATUS "Synchronization Support: ${SWIFT_ENABLE_SYNCHRONIZATION}")
14011405
message(STATUS "Volatile Support: ${SWIFT_ENABLE_VOLATILE}")
1406+
message(STATUS "Pointer Bounds Support: ${SWIFT_ENABLE_EXPERIMENTAL_POINTER_BOUNDS}")
14021407
message(STATUS "")
14031408
else()
14041409
message(STATUS "Not building Swift standard library, SDK overlays, and runtime")
@@ -1466,6 +1471,10 @@ if(SWIFT_ENABLE_DISPATCH)
14661471
endif()
14671472

14681473
# Add all of the subdirectories, where we actually do work.
1474+
add_subdirectory(include)
1475+
if(SWIFT_INCLUDE_TOOLS)
1476+
add_subdirectory(lib)
1477+
endif()
14691478

14701479
###############
14711480
# PLEASE READ #
@@ -1518,11 +1527,7 @@ if(SWIFT_INCLUDE_APINOTES)
15181527
add_subdirectory(apinotes)
15191528
endif()
15201529

1521-
add_subdirectory(include)
1522-
15231530
if(SWIFT_INCLUDE_TOOLS)
1524-
add_subdirectory(lib)
1525-
15261531
add_subdirectory(SwiftCompilerSources)
15271532

15281533
# Always include this after including stdlib/!
@@ -1579,3 +1584,48 @@ if(XCODE)
15791584
add_custom_target(Miscellaneous
15801585
SOURCES ${SWIFT_TOPLEVEL_HEADERS})
15811586
endif()
1587+
1588+
# New standard library build
1589+
option(SWIFT_ENABLE_NEW_RUNTIME_BUILD "Build Swift runtimes with new build system" OFF)
1590+
if(SWIFT_ENABLE_NEW_RUNTIME_BUILD)
1591+
1592+
add_custom_target(PopulateRuntimeSourceDir
1593+
COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_SOURCE_DIR}/Runtimes/Resync.cmake"
1594+
COMMENT "Copying sources into new runtime build")
1595+
1596+
foreach(sdk ${SWIFT_SDKS})
1597+
foreach(arch ${SWIFT_SDK_${sdk}_ARCHITECTURES})
1598+
# Provide a mechanism to skip building one of these runtimes
1599+
if(SWIFT_SKIP_${sdk}_${arch}_RUNTIME)
1600+
message(STATUS "Skipping: ${arch}-${sdk} runtime build")
1601+
continue()
1602+
endif()
1603+
set(stdlib_target "swift-stdlib-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}")
1604+
if(${SWIFT_SDK_${sdk}_${arch}_CACHE})
1605+
set(stdlib_cache_file_flag -C ${SWIFT_SDK_${sdk}_${arch}_CACHE})
1606+
endif()
1607+
ExternalProject_Add("${stdlib_target}-core"
1608+
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Runtimes/Core"
1609+
# TODO: Add this once we're ready to start swapping out the libraries
1610+
# for testing
1611+
# INSTALL_DIR "${CMAKE_BINARY_DIR}/"
1612+
1613+
DEPENDS PopulateRuntimeSourceDir
1614+
CMAKE_ARGS
1615+
-DCMAKE_INSTALL_LIBDIR:FILEPATH=lib/swift/${SWIFT_SDK_${sdk}_LIB_SUBDIR}/${arch}
1616+
# Compiler will see mismatched swift modules and fail initial checks
1617+
-DCMAKE_Swift_COMPILER_WORKS:BOOLEAN=YES
1618+
-DBUILD_SHARED_LIBS:BOOLEAN=YES # TODO: Make this configurable
1619+
${stdlib_cache_file_flag}
1620+
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
1621+
-DCMAKE_INSTALL_PREFIX:FILEPATH=<INSTALL_DIR>
1622+
-DCMAKE_Swift_COMPILER:FILEPATH=$<IF:$<BOOL:${CMAKE_CROSSCOMPILING}>,${CMAKE_Swift_COMPILER},$<PATH:REPLACE_FILENAME,$<TARGET_FILE:swift-frontend>,swiftc>>
1623+
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
1624+
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
1625+
-DCMAKE_COLOR_DIAGNOSTICS:BOOLEAN=${CMAKE_COLOR_DIAGNOSTICS})
1626+
if(NOT ${CMAKE_CROSSCOMPILING})
1627+
add_dependencies("${stdlib_target}" swift-frontend)
1628+
endif()
1629+
endforeach()
1630+
endforeach()
1631+
endif()

Runtimes/Core/CMakeLists.txt

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# Notes:
2+
#
3+
# The Demangling library uses `#if SWIFT_HAVE_CRASHREPORTERCLIENT` while the
4+
# runtime library uses `#ifdef SWIFT_HAVE_CRASHREPORTERCLIENT` to toggle that
5+
# functionality. When building the demangling library, the macro should be set
6+
# to 0 or 1 to indicate the presence of the crashreporter.
7+
# When building the runtime library, the existence of the macro indicates the
8+
# presence of the crashreporter.
9+
#
10+
# Runtime library pulls sources and headers from compiler sources (ThreadSanitizer)
11+
# Demangling library pulls sources and headers from compiler sources (all)
12+
#
13+
#
14+
# gyb pulls sources from compiler sources
15+
#
16+
# Stubs:
17+
# Pulls in headers from compiler
18+
# - include/swift/Basic
19+
# - include/swift/Runtime
20+
# - include/swift/Threading
21+
22+
# TODO:
23+
# Platform support:
24+
# - Work on/Verify cross-compiling
25+
# - Work on/Verify Windows and Linux native builds
26+
# Embedded
27+
# -- -Xfrontend -emit-empty-object-file
28+
# Catalyst Support
29+
# -- Will need shadow invocations to generate swiftmodules for Swift parts
30+
# Install *.abi.json, swiftdoc, and swiftsourceinfo
31+
# Pointer bounds (SWIFT_ENABLE_EXPERIMENTAL_POINTER_BOUNDS)
32+
33+
cmake_minimum_required(VERSION 3.26...3.29)
34+
35+
set(CMAKE_C_VISIBILITY_PRESET "hidden")
36+
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
37+
38+
set(SwiftCore_CMAKE_MODULES_DIR "${CMAKE_SOURCE_DIR}/cmake/modules")
39+
list(APPEND CMAKE_MODULE_PATH ${SwiftCore_CMAKE_MODULES_DIR})
40+
41+
include(CMakeWorkarounds)
42+
project(SwiftCore LANGUAGES C CXX Swift VERSION 6.1)
43+
44+
# The Swift standard library is not intended for use as a sub-library as part of
45+
# another project. It is tightly coupled with the compiler version.
46+
if(NOT PROJECT_IS_TOP_LEVEL)
47+
message(FATAL_ERROR "Swift Core must build as a standalone project")
48+
endif()
49+
50+
# FIXME: We should not need to refer back into the compiler sources. This is
51+
# needed by gyb, Demangling, Threading, the runtime (ThreadSanitizer.cpp)
52+
set(SwiftCore_SWIFTC_SOURCE_DIR
53+
"${PROJECT_SOURCE_DIR}/../../"
54+
CACHE FILEPATH "Path to the root source directory of the Swift compiler")
55+
56+
# Hook point for vendor-specific extensions to the build system
57+
# Allowed extension points:
58+
# - DefaultSettings.cmake
59+
# - Settings.cmake
60+
set(SwiftCore_VENDOR_MODULE_DIR "${SwiftCore_CMAKE_MODULES_DIR}/vendor"
61+
CACHE FILEPATH "Location for private build system extension")
62+
63+
include(GNUInstallDirs)
64+
include(AvailabilityMacros)
65+
include(CompilerSettings)
66+
include(DefaultSettings)
67+
include(EmitSwiftInterface)
68+
include(PlatformInfo)
69+
include(gyb)
70+
71+
include("${SwiftCore_VENDOR_MODULE_DIR}/Settings.cmake" OPTIONAL)
72+
73+
defaulted_option(SwiftCore_ENABLE_LIBRARY_EVOLUTION "Generate ABI resilient runtime libraries")
74+
75+
defaulted_option(SwiftCore_ENABLE_CRASH_REPORTER_CLIENT "Enable Apple CrashReporter integration")
76+
defaulted_option(SwiftCore_ENABLE_OBJC_INTEROP "Enable runtime ObjC interop")
77+
defaulted_option(SwiftCore_ENABLE_TYPE_PRINTING "Enable printing type names")
78+
defaulted_option(SwiftCore_ENABLE_VECTOR_TYPES "Enable vector support")
79+
defaulted_option(SwiftCore_ENABLE_REFLECTION "Enable runtime support for mirrors and reflection support")
80+
defaulted_option(SwiftCore_ENABLE_COMMANDLINE_SUPPORT "Enable command line argument support")
81+
defaulted_option(SwiftCore_ENABLE_RUNTIME_FUNCTION_COUNTERS "Enable runtime function counter support")
82+
defaulted_option(SwiftCore_ENABLE_STDIN "Enable functions that use stdin support")
83+
defaulted_option(SwiftCore_ENABLE_ENVIRONMENT "Enable environment variable support")
84+
defaulted_option(SwiftCore_ENABLE_OVERRIDABLE_RETAIN_RELEASE "Enable override hooks for retain/release")
85+
defaulted_option(SwiftCore_ENABLE_MALLOC_TYPE "Enable malloc type information")
86+
defaulted_option(SwiftCore_ENABLE_RUNTIME_OS_VERSIONING "Enable runtime OS version detection")
87+
defaulted_option(SwiftCore_ENABLE_STATIC_PRINT "Disable full print")
88+
defaulted_option(SwiftCore_ENABLE_UNICODE_DATA "Embed Unicode info in Swift Core")
89+
defaulted_option(SwiftCore_ENABLE_COMPACT_ABSOLUTE_FUNCTION_POINTERS "Resolve absolute function pointer as identity")
90+
defaulted_option(SwiftCore_ENABLE_BACKDEPLOYMENT_SUPPORT "Add symbols for runtime backdeployment")
91+
92+
defaulted_option(SwiftCore_ENABLE_BACKTRACING "Enable backtracing runtime support")
93+
defaulted_set(SwiftCore_BACKTRACER_PATH STRING "Set a fixed path to the Swift backtracer")
94+
95+
option(SwiftCore_ENABLE_CLOBBER_FREED_OBJECTS "" OFF)
96+
option(SwiftCore_ENABLE_RUNTIME_LEAK_CHECKER "" OFF)
97+
option(SwiftCore_ENABLE_INTERNAL_CHECKS "" OFF)
98+
99+
defaulted_set(SwiftCore_OBJECT_FORMAT STRING "Object format: ELF COFF")
100+
101+
# TODO: Most of these should be attached to specific targets rather than applied
102+
# globally. They can be applied as part of the library interface if they
103+
# affect the behavior of libraries that build against a given target.
104+
add_compile_definitions(
105+
$<$<BOOL:${SwiftCore_ENABLE_OBJC_INTEROP}>:-DSWIFT_OBJC_INTEROP>
106+
$<$<BOOL:${SwiftCore_ENABLE_LIBRARY_EVOLUTION}>:-DSWIFT_LIBRARY_EVOLUTION>
107+
$<$<BOOL:${SwiftCore_ENABLE_CRASH_REPORTER_CLIENT}>:-DSWIFT_HAVE_CRASHREPORTERCLIENT>
108+
$<$<BOOL:${SwiftCore_ENABLE_VECTOR_TYPES}>:-DSWIFT_STDLIB_ENABLE_VECTOR_TYPES>
109+
$<$<BOOL:${SwiftCore_ENABLE_REFLECTION}>:-DSWIFT_ENABLE_REFLECTION>
110+
$<$<BOOL:${SwiftCore_ENABLE_RUNTIME_FUNCTION_COUNTERS}>:-DSWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS>
111+
$<$<BOOL:${SwiftCore_ENABLE_STDIN}>:-DSWIFT_STDLIB_HAS_STDIN> # core + stubs
112+
$<$<BOOL:${SwiftCore_ENABLE_RUNTIME_OS_VERSIONING}>:-DSWIFT_RUNTIME_OS_VERSIONING> # core + stubs
113+
$<$<BOOL:${SwiftCore_ENABLE_INTERNAL_CHECKS}>:-DINTERNAL_CHECKS_ENABLED> # core
114+
$<$<BOOL:${SwiftCore_ENABLE_STATIC_PRINT}>:-DSWIFT_STDLIB_STATIC_PRINT> # core + concurrency
115+
$<$<BOOL:${SwiftCore_ENABLE_UNICODE_DATA}>:-DSWIFT_STDLIB_ENABLE_UNICODE_DATA> # Stubs
116+
$<$<BOOL:${SwiftCore_ENABLE_ENVIRONMENT}>:-DSWIFT_STDLIB_HAS_ENVIRON> # Concurrency, runtime, shims, platform overlay
117+
$<$<BOOL:${SwiftCore_ENABLE_BACKDEPLOYMENT_SUPPORT}>:-DSWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT> # Concurrency, Compatibility override, magic symbols
118+
$<$<COMPILE_LANGUAGE:C,CXX>:-DSWIFT_RUNTIME_ENABLE_LEAK_CHECKER=$<BOOL:${SwiftCore_ENABLE_RUNTIME_LEAK_CHECKER}>>
119+
$<$<COMPILE_LANGUAGE:C,CXX>:-DSWIFT_RUNTIME_CLOBBER_FREED_OBJECTS=$<BOOL:${SwiftCore_ENABLE_CLOBBER_FREED_OBJECTS}>>)
120+
121+
add_compile_options(
122+
$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>
123+
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>
124+
$<$<COMPILE_LANGUAGE:CXX>:-funwind-tables>
125+
$<$<AND:$<COMPILE_LANGUAGE:Swift>,$<BOOL:${SwiftCore_ENABLE_LIBRARY_EVOLUTION}>>:-enable-library-evolution>)
126+
127+
include_directories(include)
128+
129+
add_subdirectory(LLVMSupport)
130+
add_subdirectory(SwiftShims/swift/shims)
131+
add_subdirectory(Demangling)
132+
add_subdirectory(Threading)
133+
add_subdirectory(runtime)
134+
add_subdirectory(stubs)
135+
add_subdirectory(CommandLineSupport)
136+
add_subdirectory(core)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
if(SwiftCore_ENABLE_COMMANDLINE_SUPPORT)
2+
add_library(swiftCommandLineSupport STATIC CommandLine.cpp)
3+
target_include_directories(swiftCommandLineSupport PRIVATE
4+
"${SwiftCore_SWIFTC_SOURCE_DIR}/include"
5+
"${PROJECT_BINARY_DIR}/include")
6+
target_compile_definitions(swiftCommandLineSupport PUBLIC
7+
-DSWIFT_STDLIB_HAS_COMMANDLINE)
8+
9+
target_link_libraries(swiftCommandLineSupport PRIVATE
10+
swiftShims)
11+
12+
if(NOT BUILD_SHARED_LIBS)
13+
install(TARGETS swiftCommandLineSupport)
14+
endif()
15+
endif()
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# FIXME: Refactor demangling library so that we aren't pulling sources from
2+
# the compiler.
3+
add_library(swiftDemangling OBJECT
4+
"${SwiftCore_SWIFTC_SOURCE_DIR}/lib/Demangling/Context.cpp"
5+
"${SwiftCore_SWIFTC_SOURCE_DIR}/lib/Demangling/Demangler.cpp"
6+
"${SwiftCore_SWIFTC_SOURCE_DIR}/lib/Demangling/ManglingUtils.cpp"
7+
"${SwiftCore_SWIFTC_SOURCE_DIR}/lib/Demangling/NodePrinter.cpp"
8+
"${SwiftCore_SWIFTC_SOURCE_DIR}/lib/Demangling/Punycode.cpp"
9+
"${SwiftCore_SWIFTC_SOURCE_DIR}/lib/Demangling/Remangler.cpp"
10+
"${SwiftCore_SWIFTC_SOURCE_DIR}/lib/Demangling/NodeDumper.cpp"
11+
"${SwiftCore_SWIFTC_SOURCE_DIR}/lib/Demangling/Errors.cpp")
12+
target_compile_definitions(swiftDemangling PRIVATE swiftCore_EXPORTS
13+
$<$<BOOL:${SwiftCore_ENABLE_OBJC_INTEROP}>:-DSWIFT_SUPPORT_OLD_MANGLING>
14+
$<$<BOOL:${SwiftCore_ENABLE_TYPE_PRINTING}>:-DSWIFT_STDLIB_HAS_TYPE_PRINTING>
15+
$<$<BOOL:${SwiftCore_ENABLE_CRASH_REPORTER_CLIENT}>:-DSWIFT_HAVE_CRASHREPORTERCLIENT>)
16+
17+
target_include_directories(swiftDemangling
18+
PRIVATE
19+
"${SwiftCore_SWIFTC_SOURCE_DIR}/include"
20+
"${PROJECT_BINARY_DIR}/include")
21+
22+
target_link_libraries(swiftDemangling PRIVATE swiftShims)
23+
24+
if(SwiftCore_ENABLE_CRASH_REPORTER_CLIENT)
25+
# We could likely pull the copy from the runtime sources
26+
add_library(swiftDemanglingCR OBJECT
27+
"${SwiftCore_SWIFTC_SOURCE_DIR}/lib/Demangling/CrashReporter.cpp")
28+
target_link_libraries(swiftDemanglingCR PRIVATE swiftShims)
29+
endif()
30+
31+
if(SwiftCore_ENABLE_OBJC_INTEROP)
32+
target_sources(swiftDemangling PRIVATE
33+
"${SwiftCore_SWIFTC_SOURCE_DIR}/lib/Demangling/OldDemangler.cpp"
34+
"${SwiftCore_SWIFTC_SOURCE_DIR}/lib/Demangling/OldRemangler.cpp")
35+
endif()
36+
37+
if(LINUX OR BSD)
38+
target_compile_options(swiftDemangling PRIVATE -fno-lto)
39+
endif()
40+
41+
if(NOT BUILD_SHARED_LIBS)
42+
install(TARGETS swiftDemangling)
43+
endif()
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
add_library(swiftLLVMSupport OBJECT
2+
ErrorHandling.cpp
3+
Hashing.cpp
4+
MemAlloc.cpp
5+
SmallPtrSet.cpp
6+
SmallVector.cpp
7+
StringRef.cpp)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Swift shim header files
2+
install(FILES
3+
AssertionReporting.h
4+
CoreFoundationShims.h
5+
EmbeddedShims.h
6+
FoundationShims.h
7+
GlobalObjects.h
8+
HeapObject.h
9+
KeyPath.h
10+
LibcOverlayShims.h
11+
LibcShims.h
12+
MetadataSections.h
13+
Random.h
14+
RefCount.h
15+
Reflection.h
16+
RuntimeShims.h
17+
RuntimeStubs.h
18+
SwiftStdbool.h
19+
SwiftStddef.h
20+
SwiftStdint.h
21+
System.h
22+
Target.h
23+
ThreadLocalStorage.h
24+
UnicodeData.h
25+
Visibility.h
26+
_SwiftConcurrency.h
27+
_SwiftDistributed.h
28+
_SynchronizationShims.h
29+
module.modulemap
30+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/swift/shims")
31+
32+
add_library(swiftShims INTERFACE)
33+
target_include_directories(swiftShims INTERFACE
34+
$<$<COMPILE_LANGUAGE:C,CXX>:${CMAKE_CURRENT_SOURCE_DIR}/../../>
35+
$<$<COMPILE_LANGUAGE:Swift>:${CMAKE_CURRENT_SOURCE_DIR}>)
36+
target_compile_options(swiftShims INTERFACE
37+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xcc -fmodule-map-file=${CMAKE_CURRENT_SOURCE_DIR}/module.modulemap>")
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# TODO: I think we can build the one that actually matters based on the
2+
# platform we're building, rather than relying just on macro definitions
3+
# and linking empty objects.
4+
# https://github.com/swiftlang/swift/issues/77435
5+
add_library(swiftThreading OBJECT
6+
"${SwiftCore_SWIFTC_SOURCE_DIR}/lib/Threading/C11.cpp"
7+
"${SwiftCore_SWIFTC_SOURCE_DIR}/lib/Threading/Linux.cpp"
8+
"${SwiftCore_SWIFTC_SOURCE_DIR}/lib/Threading/Pthreads.cpp"
9+
"${SwiftCore_SWIFTC_SOURCE_DIR}/lib/Threading/Win32.cpp")
10+
target_link_libraries(swiftThreading PRIVATE swiftShims)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
file(STRINGS "${SwiftCore_SWIFTC_SOURCE_DIR}/utils/availability-macros.def" availability_defs)
2+
list(FILTER availability_defs EXCLUDE REGEX "^\\s*(#.*)?$")
3+
foreach(def ${availability_defs})
4+
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -define-availability -Xfrontend \"${def}\">")
5+
endforeach()

0 commit comments

Comments
 (0)