Commit Graph

119 Commits

Author SHA1 Message Date
Evan Wilde
fd2ba8b95d Fix the ARM architecture on FreeBSD
The 64-bit ARM architecture spelling on FreeBSD is aarch64, not arm64.
This results in a build failure about a missing
`freebsd/arm64/swiftrt.o` while building the runtimes.
2025-05-20 21:38:41 -07:00
3405691582
79e0b6a7e0 Unconditionally add -z,origin on OpenBSD. (#80897)
This is a little less than ideal, since as I understand it, it only
makes sense to add -z,origin when $ORIGIN expansion is required, but
doing this surgically per target is rather cumbersome. I don't believe
there are any significant drawbacks to doing it unconditionally like
this, however.
2025-04-30 19:46:29 +05:30
Yuta Saito
9595425717 Merge pull request #79344 from kateinoigakukun/pr-c16855f8d94328f5545bcc3105985cd5286ce69f
[build] Configure library naming conventions for WebAssembly platforms
2025-02-14 13:32:43 +09:00
Yuta Saito
720327727f [build] Configure library naming conventions for WebAssembly platforms
Use the same conventions used in wasi-libc and Emscripten
2025-02-13 00:54:13 +00:00
Yuta Saito
9d4e5b6911 [build] Add initial support for Emscripten SDK
This patch adds initial support for Emscripten SDK alongside the existing
support for WASI SDK. This is a first step towards building a part of
Swift compiler for Emscripten target (which will be used to build LLDB
with Swift to WebAssembly target).
2025-02-13 00:53:45 +00:00
Michael Chiu
c6d9efa553 Remove FreeBSD version from SDK triple 2025-02-01 12:05:39 -08:00
Cyndy Ishida
3232df4d67 Reapply '[BuildSystem] Stop building for i386-watch-simulator (#77692)' (#79018)
* Reapply '[BuildSystem] Stop building for i386-watch-simulator (#77692)'

    * [BuildSystem] Stop building for i386-watch-simulator

    In Xcode16 it is not supported.

This initially broke client projects who were still building the legacy
architecture but now that's resolved.
2025-01-31 15:04:28 -08:00
Cyndy Ishida
1b869ef828 Revert "[BuildSystem] Stop building for i386-watch-simulator" (#77911)
* Revert "[Build] Fix swift_build_support tests."

This reverts commit fc2d1b3b23.

* Revert "[BuildSystem] Stop building for i386-watch-simulator (#77692)"

This reverts commit 1ab968d2b6.

This change can't be made without other issues fixed downstream first.
2024-12-03 23:17:12 -08:00
3405691582
301a0c49fc Swift on OpenBSD supports arm64.
However, to do this, we end up changing how amd64 is supported too.
Previously, I had tried to keep some meaningful separation between
platform spelling and LLVM spelling, but this is becoming more difficult
to meaningfully maintain.

Target specifications are trivially converted LLVM triples, and the
module files are looked up by LLVM triples. We can make sure that the
targets align, but then the Glibc to SwiftGlibc import breaks. That could
also be addressed, but then we get to a point where the targets set up
by build-script and referenced by cmake begin to misalign. There are
references in build-script-impl for a potential renaming site, but it's
not quite enough.

It's far simpler to give up and rename to LLVM spellings right at the
beginning. This does mean that this commit is less constrained to just
adding the necessary parts to enable arm64, but it should mean less
headaches overall from differing architecture spellings.
2024-11-30 16:33:46 -05: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
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
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
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
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
Alastair Houghton
ae1c0455f3 [Build] Add the new fully-static Linux SDK.
Declare a new `LINUX_STATIC` SDK and configure it.

Add options to set the build architectures for the `LINUX` and
`LINUX_STATIC` SDKs, similar to what we have for Darwin, because
we'll be cross-compiling.

Also add an option to point the build system at the sources for
the musl C library, which we're using for `LINUX_STATIC`.

rdar://123503470
2024-05-02 14:56:18 +01:00
Alastair Houghton
8f5980666d Merge pull request #71838 from al45tair/eng/PR-123503191
[Build] Tweak Libdispatch.cmake for static linking support.
2024-05-02 14:54:23 +01:00
Yuta Saito
ca5e7a6bdd build: Rename wasi-threads to wasip1-threads
The WASI community is transitioning to a new naming for the "preview"
version in the target triple: wasm32-wasi -> wasm32-wasip1.
At this moment, we keep the old triple wasm32-wasi because it's already
widely used, but we should start using the new triple threaded target.

LLVM checks only if the OS field *starts* with "wasi", so "wasip1" is
still considered a valid `isOSWASI()` target.

See: https://github.com/WebAssembly/wasi-libc/pull/478
2024-03-29 15:35:14 +00:00
Yuta Saito
82740fe969 wasm: Add support for WASI threads in CMake build system
This patch adds a new CMake option, `SWIFT_ENABLE_WASI_THREADS`, to
enable building the Standard Library using WASI threads primitives
(https://github.com/WebAssembly/wasi-threads). With this option, the
Standard Library will be built for the new "wasm32-unknown-wasi-threads"
target. We add the new triple because the WASI threads proposal requires
extra syscalls and object files compiled to "wasm32-unknown-wasi" and
"wasm32-unknown-wasi-threads" are not compatible and cannot be linked
together.
2024-02-29 14:44:10 +00:00
Alastair Houghton
4bfa31afb7 [Build] Add support for static-linking to the SDK system.
Add some additional SDK variables that let us mark an SDK as
supporting static linking, and/or supporting *only* static
linking.

rdar://123503009
2024-02-23 15:48:57 +00:00
Stéphan Kochen
7b460ce495 build: fix accidental cmake expansions
As of CMake 3.25, there are now global variables `LINUX=1`, `ANDROID=1`,
etc. These conflict with expressions that used these names as unquoted
strings in positions where CMake accepts 'variable|string', for example:

- `if(sdk STREQUAL LINUX)` would fail, because `LINUX` is now defined and
  expands to 1, where it would previously coerce to a string.

- `if(${sdk} STREQUAL "LINUX")` would fail if `sdk=LINUX`, because the
  left-hand side expands twice.

In this patch, I looked for a number of patterns to fix up, sometimes a
little defensively:

- Quoted right-hand side of `STREQUAL` where I was confident it was
  intended to be a string literal.

- Removed manual variable expansion on left-hand side of `STREQUAL`,
  `MATCHES` and `IN_LIST` where I was confident it was unintended.

Fixes #65028.
2023-07-17 21:50:50 +02:00
Max Desiatov
8499aa044c SwiftConfigureSDK.cmake: support freebsd-arm64 2023-06-15 01:11:47 +01:00
Eric Miotto
6b2809ab19 [CMake] Assume watchOS and watchSimulator SDKs support 32 bit (#63472)
Update to match SDKSettings.json in watchOS 9.0

Addresses rdar://104967031
2023-02-06 21:29:56 -08:00
Saleem Abdulrasool
d0a7ceab4c Merge pull request #61816 from mhjacobson/freebsd-strip-version-suffix
build: add missing `REGEX` to properly strip {Free,Open}BSD version suffixes
2022-11-30 07:24:51 -08:00
Max Desiatov
5cc0808ef9 SwiftConfigureSDK.cmake: convert tabs to spaces (#62237)
Using tabs instead of spaces led to inconsistency and broken formatting.
2022-11-28 16:30:13 +00:00
Matt Jacobson
457af8502e build: add missing REGEX to properly strip FreeBSD version suffix
Remove identical logic for OpenBSD, which doesn't include suffixes in
`$CMAKE_SYSTEM_VERSION`.
2022-11-08 03:15:01 -05:00
Alsey Coleman Miller
62b7be4e9c [stdlib] Add RISCV64 support 2022-11-01 23:59:42 -07:00
Matt Jacobson
1a0ea75b5c build: fix syntax error in FreeBSD section of configure_sdk_unix 2022-10-20 23:52:13 -04:00
Egor Zhdan
ba31ca4ea6 [build] Remove unused GLIBC_INCLUDE_PATH macro
This macro was previously substituted when generating `glibc.modulemap` file during the compiler build. Now Swift detects the location of Glibc dynamically and injects `glibc.modulemap` into it using LLVM VFS. The last usage of `GLIBC_INCLUDE_PATH` was removed in `78c0540b`.

This also removes `SWIFT_SDK_${sdk}_ARCH_${arch}_LIBC_INCLUDE_DIRECTORY` which doesn't have any usages left.
2022-09-05 18:57:29 +01:00
3405691582
3740a207bd Apply suggestions from code review
Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
2022-08-29 10:47:42 -04:00
3405691582
47ae4d9a53 Preliminary Linux-OpenBSD cross-compile support.
With a properly prepared sysroot and toolchain file, these changes permit
cross-compilation of Swift as well as LLVM, CMark, and Dispatch (picking,
as usual, apple/swift-corelibs-libdispatch#556) from a Linux host
generating OpenBSD binaries.

The toolchain file must be specified as an environment variable to
`build-script` and discussion on how to properly set up the sysroot and
toolchain file will be handled later.
2022-08-28 22:39:46 -04:00
Mishal Shah
196ee143c5 Xcode 14 beta 4 no longer supports iOS armv7, armv7s, and i386 architectures
> Building iOS projects with deployment targets for the armv7, armv7s, and i386 architectures is no longer supported. (92831716)
2022-08-02 20:42:08 -07:00
Alastair Houghton
1b34fa9c5c [Threading] Minor improvements to SWIFT_THREADING_PACKAGE support
Added a check that someone hasn't passed us an argument with too many
colons.  Also renamed `find_threading_package` to `get_threading_package`
to better reflect what it does.
2022-07-01 15:06:25 +01:00
Alastair Houghton
b5735559eb [Threading] Fix threading package defaults.
These are better done via the SwiftConfigureSDK mechanism rather than
how I was doing them previously.  Additionally, I've changed the way
that the swift-threading-package option works.  In addition to
specifying just a single package name, you can specify it as a CMake
list (i.e.  separate by semicolons) of colon-separated `sdk:package`
pairs, e.g.  `osx:darwin;linux:pthreads`.  You can also override it
for all SDKs and then specify for a given SDK; specifications for a
particular SDK take precedence over the global override.  For instance
`pthreads;osx:darwin` says to use `pthreads` except on the OS X SDK
where we should use `darwin`.
2022-06-30 16:07:00 +01:00
Daniel Rodríguez Troitiño
036e16810a [Cxx] Make C++ flags configurable for Linux SDK (#59764)
Allow Linux distributions to provide their own C++ flags to compile the
C++ overlay correctly. The default is kept the same for Ubuntu and
CentOS, but other distributions can provide other flags to use their own
distro GCC stdlibc++ or even libc++ if they choose.

This should not change the current compilation, but opens the door for
other maintainers to provide a different value that work on their
systems.
2022-06-29 08:54:56 -07:00
Josh Soref
b5b33d42f0 Spelling cmake (#58569)
* spelling: and

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: intentionally

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: simulator is

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-05-04 19:23:16 -07:00
Robert Widmann
7cd3541c62 Merge pull request #41656 from MillerTechnologyPeru/feature/ppc32
[stdlib] Added PowerPC 32-bit support
2022-03-07 15:08:26 -08:00
Alsey Coleman Miller
b85e673a78 [stdlib] Added Armv5 support 2022-03-06 00:56:32 -05:00
Alsey Coleman Miller
0ab3eec987 Added PowerPC 32-bit support 2022-03-03 22:21:33 -05:00
Butta
0cf765adf4 [build] Remove SWIFT_SDK_${OS}_ARCH_${ARCH}_LIBC_ARCHITECTURE_INCLUDE_DIRECTORY CMake variable 2022-01-09 13:27:27 +05:30
Alejandro Alonso
86fec4011d Cleanup more of the build from Saleem's comments 2021-11-30 15:01:20 -08:00
Max Desiatov
8cd8ca01ad CMake: clean up WASI SDK sysroot paths (#39275)
Paths to WASI SDK sysroot should not assume `/share/wasi-sysroot` directory hierarchy. It's much more flexible to have this part hidden under the more general `SWIFT_WASI_SYSROOT_PATH` variable.
2021-09-13 16:36:10 +01:00
Kuba (Brecka) Mracek
c079c0897b Split SWIFT_DARWIN_PLATFORMS and SWIFT_APPLE_PLATFORMS in CMake. SWIFT_APPLE_PLATFORMS may contain 'FREESTANDING' when building the freestanding SDK and SWIFT_FREESTANDING_FLAVOR is set to 'apple'. (#38997) 2021-08-23 19:16:28 -07:00
Dario Rexin
00117e8750 [Concurrency] Fix Android C libdispatch build (#35881)
* [Concurrency] Fix Android C libdispatch build

We need to pass CMAKE_ANDROID_NDK and CMAKE_ANDROID_ARCH_ABI to the
build.

* Set proper ANDROID_ARCH_ABI

* Add -DCMAKE_ANDROID_API to C libdispatch build

* Fix compiler config for Android
2021-02-10 17:35:14 -08:00
Dario Rexin
51bdfa1919 [Concurrency] Build C-only libdispatch as part of Swift build (#35837)
* [Concurrency] Build C-only libdispatch as part of Swift build
2021-02-09 14:24:52 -08:00
buttaface
e6f5913772 [android] Move to the NDK's unified sysroot (#34491)
Since the NDK removes the platforms/ and sysroot/ directories in the latest NDK
22, switch to the unified sysroot in toolchains/llvm/ and take advantage of a
bunch of simplification that's now possible.
2021-02-07 09:19:18 -08:00
Robert Widmann
b436825948 Trade Usages of -m${platform}-version-min For -target
There's no reason to use -m${platform}-version-min as of clang-11/Xcode 11. Clang is now smart enough to parse -target and provide Apple's ld with the appropriate -platform_version argument string.
2021-01-13 11:00:39 -08:00
Butta
1a28a91db9 [android] Switch armv7 vendor to 'unknown' in target triple to match other arches
Recent changes have made 'none' and 'unknown' not interchangeable anymore, so
standardize on 'unknown' for armv7 too.
2020-12-02 11:05:36 +05:30
Kuba (Brecka) Mracek
f91fe9c0c1 Use SWIFT_SDK_${prefix}_USE_ISYSROOT to select which SDKs should be building with -isysroot (#33469) 2020-08-14 14:33:28 -07:00
Mishal Shah
83c57f3e58 [Apple Silicon] [Build] Filter out any architectures that are unsupported by the SDKs 2020-07-02 19:05:45 -07:00
Saleem Abdulrasool
756bc505f7 build: correct variable in SDK configuration
The variable was supported to be set to the triple, except it was set to
the variable itself, effectively setting the variable to nothing.  This
is needed to clear the path to directory style installation for
non-Apple targets.
2020-05-23 16:45:10 -07:00