Commit Graph

1731 Commits

Author SHA1 Message Date
Stefan Gränitz
1857d1c2af Initial patch for early feedback 2024-11-21 14:50:19 +01:00
Cyndy Ishida
1ab968d2b6 [BuildSystem] Stop building for i386-watch-simulator (#77692)
* [BuildSystem] Stop building for i386-watch-simulator

In Xcode16 it is not supported.
2024-11-20 08:57:19 -08:00
Saleem Abdulrasool
cc27c83fc8 build: adjust the early swift-driver handling
Windows has a strict limit on the file path, and use of extended names
for the build is not possible. Rather than hardcoding the location of
the early swift-driver build, allow the user to specify the path. If the
path is specified, we will attempt to copy `swift-driver` and
`swift-help` from that location. Adjust the code to account for the
build executable suffix. This should allow Windows to experiment with an
early swift-driver build.
2024-11-13 10:14:22 -08:00
Fabrice de Gans
79af6da13b [caches] Add cache files for Darwin builds 2024-11-07 11:00:40 -08:00
Egor Zhdan
5b2fd17d4a [build] Keep building Cxx binary for 32-bit watchOS
This reverts a part of ae3e4a1a.

The Cxx and CxxStdlib binaries should be built for all the targets that Swift can back-deploy to.

rdar://138230091
2024-10-22 16:06:40 +01:00
Rintaro Ishizaki
fdacd9dabb [CMake] Add 'CXX_INTEROP' option to add_pure_swift_host_library 2024-10-02 19:34:59 -07:00
Rintaro Ishizaki
e916e9e459 [CMake] Give a dedicated component to compiler swift-syntax libraries (#76497)
* [CMake] Give a dedicated component to compiler swift-syntax libraries

'compiler-swift-syntax-lib' so projects statically link to compiler
libraries (libAST etc) can use the required shared libraries.

rdar://135923606

* Update cmake caches

* Add back implicit `swift-syntax-lib` to `compiler` component for now

Some clients doesn't specify `swift-syntax-lib`.
2024-09-16 21:34:32 -07:00
Ian Anderson
5bf2c937ab [CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms
The Apple SDKs have been providing the Darwin overlay since macOS 10.14.4, iOS 12.2, et al. More recently the SDK version has diverged from the Swift version making them incompatible. Stop building the overlay from Swift. Once the SDK overlays aren't being built, the clang overlays need to be built in testing.

rdar://115192929
2024-09-11 22:26:37 -07:00
Artem Chikin
1baff87879 Revert "[CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms" 2024-09-09 09:57:14 -07:00
Ian Anderson
8959dd97fe [CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms
The Apple SDKs have been providing the Darwin overlay since macOS 10.14.4, iOS 12.2, et al. More recently the SDK version has diverged from the Swift version making them incompatible. Stop building the overlay from Swift. Once the SDK overlays aren't being built, the clang overlays need to be built in testing.

%target-swift-emit-pcm doesn't use the sdk, but %target-swift-frontend does, which will cause them to have a mismatch with "builtin headers belong to system modules, and _Builtin_ modules are ignored for cstdlib headers" aka LANGOPT(BuiltinHeadersInSystemModules) aka -fbuiltin-headers-in-system-modules.

rdar://115192929
2024-09-06 13:28:14 -07:00
Ben Langmuir
44b68cb5dc Merge pull request #75914 from benlangmuir/turn-it-up-to-11
Bump the deployment target for the compiler to macOS 13.0
2024-09-06 13:23:47 -07:00
Rintaro Ishizaki
2eade1e3cc Merge pull request #76253 from rintaro/cmake-package-cmo-rdar135110846
[CMake] Enable library evolution unconditionally for package CMO
2024-09-04 13:54:32 -07:00
Rintaro Ishizaki
7a002b29b9 [CMake] Enable library evolution unconditionally for package CMO
'-package-cmo' requires consistent resilient settings among package
modules at this point. Even if a module (e.g. execuables) don't provide
any public interfaces, specify '-enable-library-evolution'

rdar://135110846
2024-09-04 09:25:29 -07:00
Ben Langmuir
ae3e4a1a10 [watchos] Stop building watchos-armv7k and watchsimulator-i386
When the deployment target is above 9.0 (7.0 for simulator), only
building the module content such as the swiftinterface is supported.
2024-09-03 09:32:01 -07:00
Egor Zhdan
ec09fa773f Merge pull request #76124 from swiftlang/egorzhdan/maccatalyst-deployment-target
[build] Do not override macOS deployment target when macCatalyst is enabled
2024-08-30 17:02:35 +01:00
Ben Langmuir
ad82d86041 Bump the deployment target for the compiler to macOS 13.0
Bump the deployment target from macOS 10.13-aligned versions to macOS
13.0-aligned versions. This allows us to stop linking CoreFoundation
in the swift runtime, which was previously required for availability
checking. It also lets us align the deployment target on x86_64 with
arm64, which was 11.0. Finally, it is a prerequisite to being able to
build swift using the macOS 15 beta SDKs.
2024-08-29 14:30:09 -07:00
Rintaro Ishizaki
3bf75e7130 [CMake] Typo target -> target_name 2024-08-28 20:55:52 -07:00
Rintaro Ishizaki
371dfe860e [CMake] Build macro plugin and plugin servers as a package
Build 'lib/swift/host' libraries and linking binaries as a single
"package" instead of buillding the linking binaries with
"prefer-interface" hack.
This enables CMO between them.
2024-08-28 15:03:05 -07:00
Egor Zhdan
e1bff808d7 [build] Do not override macOS deployment target when macCatalyst is enabled
Cxx.swiftmodule should built with a macOS deployment target set to 10.9, the minimum possible version. Since we enabled macCatalyst for this target, it inadvertently started being built with a deployment target set to 13.0, which is too new and is causing build errors in certain projects.

This change makes sure that for Swift targets within the Swift project that explicitly specify `DEPLOYMENT_VERSION_OSX`, the macCatalyst build logic doesn't silently discard this flag.

rdar://133008827
2024-08-28 15:37:00 +01:00
Daniel Rodríguez Troitiño
4921eaf92f [CMake] Avoid stomping cache variables when cross-compiling (#76054)
If one is building unified and also cross-compiling (for example
building from Linux x86_64 to Linux aarch64), these variables which are
normally set in the cache pointing to a native toolchain are overwritten
unconditionally pointing to the `CMAKE_BINARY_DIR`, which can be
incompatible with the build machine.

The value of `SWIFT_NATIVE_CLANG_TOOLS_PATH` is eventually passed to the Swift
compiler as `-tools-directory`, which the new `swift-driver` actually
seems to use to find `swiftc`. When the `swift-driver` tries to use the
incompatible `swiftc`, it returns with a very unhelpful "error: failed to
retrieve frontend target info".

Avoiding overwriting the variables when cross-compiling lets the build
system use the variables provided in the cache, which point to correct
binaries for the build machine.
2024-08-23 06:59:41 -07:00
Mishal Shah
3ac0dff27d Bump the Swift version to 6.1 2024-08-19 23:09:31 -07:00
Saleem Abdulrasool
50aa3155f1 cmake: add llvm-ml to the windows toolchain build
`llvm-ml` is a replacement for `ml` which is the MSVC assembler. This is
useful on Windows and should be part of the distribution to ensure that
we have a complete toolchain.
2024-08-16 14:47:06 -07:00
Rintaro Ishizaki
39af14198d [CMake] Enable package CMO only in newer compilers 2024-07-29 17:10:39 -07:00
Rintaro Ishizaki
2c63bf2b48 Merge pull request #75304 from rintaro/swiftsyntax-package-cmo
[SwiftSyntax] Enable Package CMO if possible
2024-07-19 17:34:09 -07:00
Doug Gregor
ac0f574fdb Merge pull request #75127 from carlos4242/embedded-avr-cross-compile-stdlib
[AVR] standard library support for AVR
2024-07-17 22:17:42 -07:00
Rintaro Ishizaki
f0808e5335 [SwiftSyntax] Workaround a crash
The compiler crashes when compiling swift files importing package-cmo
enabled '.swiftmodule'. Avoid that by not-using '.swiftmodule'.
2024-07-17 14:29:28 -07:00
Alex Lorenz
6a7be95027 Merge pull request #74754 from hyp/eng/android-compiler-rt-buildps1
[windows][toolchain] build  android compiler-rt builtins when buildin…
2024-07-16 12:35:42 -07:00
Carl Peto
3689427834 [AVR] standard library support for AVR
- when compiling embedded cross compile target standard libraries, include AVR
- add 16-bit pointer as a conditional compilation condition and get the void pointer size right for gyb sources
- attempt to fix clang importer not importing __swift_intptr_t correctly on 16 bit platforms
- changed the unit test target to avr-none-none-elf to match the cmake build

[AVR] got the standard library compiling in a somewhat restricted form:

General
- updated the Embedded Runtime
- tweaked CTypes.swift to fix clang import on 16 bit platforms

Strings
- as discussed in https://forums.swift.org/t/stringguts-stringobject-internals-how-to-layout-on-16-bit-platforms/73130, I went for just using the same basic layout in 16 bit as 32 bit but with 16 bit pointers/ints... the conversation is ongoing, I think something more efficient is possible but at least this compiles and will probably work (inefficiently)

Unicode
- the huge arrays of unicode stuff in UnicodeStubs would not compile, so I skipped it for AVR for now.

Synchronization
- disabled building the Synchronization library on AVR for now. It's arguable if it adds value on this platform anyway.
2024-07-16 12:28:27 +01:00
Alex Lorenz
063a41c308 fix formatting 2024-07-15 13:03:13 -07:00
Alex Lorenz
c6c62e1763 Drop the arm64 changes
build ps1 is currently not able to compile the arm64 builtins correctly
2024-07-15 13:01:21 -07:00
Alex Lorenz
bd2c3ea53b [windows][toolchain] build android compiler-rt builtins when building Android SDK with build.ps1 2024-07-12 17:22:13 -07:00
Alexander Cyon
4a2942bb4e Fix typos in: cmake, tools, utils, unittests, validation-test
Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
2024-07-12 02:34:00 +03:00
Alastair Houghton
7268640b60 Merge pull request #74731 from al45tair/eng/PR-116525111
[Build][Linux] Set `--build-id=sha1` for the linker.
2024-06-28 11:31:36 +01:00
Alastair Houghton
35f123bbbf [Build][Linux] Set --build-id=sha1 for the linker.
This means we will get build IDs in the tools and standard library,
which is useful for debugging (it lets us associate debug symbols with
the binaries later on, as well as allowing us to reliably identify
exactly which binary we are looking at).

rdar://116525111
2024-06-27 12:21:50 +01:00
Rintaro Ishizaki
5ebd715a2a Merge pull request #73725 from rintaro/macros-inproc-plugin
[Macros] In-process plugin server
2024-06-26 06:33:38 -07:00
Saleem Abdulrasool
c048449694 caches: add clang-features-file to the install components
This ensures that we distribute the features.json for clang in the
toolchain distribution image which is used for building the image.
2024-06-25 14:02:01 -07:00
Rintaro Ishizaki
2f7aa428db [Macros] In-process plugin server
Separate swift-syntax libs for the compiler and for the library plugins.
Compiler communicates with library plugins using serialized messages
just like executable plugins.

* `lib/swift/host/compiler/lib_Compiler*.dylib`(`lib/CompilerSwiftSyntax`):
  swift-syntax libraries for compiler. Library evolution is disabled.
* Compiler (`ASTGen` and `swiftIDEUtilsBridging`) only depends on
  `lib/swift/host/compiler` libraries.
* `SwiftInProcPluginServer`: In-process plugin server shared library.
  This has one `swift_inproc_plugins_handle_message` entry point that
  receives a message and return the response.
* In the compiler
  * Add `-in-process-plugin-server-path` front-end option, which specifies
    the `SwiftInProcPluginServer` shared library path.
  * Remove `LoadedLibraryPlugin`, because all library plugins are managed
    by `SwiftInProcPluginServer`
  * Introduce abstract `CompilerPlugin` class that has 2 subclasses:
    * `LoadedExecutablePlugin` existing class that represents an
      executable plugin
    * `InProcessPlugins` wraps `dlopen`ed `SwiftInProcPluginServer`
  * Unified the code path in `TypeCheckMacros.cpp` and `ASTGen`, the
    difference between executable plugins and library plugins are now
    abstracted by `CompilerPlugin`
2024-06-17 11:36:52 -07:00
Alex Lorenz
c8b5344d3e Merge pull request #72014 from compnerd/android
utils: support building android SDKs on Windows
2024-06-07 12:37:00 -07:00
Egor Zhdan
cb2f23f3de Merge pull request #74006 from apple/egorzhdan/remove-ios-32bit
[build] Remove unused `SWIFT_ENABLE_IOS32` CMake flag
2024-05-30 22:11:38 +01:00
Egor Zhdan
7d754db19a [build] Remove unused SWIFT_ENABLE_IOS32 CMake flag
This removes the unused legacy CMake flag: `SWIFT_ENABLE_IOS32`.

Support for targeting 32-bit iOS was removed in 2022 in https://github.com/apple/swift/pull/60363.
2024-05-30 15:19:59 +01:00
Artem Chikin
5545581520 Merge pull request #73893 from artemcm/DebugBuildEarlySwiftDriverCopy
Copy over EarlySwiftDriver executables on Debug builds by specifying the correct driver build directory
2024-05-28 10:50:27 -07:00
artemcm
da33e042e4 Copy over EarlySwiftDriver executables on Debug builds by specifyin the correct driver build directory 2024-05-24 11:42:14 -07:00
Egor Zhdan
1d5481655f Merge pull request #73619 from apple/egorzhdan/bootstrapping-without-backdeployment
[build] Fix bootstrapping builds that disable back-deployment
2024-05-22 15:23:50 +01:00
Egor Zhdan
421ee98fc5 [build] Fix bootstrapping builds that disable back-deployment
This fixes a build that passes `-D SWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT=NO` and `-D BOOTSTRAPPING_MODE=BOOTSTRAPPING-WITH-HOSTLIBS`.

Previously a few CMake errors would be emitted:
```
CMake Error at cmake/modules/AddSwift.cmake:478 (get_property):
  get_property could not find TARGET HostCompatibilityLibs.  Perhaps it has
  not yet been created.

CMake Error at cmake/modules/AddSwift.cmake:527 (add_dependencies):
  add_dependencies called with incorrect number of arguments
Call Stack (most recent call first):
  cmake/modules/AddSwift.cmake:969 (_add_swift_runtime_link_flags)
  tools/driver/CMakeLists.txt:23 (add_swift_host_tool)
```
2024-05-20 14:31:12 +01:00
Daniel Rodríguez Troitiño
face056ec3 [CMake] Respect LLVM instrumentation variables in libraries and executables (#73629)
In apple/swift#71135 I added this code to `add_pure_swift_host_library`
but failed to realize that it was also needed in
`add_pure_swift_host_tool`. Extract the code into a helper function and
invoke it from both functions in order to be able to instrument the
`swift-plugin-server` and other pure Swift tools.
2024-05-15 15:02:39 -07:00
Alex Lorenz
5905dc9ef3 more cross-arch build.ps1 android fixes 2024-05-14 12:15:06 -07:00
Eric Miotto
ce0e620d1a [CMake] allow custom options when building the compiler with debug info
Currently those are hardcoded to `-g`, but in some Apple internal
configurations we would like to change them.

There are other part of the build system that hardcode `-g`
(e.g. in `SwiftCompilerSources` and `AddSwiftStdlib.cmake`),
but we are not interested in those at the moment -- we will address those
in the future if need be.

Supports rdar://127503136
2024-05-14 08:42:35 -07:00
Alastair Houghton
9e2c13bd10 Merge pull request #71839 from al45tair/eng/PR-123503470
[Build] Add the new fully-static Linux SDK.
2024-05-06 17:34:22 +01:00
Alastair Houghton
6afdcd311f Merge pull request #72061 from al45tair/eng/PR-123504095
[Linux][Runtime][IRGen] Mark metadata sections as retained and support section GC.
2024-05-04 09:23:06 +01:00
Hamish Knight
85d42d1f3b Merge pull request #73383 from hamishknight/fix-stdlibless-build
[cmake] Only check HostCompatibilityLibs for bootstrapping builds
2024-05-03 23:29:44 +01:00