Commit Graph

59 Commits

Author SHA1 Message Date
Guillaume Lessard
ba1446e5f9 [stdlib] list files for cmake 2025-07-11 19:03:02 -07:00
Michael Gottesman
e04e15f125 [swift-settings] Now that we aren't using it immediately, remove it from tree.
We can always get it back from the git history.

rdar://150695113
(cherry picked from commit 9d59dbed17)

Conflicts:
	include/swift/AST/DiagnosticsSema.def
	include/swift/Basic/Features.def
	test/abi/macOS/arm64/concurrency.swift
	test/abi/macOS/x86_64/concurrency.swift
2025-05-06 14:12:23 -07:00
Eric Miotto
d62e385254 [SwiftCore] emit correct names for symbols that can be backdeployed
This matches the flag that was added to the old build system in
b0627e28a2

Addresses rdar://149410833
2025-04-21 15:01:47 -04:00
Michael Ilseman
393c24ddd7 UTF8Span (#78531) (#80890)
Add support for UTF8Span

Also, refactor validation and grapheme breaking
2025-04-18 10:01:15 -04:00
Guillaume Lessard
c9b1ab8c42 Merge pull request #79650 from glessard/rdar138440979-MutableSpan
[SE-0467] MutableSpan, with mutableSpan properties to Array, ArraySlice and ContiguousArray.
2025-03-28 17:59:47 -07:00
Guillaume Lessard
51db21acc4 [build] add files for the new build system 2025-03-27 16:55:06 -07:00
Evan Wilde
bfa5269dec [SwiftCore] Enable explicit module builds
Explicit module builds help prevent the dependency scanner from getting
lost and attempting to pull the SwiftShims module from the resource
directory, existing SDK, and the just-built standard library.
They aren't part of the library interface, but make it possible to build
the runtime libraries without seeing duplicate shims. Moving the flag to
a top-level compile command.
2025-03-27 15:20:09 -07:00
Saleem Abdulrasool
a17cf9b785 Merge pull request #80250 from compnerd/dependencies
Runtimes: establish dependency on the registrar
2025-03-25 18:59:25 -07:00
Saleem Abdulrasool
3bb8cfb475 Merge pull request #80251 from compnerd/workaround
Runtimes: add additional interface flags
2025-03-25 13:09:50 -07:00
Saleem Abdulrasool
c1dbc12587 Runtimes: establish dependency on the registrar
This removes the workaround for the exporting of the registrar and
enables proper dependency tracking across projects (primarily geared
towards the Overlay).
2025-03-25 10:12:31 -07:00
Evan Wilde
1dc97c2c43 [CMake] Use CXX linker for Core and Concurrency
swiftCore and swift_Concurrency libraries use C++ and Swift. The C++
does not use the Swift C++ interop. Swift driver only uses clang++ to
link when building in C++ interop mode and there currently isn't a flag
to change that. Since we're explicitly linking the runtime registration
when necessary and do not need compatibility libraries, it is safe to
use clang++ as the linker directly, instead of going through swiftc.

In versions of CMake older than 3.29, Swift is always used as a linker
and has no compile stage. By using clang++ as the linker, we require the
split build model (CMP0157), so we cannot allow versions of CMake older
than 3.29.
2025-03-24 14:20:07 -07:00
Saleem Abdulrasool
db51658e3f Runtimes: add additional interface flags
Explicitly add the path to the Swift module to the interface include
directories. It is unclear why this is not propagating implicitly from
the module definition. For now, this ensures that the client is able to
load the standard library.
2025-03-24 13:10:35 -07:00
Saleem Abdulrasool
f0b27bcd58 Merge pull request #80208 from compnerd/reorganise
Runtimes: reorganise flags for swiftCore
2025-03-24 13:07:48 -07:00
Guillaume Lessard
c21de062bb Merge pull request #78561 from glessard/rdar137710901-span-properties-prototype
[SE-0456] Span properties (part 1)
2025-03-24 08:47:47 -07:00
Saleem Abdulrasool
d19fd71174 Runtimes: reorganise flags for swiftCore
This re-organises the file a small amount to put the source listing and
additions together. Subsequently, apply compile definitions, options,
and then link libraries and finally options
2025-03-21 12:15:19 -07:00
Saleem Abdulrasool
bc45db16fd Runtimes: properly link in swiftrtT?.obj on Windows
`swiftrtT.obj` should be used for statically linking the standard
library (or within the standard library itself). For the other modules,
we need to differentiate between `swiftrt.obj` and `swiftrtT.obj`. This
fixes that oversight. This was not caught by the CI builds as we do not
currently build both the static and dynamic variants of the new
runtimes.
2025-03-20 11:07:46 -07:00
Alejandro Alonso
a55c9c792d Add EnumeratedSequence to new build system 2025-03-17 18:11:48 -07:00
Michael Gottesman
f64dd5a8d5 [concurrency] Add initial support for SwiftSettings to control defaultIsolation at the file level.
We introduce a new macro called #SwiftSettings that can be used in conjunction
with a new stdlib type called SwiftSetting to control the default isolation at
the file level. It overrides the current default isolation whether it is the
current nonisolated state or main actor (when -enable-experimental-feature
UnspecifiedMeansMainActorIsolated is set).
2025-03-10 17:33:45 -07:00
Guillaume Lessard
96e9945d10 [stdlib] only enable “AddressableTypes” for the core stdlib 2025-03-10 14:24:59 -07:00
Evan Wilde
7870db67f8 CMake: Runtime Installation Story
Starting to work on a full installation story for the Swift runtimes.
This involves generating the SwiftCoreConfig cmake files to allow
importing the just-built runtimes into the overlays and supplemental
libraries, setting up the flags appropriately for the given SwiftCore
build configuration.

This also separates out the development and runtime components to allow
installing just the runtimes without the headers.

Component List:
 - SwiftCore_runtime

  The runtime libraries that are required for running code.

 - SwiftCore_development

  The interface with the runtime libraries that are required for
  building code against the runtimes.

 - SwiftCore_cmake

  Files for interfacing CMake projects with the built runtimes.
  This includes the target list and flags needed to use the targets
  built by the specific configuration used to build the runtime
  libraries.

  These files are used for mapping flags, definitions, and locations
  into the overlay libraries and supplemental libraries.

This adds install commands for the object libraries contributing to
libswiftCore so that they are represented in SwiftCoreTargets.cmake.
Object libraries do not contribute anything to the files actually
installed.
2025-02-22 10:33:17 -08:00
Evan Wilde
e59326cdd5 CMake: Move installation of binary swiftmodule
To keep things consistent with the target and target-variant swiftmodule
files, moving the installation of the binary swift module into
`install_swift_interface`. CMake implicitly generates the target
swiftmodule, but does not know about zippered binaries, so we need to
ensure that the target-variant module is available for installation when
applicable.
2025-02-18 16:29:37 -08:00
Saleem Abdulrasool
509c385458 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.
2025-02-12 21:59:47 -08:00
Guillaume Lessard
c7af9a701b Merge pull request #79294 from Azoy/bye-bye-slab
[stdlib] Rename Slab to InlineArray
2025-02-12 12:03:25 -08:00
Eric Miotto
eb7706ded9 Merge pull request #79266 from edymtt/edymtt/rearrange-core-flags
Runtimes: rearrange flags to match the current stdlib
2025-02-11 13:02:58 -08:00
Alejandro Alonso
e4fb1f6761 Rename Slab to InlineArray 2025-02-11 10:26:44 -08:00
Saleem Abdulrasool
8733205cd5 Merge pull request #79269 from compnerd/closed
Runtimes: use the static module constructor in swiftCore
2025-02-10 14:23:25 -08:00
Saleem Abdulrasool
41b043ecfe Merge pull request #79227 from compnerd/implicit-explicit
Runtimes: remove the explicit linking in the build system
2025-02-10 13:09:55 -08:00
Eric Miotto
66d4665801 Runtimes: hoist more flags from swiftCore to all Core libraries
Addresses rdar://143152066
2025-02-10 13:06:44 -08:00
Eric Miotto
7924cc1a77 Runtimes: use -enable-experimental-concise-pound-file only for Core.
As per #32700, this is only meant for `Swift.swiftinterface`.

Addresses rdar://143152066
2025-02-10 13:06:44 -08:00
Saleem Abdulrasool
db4fd6dbee Runtimes: use the static module constructor in swiftCore
Use the static module constructor for swiftCore on Windows as the
runtime functions are internal to the module. This fixes the last linker
warning that we see with the standard library build when building
dynamically. More importantly, this allows building swiftCore as a DLL
with the new build system on Windows as we now treat any linker warnings
as errors.
2025-02-10 09:28:00 -08:00
Saleem Abdulrasool
c18d6bb7d1 Runtimes: remove the explicit linking in the build system
These libraries are now implicitly explicitly linked. The source files
include `#pragma comment(lib, ...)` to include the autolink directives
to properly handle the dependency propagation to ensure static linking
is sufficiently closed.
2025-02-07 14:14:39 -08:00
Eric Miotto
2a367234be Runtimes: support generic metadata prespecialization for all of Core
Also provide a flag to enabled/disable it.

Addresses rdar://144255917
2025-02-07 07:39:21 -08:00
Evan Wilde
a9da4a5c1a CMake: Add install platform and architecture subdirs
In some configurations, libraries are installed under
`<install-prefix>/{libdir}/swift/<platform>/<arch>` and module content
is installed under `<install-prefix>/{libdir}/swift/<platform>`.

This also accounts for the fact that Swift currently looks under
`<install-prefix>/{libdir}/swift_static/**` for the static stdlib
builds.
2025-01-23 12:25:21 -08:00
Justice Adams
d1d8cdd170 add SwiftifyImport.swift to source list (#78785) 2025-01-22 13:53:21 -08:00
Eric Miotto
0c33858e74 [CMake] Avoid using a couple flags when building MinSizeRel
This preserves the behaviour introduced in #33444.

Addresses rdar://142820419
2025-01-15 14:41:49 -08:00
Evan Wilde
c92e1d7904 CMake: SwiftCore: Get Slabs building
This patch adds slabs to the new stdlib build system.
2025-01-13 13:27:58 -08:00
Saleem Abdulrasool
ce3cc37e83 Merge pull request #78504 from compnerd/globals
Runtimes: adjust global flags in preparation for extending the Core project
2025-01-09 19:02:38 -08:00
Saleem Abdulrasool
43487a35a9 Runtimes: extract and hoist "global" flags
These set of Swift flags are applied to all runtime libraries that are
built. Hoist them to the top-level to spell them once and to keep all
the libraries in sync.
2025-01-08 15:35:23 -08:00
Saleem Abdulrasool
654577bb36 Runtimes: correct generator expression language spelling
This corrects the compile language check in the generator expression to
add the missing `X`.
2025-01-08 15:04:30 -08:00
Saleem Abdulrasool
cec890dcdc Runtimes: merge target_link_libraries (NFC)
This simply merges two calls to `target_link_libraries` into a single
call as both are using the same visibility.
2025-01-06 14:23:15 -08:00
Justice Adams
31b6aee3b8 include Span files (#78295) 2024-12-19 13:05:34 -08:00
Justice Adams
4666a418e0 [CMAKE] Add Plist creation to swiftCore (#77960)
* update Resync to copy plist template

* include Plist in linked library for Darwin platforms

* only embedd plist on apple platforms

* formatting fix
2024-12-17 15:49:54 -08:00
Evan Wilde
0a9ab413a0 Merge pull request #78175 from etcwilde/ewilde/stdlib-rebuild-swiftcore-vendor-extension
[CMake] Add build-system vendor hook for swiftCore
2024-12-16 09:56:07 -08:00
Saleem Abdulrasool
f68fed2562 Merge pull request #78179 from compnerd/unregistered
runtime: avoid the toolchain Swift registrar
2024-12-16 08:09:17 -08:00
Justice Adams
cf307da872 [cmake] add -headerpad_max_install_names when building dylibs (#78121)
* add -headerpad_max_install_names when building dylibs

* fix formatting of link options
2024-12-13 14:47:22 -08:00
Saleem Abdulrasool
ca13658270 runtime: avoid the toolchain Swift registrar
Pass `-nostartfiles` to the driver as a staged toolchain would attempt
to link the Swift registrar which may not exist if the SDK is not
integrated. Furthermore, the registrar to be used is locally built and
not the one from the previous build.
2024-12-13 13:55:51 -08:00
Saleem Abdulrasool
215db61ea7 Merge pull request #78145 from compnerd/unescapable-features
Core: add `NonescapeableTypes` feature
2024-12-13 13:54:51 -08:00
Evan Wilde
9aba19b8cf [CMake] Add build-system vendor hook for swiftCore
Adding a hook point for vendors to add flags, definitions, etc, to the
swiftCore library build.
2024-12-13 12:26:12 -08:00
Saleem Abdulrasool
0e68650065 Core: add missing experimental features
Enable the non-escapeable types and lifetime dependence features when
building swiftCore. While we do not enable all the same features being
used in the current standard library, this allows us to build the
runtime.
2024-12-12 21:08:30 -08:00
Saleem Abdulrasool
8bf26a795c Runtime: control swiftCore_EXPORTS based on the build
This define is meant to be present only when performing a build of a
dynamic library. The general pattern for this is:

  ```c
  #if defined(LIBRARY_STATIC)
  # define LIBRARY_ABI /**/
  #else
  # if defined(_WIN32)
  #   if defined(LIBRARY_EXPORTS)
  #     define LIBRARY_ABI __declspec(dllexport)
  #   else
  #     define LIBRARY_ABI __declspec(dllimport)
  #   endif
  # elseif defined(__linux__) && !defined(__ANDROID__)
  #   define LIBRARY_ABI __attribute__((__visibility__("protected")))
  # else
  #   define LIBRARY_ABI __attribute__((__visibility__("default")))
  # endif
  #endif
  ```

For AIX this would require an additional flag to be specified
(`-mdefault-visibility-export-mapping=explicit`). The same applies for
other non-AIX, non-Windows platforms with a different set of flags:
`-fvisibility=hidden -fvisibility-inlines-hidden`.

This is required to start trying to build the standard library
statically on Windows (which also requires further changes to the
Swift compiler).
2024-12-12 10:06:21 -08:00