Commit Graph

96 Commits

Author SHA1 Message Date
Saleem Abdulrasool
7e700889b0 RemoteMirror: add the SwiftRemoteMirror build to the new runtimes build
This adds the final missing runtime library to the runtiems build. With
this addition, the Windows SDK is complete.
2025-08-13 08:48:37 -07:00
Eric Miotto
94d554dd61 Overlay: support Catalyst, hooks and backdeployment on Apple platforms
This involves copying the correct source file to generate the magic
symbols (the one for SwiftCore would not work here), and listening to
the backdeployment configuration of Core.

Take the chance to add hooks for vendor overrides.

Addresses rdar://156436695
2025-07-23 09:24:29 -07:00
Eric Miotto
c1d901df2d [Runtimes] handle incremental builds that have non nested swiftmodules
Before #82571, we would generate a binary swiftmodule file at `<build
folder>/<module>.swiftmodule`, while now in the same location we
generate a directory.
Trying an incremental run on top of a build folder generated with the
old logic will fail during configuration with an error similar to

```
CMake Error at .../Supplemental/cmake/modules/EmitSwiftInterface.cmake:21 (file):
  file failed to create directory:

    .../StringProcessing-build/_RegexParser/_RegexParser.swiftmodule

  because: File exists
```

To reduce churn in CI and at desk, delete such remnant from the previous
logic.

Addresses rdar://155466197
2025-07-09 15:08:13 -07:00
Eric Miotto
bf32bf54f3 [Runtimes][SwiftCore] lay down nested swift modules ahead of CMake 4.1
This is needed in order to build target variants properly with a
SwiftDriver that has https://github.com/swiftlang/swift-driver/pull/1856

Addresses rdar://154410676
2025-06-27 16:10:03 -07:00
Evan Wilde
d34347876d SwiftCore: Cache computed platform info
Implements a similar caching mechanism to what CMake uses for detecting
the compiler. The file is created based on the computed values and
allows us to avoid calling the compiler if we aren't going to extract
out any platform info.
2025-06-09 18:01:56 -07:00
Evan Wilde
93603987dd Move availability args to response file
The availability flags keep increasing the number of characters on the
command line overflowing the maximum character length on Windows and
making the commands harder to read. This patch moves the generated
arguments into a separate response file so that they can continue to
grow without running into argument length limitations.
2025-06-06 16:58:12 -07:00
Alastair Houghton
726aaf710f Merge pull request #81940 from al45tair/eng/PR-152498657
Rename SwiftStdlibCurrentOS to StdlibDeploymentTarget.
2025-06-04 17:27:49 +01:00
Alastair Houghton
42ca1b1cc8 Rename SwiftStdlibCurrentOS to StdlibDeploymentTarget.
`StdlibDeploymentTarget` seems to be a better name.

rdar://152498657
2025-06-04 10:40:19 +01:00
Saleem Abdulrasool
3d0d95bfe3 Merge pull request #81927 from compnerd/this-reflects-poorly
runtimes: enable reflection by default on ELFish targets
2025-06-03 13:31:47 -07:00
Alastair Houghton
d5ed335339 Merge pull request #81440 from al45tair/currentos-availability
[Concurrency][Stdlib] Add SwiftStdlibCurrentOS availability, use it.
2025-06-03 15:01:22 +01:00
Saleem Abdulrasool
447b50d573 runtimes: enable reflection by default on ELFish targets
We need reflection enabled as swift-collections uses this which is
required for Foundation. Adjust the defaults to allow building
Foundation for Android again.
2025-06-02 20:12:08 -07:00
Guillaume Lessard
db7881ef2c [cmake] InoutLifetimeDependence should be enabled
Addresses rdar://152467655
2025-06-02 18:55:13 -07:00
Alastair Houghton
467f401ef1 [Build] Fix availability platform macros.
These need to be defined always; we'll set them to "unknown" and "none"
respectively if they end up being something we don't understand.

rdar://150966361
2025-06-02 11:30:31 +01:00
Alastair Houghton
d110464649 [Build] Fix macos vs macosx issue.
The module triple bizarrely omits the "x" from "macosx".

Also disable some of this code on non-Apple platforms.

rdar://150944675
2025-05-29 18:18:44 +01:00
Alastair Houghton
7e318e2c91 [Build] Use FATAL_ERROR, not ERROR.
We should be using `FATAL_ERROR` for error messages from CMake, not
just `ERROR`.
2025-05-28 14:55:49 +01:00
Alastair Houghton
c749e64f93 [Build] Fix variable name in new build system.
It should have been `SwiftCore_MODULE_TRIPLE`, not
`SwiftCore_SWIFT_MODULE_TRIPLE`.
2025-05-28 14:49:42 +01:00
Alastair Houghton
cd7701cd82 [Build] Add catalyst support to SwiftStdlibCurrentOS.
Add catalyst support for SwiftStdlibCurrentOS.

Also, set a minimum deployment target when building Concurrency;
this stops the build failing when we're trying to build on older
systems where Concurrency didn't really exist yet.

rdar://150966361
2025-05-23 10:31:56 +01:00
Evan Wilde
9993d295fa Merge pull request #81491 from etcwilde/ewilde/enable-commandline-by-default
Runtimes: Enable CommandLine support wholesale
2025-05-14 12:02:18 -07:00
Saleem Abdulrasool
62c384e21d Merge pull request #81479 from compnerd/configuration
Runtimes: tweak default configuration for Windows
2025-05-14 09:45:45 -07:00
Saleem Abdulrasool
1b5cb78a51 Runtimes: tweak default configuration for Windows
Enable command line support, library evolution, vector types, file
system support, runtime function counters, and optimization remark
emission. This brings the windows runtime configuration and Darwin
to parity.
2025-05-13 20:01:18 -07:00
Evan Wilde
94e695037c Runtimes: Enable CommandLine support wholesale
CommandLine support builds on all platforms at this time. There is no
need to have a default disabling it anymore. Setting the default option
to enable it on all platforms without condition.
2025-05-13 15:58:20 -07:00
Guillaume Lessard
bb67d1ef0a Merge pull request #81465 from glessard/rdar151179266-flag-in-swiftinterface
[cmake] LifetimeDependenceMutableAccessors should be enabled
2025-05-13 11:01:19 -07:00
Guillaume Lessard
23217262b2 [cmake] LifetimeDependenceMutableAccessors should be enabled 2025-05-12 18:41:50 -07:00
Saleem Abdulrasool
babfa098fc Runtimes: install the .swiftdoc interface as well
This is part of the development component for the module and is part of
the interface definition. This content is consumed by the user during
development.
2025-05-12 17:36:18 -07:00
Saleem Abdulrasool
0f2ed0eb43 Runtimes: refactor swift interface installation
Extract the `install_swift_interface` function into a new file. This
is always invoked to perform the installation of the Swift interfaces as
well as the binary module. Additionally, it prepares for a future
refactoring which will also install the swift documentation interface.
2025-05-12 17:34:43 -07:00
Alastair Houghton
28f96e64ab [Concurrency][Stdlib] Add SwiftStdlibCurrentOS availability, use it.
If you use SwiftStdlibCurrentOS availability, you will be able to
use new types and functions from within the implementation. This
works by, when appropriate, building with the CurrentOS availability
set to the current deployment target.

rdar://150944675
2025-05-12 12:07:24 +01:00
Slava Pestov
758284a00f cmake: Establish dependency on utils/availability-macros.def 2025-04-09 13:00:00 -04:00
Doug Gregor
0100104ff7 [stdlib] Reinstate AllowUnsafeAttribute experimental feature on libraries
We need this so that older compilers can handle the .swiftinterface
files we generate. It's unnecessary for newer compilers and can be
removed later.

Fixes rdar://148529962.
2025-04-03 18:07:19 -07:00
Evan Wilde
38a5fd6976 [CMake] Fix generated config install location
The expected install locations for the SwiftCoreConfig.cmake and
SwiftCoreTargets.cmake file was inconsistent between the build directory
and the install location. Making everything consistent across install
locations. In both cases, the files are installed under
`./cmake/SwiftCore`. This is one of the formats that `find_package` uses
to automatically search for package config files so that we can avoid
passing `SwiftCore_DIR` to all sub-projects.
2025-03-26 17:16:11 -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
564191e07c Merge pull request #80205 from compnerd/location
Runtimes: adjust path for referencing SwiftCoreTargets.cmake
2025-03-23 15:10:15 -07:00
Saleem Abdulrasool
3106f15165 Runtimes: adjust the default settings for Windows
This adjusts the default settings for the Windows build of the Swift
runtime to include reflection and to re-order them to match the Darwin
configuration to make it easier to identify differences.
2025-03-21 12:11:41 -07:00
Saleem Abdulrasool
440a66a7f6 Runtimes: adjust path for referencing SwiftCoreTargets.cmake
This is loaded by the CMake package configuration so that you can add
cross-package dependencies. Adjust the path so that the lookup succeeds
on all targets.
2025-03-21 11:57:30 -07:00
Evan Wilde
d280b1438a Merge pull request #80023 from etcwilde/ewilde/new-runtime-build-sccache-module
[CMake] Add cache for enabling sccache builds
2025-03-14 17:55:05 -07:00
Evan Wilde
98cf8d2b64 [CMake] Add cache for enabling sccache builds
Add cmake cache for enabling sccache while building with the new runtime
build when sccache is available.

To build with sccache, pass the `sccache.cmake`

```
cmake \
  -B build \
  -S Runtime/Core \
  -C Runtimes/Core/cmake/cache/sccache.cmake
```
2025-03-14 10:38:39 -07:00
Guillaume Lessard
96e9945d10 [stdlib] only enable “AddressableTypes” for the core stdlib 2025-03-10 14:24:59 -07:00
Saleem Abdulrasool
c3604743de Runtimes: tweak incorrect case (NFC)
This adjusts the spelling for the architecture specifier for the Windows
compilers. Take the opportunity to further restrict the compiler check
to micro-optimize the CMake configure phase.
2025-03-08 08:22:15 -08:00
Saleem Abdulrasool
0d8e005185 Merge pull request #79754 from compnerd/cx16
build: only apply `-mcx16` on X86 CPUs
2025-03-04 09:18:14 -08:00
Saleem Abdulrasool
40bf17c00d build: only apply -mcx16 on X86 CPUs
This is required to support compilation for non-X86 architectures.
2025-03-03 15:51:43 -08:00
Evan Wilde
0c5455ebad Fix missing PROPERTIES keyword in Finddispatch
Was missing the `PROPERTIES` keyword on the `Finddispatch` cmake
module resulting in failures to load it correctly.
2025-03-03 10:45:23 -08:00
Evan Wilde
f6edc3d7d0 CMake: Allow setting optimization remark type
Optimization remarks were always emitted on Darwin but not on the other
platforms and were forced to use the bitstream format. Adding a flag to
enable or disable them as desired and specify the desired output format.

Fixes: https://github.com/swiftlang/swift/issues/79279
2025-02-27 20:36:19 -08:00
Evan Wilde
3102bc0334 Extract experimental feature flags
Extracting experimental feature flags into a separate file so that we
can add Allan as a code owner of just that file. He has to deal with
breakage when folks remove these flags improperly.
2025-02-27 14:16:44 -08:00
Evan Wilde
71f9aac6e3 Merge pull request #79548 from etcwilde/ewilde/stdlib-rebuild-install-story
CMake: SwiftCore Install Story
2025-02-26 09:53:02 -08:00
Evan Wilde
6afa780fdd Add Finddispatch module
Implementing an initial `Finddispatch.cmake` module to find Dispatch
from the system SDK on Apple platforms. Still should implement a basic
mechanism for finding it on Windows and Linux. Note that those platforms
will likely use the dispatch config mechanism most frequently, but this
should still work as a fallback.

This mechanism is the only one that works for Apple platforms though as
those use libdispatch from the SDK rather than building it with
corelibs-libdispatch.

When building for Linux and Windows, it is possible to build a custom
corelibs-libdispatch runtime with `dispatch_DIR` and avoid this module.
This module makes it possible to use a pre-built corelibs-libdispatch
when one is available without needing to build it. The module uses
the `Swift_SDKROOT` filepath as a hint on where to look for the runtime
libraries and the `dispatch_STATIC` boolean to specify whether it should
find the dynamic library or the static archive.
2025-02-24 16:31:39 -08: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
b1fb62de34 Merge pull request #79499 from etcwilde/ewilde/apple-swift-version-5
Set Swift language version to 5
2025-02-20 13:43:30 -08:00
Evan Wilde
f490e611e1 Merge pull request #79335 from etcwilde/ewilde/catalyst-support
CMake: Catalyst Support
2025-02-19 17:16:09 -08:00
Evan Wilde
ebc0a37760 Set Swift language version to 5
The stdlib needs to build in Swift-5 mode, and ensure that
`-swift-verion 5` be included in the commandline explicitly. While the
compiler defaults to 5 mode, if it's not included explicitly, it won't
be included in the swift interface, which then means that modules that
import it will influence how the textual interface is processed.
The interface for the stdlib must be processed in the Swift 5 language
mode due to sendability. Set it explicitly to ensure that importing
modules do not change the Swift language mode.

Fixes: rdar://145118843
2025-02-19 16:57:43 -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
Eric Miotto
3e9a74cc4a Runtimes: enable build of SwiftOnoneSupport on Apple platforms.
Addresses rdar://145066924
2025-02-18 10:30:57 -08:00