Commit Graph

1122 Commits

Author SHA1 Message Date
Evan Wilde
824c66adcc CMake: Improving missing compiler error message
Right now, if you have the new parser enabled and try to configure
without an existing Swift compiler, the configuration fails due to a
call to 'get_filename_component' with the wrong number of arguments.
This is is because the `CMAKE_Swift_COMPILER` is empty and doesn't
expand to anything here:

```
get_filename_component(swift_bin_dir ${CMAKE_Swift_COMPILER} DIRECTORY)
```

The current error is not clear about why it failed though. Improving the
error message so that other people can look at it and see that it's
because the compiler is missing.
2024-08-20 08:57:45 -07:00
Finagolfin
3bd6c6b659 [android][CMake] Enable inline bridging when building the compiler for Android 2024-07-20 17:56:51 +05:30
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
Egor Zhdan
08b4f3ae70 Merge pull request #75173 from swiftlang/egorzhdan/cxx-interop-cmake-option-default
[cxx-interop] Flip the default value of `SWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP`
2024-07-15 12:32:22 +01: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
Egor Zhdan
33cd18b0d5 [cxx-interop] Flip the default value of SWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP
This changes the default value of the CMake flag `SWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP` from `FALSE` to `TRUE`.

C++ interop is an important part of the compiler. If necessary, it's still possible to disable it explicitly.
2024-07-11 15:10:14 +01:00
Hiroshi Yamauchi
9dbdd0ccce Disable SwiftCompilerSources for Windows ARM64.
This fixes the Windows ARM64 toolchain segfault issue in the official build: https://download.swift.org/development/windows10-arm64/swift-DEVELOPMENT-SNAPSHOT-2024-06-03-a/swift-DEVELOPMENT-SNAPSHOT-2024-06-03-a-windows10-arm64.exe
2024-06-21 11:21:03 -07:00
Kuba Mracek
37ed08dc7b Add a build-script + CMake flag to enable/disable building the _Volatile module 2024-06-17 13:18:55 -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
eeckstein
ade04a7945 Merge pull request #73417 from eeckstein/force-bootstrapping
Force enabling SwiftCompilerSources in the build
2024-05-07 07:55:23 +02: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
Erik Eckstein
410b81b447 Force enabling SwiftCompilerSources in the build
This means that `bootstrapping=off` cannot be used anymore.
2024-05-06 17:22:27 +02:00
Erik Eckstein
db507976ad cmake: set default value of BOOTSTRAPPING_MODE to HOSTTOOLS
This was already the intention before, but it didn't work because cmake's `option` only works for boolean variables.
Using `set` instead of `option` fixes that.

This change also enables SwiftCompilerSources in lldb on Windows.
https://github.com/apple/swift/issues/73322
2024-05-06 17:22:27 +02: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
Alastair Houghton
fdc8ffd36f [Build] Updated following initial comments from Eric.
Change the `--linux[-static]-arch` option to `--linux[-static]-archs`, on the
basis that it supports multiple values.

Other tidying.

rdar://123503470
2024-05-02 14:56:18 +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
a014bd2cc8 [Build] Detect ld.gold version and prefer lld if gold is too old.
If we're on a system that has ld.gold 2.35 or earlier, we want to use
lld instead because otherwise we end up with duplicate sections in the
output.

rdar://123504095
2024-04-29 10:48:23 +01:00
eeckstein
e9d6ba9154 cmake: enable SwiftCompilerSources on Windows 2024-04-29 10:52:24 +02:00
Eric Miotto
5f545b43f9 CMake: add option to link Swift content from Darwin toolchain
This is needed in specific Apple internal configurations -- as a result
of the limited applicability, this option is not exposed through
`build-script` on purpose.

Addresses rdar://127014753
2024-04-25 12:48:50 -07:00
Artem Chikin
01d891ad99 Merge pull request #72834 from artemcm/UpstreamVisionOS
Introduce visionOS Platform
2024-04-15 09:33:49 -07:00
Rintaro Ishizaki
a16ad9c274 Merge pull request #71173 from rintaro/cmake-parservalidatoin
[CMake] Add option to perform SwiftParser validation by default
2024-04-12 15:03:31 -07:00
Alastair Houghton
682db94ce5 [Build] Fix host system query for older CMake. (#73001)
`DISTRIB_PRETTY_NAME` is only supported on CMake 3.22 and later, but
we only require CMake 3.19.6.
2024-04-12 09:18:00 -07:00
Artem Chikin
1f14158a1d Introduce VisionOS Platform
This change introduces a new compilation target platform to the Swift compiler - visionOS.

- Changes to the compiler build infrastrucuture to support building compiler-adjacent artifacts and test suites for the new target.
- Addition of the new platform kind definition.
- Support for the new platform in language constructs such as compile-time availability annotations or runtime OS version queries.
- Utilities to read out Darwin platform SDK info containing platform mapping data.
- Utilities to support re-mapping availability annotations from iOS to visionOS (e.g. 'updateIntroducedPlatformForFallback', 'updateDeprecatedPlatformForFallback', 'updateObsoletedPlatformForFallback').
- Additional tests exercising platform-specific availability handling and availability re-mapping fallback code-path.
- Changes to existing test suite to accomodate the new platform.
2024-04-10 09:38:02 -07:00
Evan Wilde
b6d6bd0cf5 Merge pull request #72940 from etcwilde/ewilde/improve-missing-swift-warning
CMake: Improve missing swift warning
2024-04-10 08:40:31 -07:00
Alastair Houghton
e112478d4d Merge pull request #72049 from futurejones/amazonlinux-use-lld-linker
Set default linker to lld for Amazon Linux 2023
2024-04-10 15:26:15 +01:00
Evan Wilde
e2d1403f7b CMake: Improve missing swift warning
Moving the missing Swift compiler warning from a status message to a
warning to make it more prominent. Also providing additional information
on how to fix the situation if it's unexpected.
2024-04-09 15:24:58 -07:00
Mike Ash
0491192337 [Runtime] Remove ExternalGenericMetadataBuilder. 2024-03-21 17:56:17 -04:00
Doug Gregor
f265226550 Merge pull request #72441 from DougGregor/noncopyable-build-cleanup 2024-03-19 19:55:30 -07:00
Doug Gregor
922e3daaea Remove build infrastructure for globally enabling noncopyable types
Now that the compilation model of noncopyable types is enabled everywhere,
and one can enable the feature for specific modules, we no longer need a
separate build-script/CMake option to enable it globally. Remove it all.
2024-03-19 13:35:31 -07:00
Eric Miotto
5aaaae5177 [CMake] Ensure module tracing is off during configuration
Such module usages are not relevant for the final build, they are used
only to detect the capabilities of the compiler.

This generalizes #68453, and would be needed for Apple internal
configurations that set `SWIFT_LOADED_MODULE_TRACE_FILE` when building
the compiler.

Addresses rdar://124954349
2024-03-18 14:56:20 -07:00
Allan Shortlidge
347a1409ba CMake: Pass -no_warn_duplicate_libraries to the linker when supported.
The output of build-script on macOS is currently full of spammy linker warnings
like this:

```
ld: warning: ignoring duplicate libraries: '.../swift-project/build/Ninja-RelWithDebInfoAssert/llvm-macosx-arm64/lib/libLLVMDemangle.a', 'lib/libswiftDemangling.a'
```

Apple's linker complains about duplicate libraries, which CMake likes to do to
support ELF platforms. To silence that warning, we can use
`-no_warn_duplicate_libraries`, but only in versions of the linker that support
that flag.
2024-03-12 22:25:05 -07:00
Daniel Rodríguez Troitiño
42e43edef3 [cmake] Unify usage of create_symlink/copy across the build files. (#72202)
In several places, there was the same or similar code to either do
a symlink or use copy/copy_if_different/copy_directory in Windows
systems. The checks were also slightly different in some cases.

There is a `SWIFT_COPY_OR_SYMLINK` that can be controlled as a CMake
option, and uses `CMAKE_HOST_UNIX` as default. Change all cases that
I can find to use that value. Also create a parallel value
`SWIFT_COPY_OR_SYMLINK_DIR` to apply to directories.

There is still a couple of cases that are specific to macOS SourceKit
framework which I have left as-is, since symlinks is probably the only
right thing to do there.

There's a case for Windows specifically that uses symlinks (in
523f807694/cmake/modules/SwiftConfigureSDK.cmake (L502))
which I have not modified as well.
2024-03-09 18:03:55 -08:00
Yuta Saito
f127c17d0f Merge pull request #71978 from kateinoigakukun/pr-23387a5d8e024a6c8c879f6de94023a575d00ee6
wasm: Add support for WASI threads in CMake build system
2024-03-08 16:57:27 +09:00
Meghana Gupta
f3a85b118f Add build-script option and lit config for nonescapable_types
With this build-script has a flag --enable-experimental-nonescpable-types=1
to enable this feature in stdlib.

Also we can now add // REQUIRES: nonescapable_types to tests which run only when
the compiler is built with this feature turned on.
2024-03-06 21:57:03 -08:00
futurejones
03a364eb62 set default linker to lld for Amazon Linux 2023 2024-03-05 11:19:50 +09: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
Ben Barham
f292ec9784 Use the new template deduction guides rather than makeArrayRef
LLVM has removed `make*ArrayRef`, migrate all references to their
constructor equivalent.
2024-02-23 20:04:51 -08:00
Ian Anderson
1ce3935eb7 [overlay] Make an overlay for the clang _Builtin_float module
Clang's builtin float.h is no longer included in OS/SDK modules, and so it needs its own overlay.

rdar://122351557
2024-02-16 12:31:47 -08:00
Alastair Houghton
e48b05f12c [SwiftCompilerSources] Enable use of the -min-runtime-version option.
Turn on the use of `-min-runtime-version` when building the compiler.

rdar://121522431
2024-02-02 16:19:06 +00:00
Michael Gottesman
2db4b5ca52 [stdlib] Add an option SWIFT_STDLIB_ENABLE_STRICT_CONCURRENCY_COMPLETE to enable building the stdlib with strict-concurrency=complete.
It is currently by default off.
2024-01-29 21:21:05 -08:00
Mike Ash
4bc7726d43 Merge pull request #70900 from mikeash/swift-generic-metadata-builder-out-of-process
[Tools] Add a library to build specialized generic metadata out of process.
2024-01-26 10:50:34 -05:00
Rintaro Ishizaki
810a94cd0f [CMake] Add option to perform SwiftParser validation by default
Disabled by default. We'll enable it for some build presets.

rdar://121545713
2024-01-25 22:32:22 -08:00
Kavon Farvardin
b8cd7effeb Merge pull request #70866 from kavon/ncgenerics-stdlib-building-v4
Build Stdlib with Noncopyable Generics (Part 4)
2024-01-25 07:09:38 -08:00
Mike Ash
4341102c92 [Tools] Add a library to build specialized generic metadata out of process.
This library uses GenericMetadataBuilder with a ReaderWriter that can read data and resolve pointers from MachO files, and emit a JSON representation of a dylib containing the built metadata.

We use LLVM's binary file readers to parse the MachO files and resolve fixups so we can follow pointers. This code is somewhat MachO specific, but could be generalized to other formats that LLVM supports.

rdar://116592577
2024-01-24 20:45:50 -05:00
Saleem Abdulrasool
0d3f6a9f06 Merge pull request #70791 from compnerd/cmark
build: update for cmark build revamp and split the build
2024-01-24 14:40:23 -08:00
Kavon Farvardin
b92fe5f2e9 [build-script] fix NoncopyableGenerics option
This patch introduces `--enable-experimental-noncopyable-generics` for
the build script. It replaces
`--swift-stdlib-experimental-noncopyable-generics`

The old build option only enables the feature when building the
stdlib, but if we've built the stdlib with NoncopyableGenerics, the
compiler should be hardwired to have that feature enabled, too.

This patch also introduces the `noncopyable_generics` lit parameter, so
that tests assuming the system was built with the feature can live
in-tree and be tested, if they specify `REQUIRES: noncopyable_generics`.
2024-01-23 22:41:59 -08:00
Rintaro Ishizaki
0842787707 Merge pull request #70929 from finagolfin/arm
[armv7] Fix static-vtable-stubs test for 32-bit platforms
2024-01-18 16:11:11 -08:00
Saleem Abdulrasool
49a5098db4 build: update for cmark build revamp and split the build
Extricate cmark from the unified build system. This is preparatory work
to support building CMark GFM with dynamic linkage for sharing it across
swift-markdown and the compiler. It also simplifies the build logic for
the unified build.
2024-01-17 08:54:36 -08:00
Finagolfin
c5bb069bee [CMake] Make sure the host tools are being built before setting the bootstrapping mode on Unix platforms 2024-01-16 16:11:43 +05:30
Rintaro Ishizaki
2d527c41db [CMake] Move swift-syntax library definitions to 'lib/SwiftSyntax'
Previously, swift-syntax libraries were built in '/CMakeLists.txt', and
were installed in '/lib/CMakeLists.txt'. Consolidate them into
'/lib/SwiftSyntax/CMakeLists.txt'. Now the swift-syntax libraries look
like any other tool libraries outside the 'lib/SwiftSyntax', as they
should.
2024-01-12 12:52:55 -08:00