Commit Graph

1741 Commits

Author SHA1 Message Date
Rintaro Ishizaki
b61538ec61 [CMake] Remove SetRPATH.cmake
This used to overwrite the RUNPATH when copying libraries from
earlyswiftsyntax directory. Since earlyswiftsyntax is now replaced with
FetchContent, we don't need this anymore
2023-09-18 14:44:12 -07:00
Rintaro Ishizaki
8909c8a56e [CMake] Centralize the logic to get host '-target' tripple
And pass the value to 'swift-syntax', so they gets correct deployment
target.
2023-09-18 14:44:12 -07:00
Ben Barham
041691184c [CMake] Replace early swift-syntax with FetchContent
Use FetchContent to include swift-syntax directly in swift. This can be
thought of as an `add_subdirectory` for a directory outside the root.

The default build directory will be `_deps/swiftsyntax-subbuild/`, though
the modules and shared libraries will be built in `lib/swift/host` by
passing down `SWIFT_HOST_LIBRARIES_DEST_DIR` to avoid copying them as we
were doing previously.
2023-09-18 14:44:10 -07:00
Mishal Shah
5b73dd6929 Bump the Swift version to 5.11 2023-09-18 09:37:38 -07:00
swift-ci
fd6bccadac Merge remote-tracking branch 'origin/main' into rebranch 2023-09-16 17:14:07 -07:00
Evan Wilde
94c2be87da Merge pull request #68561 from etcwilde/ewilde/add-missing-clang-dep-edge
Add dependency edge between dispatch and clang
2023-09-16 16:59:59 -07:00
Evan Wilde
5ac32e7a3f Add dependency edge between dispatch and clang
The dispatch that's built into concurrency on Linux and Windows is built
with clang, but there's no dependency edge. Usually this isn't noticed
because concurrency and most the things it depends on also depend on
clang directly, but occasionally ninja will choose the dispatch build
before building other dependencies, which then fails because there's no
clang.
2023-09-15 14:37:41 -07:00
swift-ci
7f9c90fb48 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-12 23:38:32 -07:00
Eric Miotto
5b69b93858 Ensure module tracing is off when checking disable-implicit* flags (#68453)
In some internal configurations we set the
`SWIFT_LOADED_MODULE_TRACE_FILE` environment variable when running the
build of the compiler -- as a result, this causes `-parse` to always
fails, preventing to detect properly if we can use `disable-implicit*`
flags.

Addresses rdar://115338219
2023-09-12 23:20:08 -07:00
swift-ci
95f9244aaf Merge remote-tracking branch 'origin/main' into rebranch 2023-09-08 12:33:48 -07:00
Rintaro Ishizaki
891d7b728b [CMake] Use explicit RPATHs for unit test executables
Instead of letting CMake set RPATH of the test executables, use
INSTALL_RPATH and BUILD_WITH_INSTALL_RPATH just like other executable
and shared libraries.

Previously when a swift module link with exported swift-syntax targets e.g.
'SwiftSyntax::SwiftParser', the libraries in earlyswiftsyntax were used
instead of the copied libraries in the swift build directory. That
wasn't ideal.
2023-09-08 16:43:26 +00:00
swift-ci
7fed4ac81f Merge remote-tracking branch 'origin/main' into rebranch 2023-09-07 12:38:47 -07:00
Saleem Abdulrasool
881d6f988c Merge pull request #68366 from compnerd/cut-the-wire
build: fix the build of the toolchain
2023-09-07 12:38:31 -07:00
swift-ci
d1abca98df Merge remote-tracking branch 'origin/main' into rebranch 2023-09-07 08:14:37 -07:00
Saleem Abdulrasool
c8e36f66f5 build: fix the build of the toolchain
This wires up the new macro properly into the build machinery to ensure
that the `distribution` target properly builds and installs the
dependencies.  This fixes the missing `swift-plugin-server` on Windows.
2023-09-06 19:40:45 -07:00
Saleem Abdulrasool
00d4879c84 build: adjust the build to support non-Apple environments
Account for import libraries and the associated layout difference on
platforms (e.g. DLLs are placed in `bin`).  This is required to enable
building the macro path on Windows.
2023-09-06 12:45:58 -07:00
swift-ci
c1c764a756 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-01 08:14:48 -07:00
swift-ci
aae06b0943 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-31 22:54:14 -07:00
Saleem Abdulrasool
fe42740f3e build: clean up dependency tracking for portability
`:` is not a valid file system character but is used to namespace the
imported targets.  This is then used to create the stamp file.  Sanitize
the name prior to use as a stamp file name.
2023-08-31 18:08:08 -07:00
Finagolfin
010759da20 [CMake] Tweak path separators in new Swift runpaths 2023-08-31 19:26:32 +05:30
swift-ci
97970caeac Merge remote-tracking branch 'origin/main' into rebranch 2023-08-30 20:55:33 -07:00
Rintaro Ishizaki
8049922861 [CMake] Update host platform check for macro support
"Support Macros in Linux" patches was inconsistent with checking
platforms. Some only checked 'LINUX' but some matches
'LINUX|ANDROID|OPENBSD|FREEBSD'. Although I don't have tested other
platoforms than Linux at all, there's no reason to limit it to Linux.
So use the consistent check to match 'LINUX|ANDROID|OPENBSD|FREEBSD'
2023-08-30 13:52:37 -07:00
swift-ci
484684f0dd Merge remote-tracking branch 'origin/main' into rebranch 2023-08-29 17:55:14 -07:00
Rintaro Ishizaki
f64506976a [CMake] Use RPATH_CHANGE instead RPATH_SET
RPATH_SET is not available until cmake 3.21.0. Use RPATH_CHANGE instead.
2023-08-29 01:12:02 +00:00
Rintaro Ishizaki
dc6877334f [CMake] Stop some exectuable link with swiftCore
swift-compatibility-symbols, swift-def-to-strings-converter,
and swift-serialize-diagnostics don't use any Swift modules. But when
SWIFT_SWIFT_PARSER was enabled, they are linked with swiftCore. But
these binaries can be executed before the runtime is being built.
We need to stop them linking with swiftCore.
2023-08-28 19:10:01 +00:00
Rintaro Ishizaki
757aaa347d [CMake] Set LD_LIBRARY_PATH to builder's runtime when building stdlib
In Linux. Instead of setting temporary "fallback" RUNPATH, Set
LD_LIBRARY_PATH to builder's runtime when building standard library.
So we don't need to strip the temporary RUNPATH when installing.
2023-08-28 01:16:18 +00:00
Rintaro Ishizaki
9017ef51ce [CMake] Update for review comments 2023-08-25 21:58:38 +00:00
Rintaro Ishizaki
2a2787b2d0 Avoid adding redundant temporary RUNPATH to builder's stdlib
Many shared libs and executables are only run after stdlib/runtime are
built. They don't need to link with builders stdlib at all.
2023-08-24 23:10:20 +00:00
Rintaro Ishizaki
9c9010e5b7 [CMake] Support Macros in Linux
For compiling codes required for macro support, we now need swiftc
compiler in the build machine.

Unlike Darwin OSes, where swiftCore runtime is guaranteed to be present
in /usr/lib, Linux doesn't have ABI stability and the stdlib of the
build machine is not at the specific location. So the built compiler
cannot relies on the shared object in the toolchain.
2023-08-24 17:04:15 +00:00
Evan Wilde
1eb0258fa5 Merge pull request #67895 from etcwilde/ewilde/link-or-copy
Link or copy in install_symlink
2023-08-11 10:51:09 -07:00
Evan Wilde
d8acc6e2f1 Link or copy in install_symlink
LLVM install_symlink takes a new argument on whether to create a symlink
or copy binaries when run. -- https://reviews.llvm.org/D145443

The variable that controls this in LLVM is `LLVM_USE_SYMLINKS`, which
defaults to `ON` on Unix-y hosts, but otherwise is false so that Windows
works. This is a configurable option, so Windows configs that can
support symlinks can take advantage of symlinks and save some space.
`LLVM_USE_SYMLINKS` is not exported from LLVM though, so we can't see
it to use. Instead, we have `SWIFT_USE_SYMLINKS`.
2023-08-11 10:47:53 -07:00
Saleem Abdulrasool
abf629b4bf Update Windows-x86_64.cmake
Disable building ORC on Windows.  We currently do not use this library so lets not spend time building it.
2023-08-10 14:33:55 -07:00
Alex Hoppen
ef8e4ac0f3 [AST] Remove gyb_syntax_support
We are no longer using these Python files to generate anything in SwiftSyntax. We can just remove them and instead commit the generated `.def` files.
2023-08-01 17:20:14 -07:00
Evan Wilde
669285fd17 Merge pull request #65534 from stephank/fix/cmake-3.25
build: fix accidental cmake expansions
2023-07-24 09:44:14 -07:00
AlexDenisov
a5f2f76716 CMake: expose Swift version through CMakeConfig.cmake (#67152)
Rationale: we are using Swift compiler as a library in a downstream project and having these exposed would streamline version detection for our use case.
Additionally, this PR makes CMake config a bit more uniform with LLVM/Clang configs.
2023-07-22 13:12:15 -07:00
Max Desiatov
cbc854faab cmake/caches: Update Runtime-WASI-wasm32.cmake (#67475)
Disable features that are currently not available for this platform.
2023-07-22 21:02:17 +01: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
Alastair Houghton
e5ece81cc9 [Freestanding] Remove uses of stat() and dlsym().
We shouldn't be using stat() or dlsym() in the freestanding
runtime.

rdar://111214571
rdar://106555012
2023-06-23 17:05:59 +01:00
Alastair Houghton
4f4d0147ca Merge pull request #66721 from al45tair/eng/PR-110665213
[Threading][TSan] Fix TSan errors from lazy init on Linux.
2023-06-22 20:03:00 +01:00
Saleem Abdulrasool
53e4e19e71 build: add a workaround for ARM64 Windows
MSVC 17.6p3 introduced new ARM64 intrinsics for atomic
(load-acquire/store-release) operations.  Since clang does not support
this yet, force the fallback path to temporarily unblock the build while
we implement support for the `__stlr[8|16|32|64]` intrinsics in clang.

See: llvm/llvm-project#62103
2023-06-21 22:08:59 -04:00
Alastair Houghton
3f0018df97 [Threading][TSan] Fix linkage issue.
We need to pick up the `_swift_tsan_xxx` symbols from libswiftCore in
most cases, but sometimes we're statically linked and in that case we
want to use a local copy.

rdar://1106655213
2023-06-19 17:24:35 +01:00
Max Desiatov
8499aa044c SwiftConfigureSDK.cmake: support freebsd-arm64 2023-06-15 01:11:47 +01:00
Ben Barham
b0b9705ae0 [CMake] Prevent rebuilds of pure swift libraries and executables
`.swiftmodule` is listed as an output of pure swift libraries, but it
isn't updated if there's been no changes (just like the library and
its object files). Add it to the touch hack as well.

Swift *executables* also list `.swiftmodule` as an output, even though
one isn't generated at all. Add a new POST_BUILD command to touch it
regardless.
2023-06-08 20:43:40 -07:00
Ben Barham
7dcebb249c [CMake] Allow install_name_tool to edit pure swift library load paths 2023-06-06 14:02:22 -07:00
Doug Gregor
a41c36934b [CMake] Fix host library builds and rpaths for testing macros
This enables running macro tests on Linux.
2023-05-28 22:20:25 -07:00
Doug Gregor
c9383ff619 [CMake] Add paths for building Swift code against host toolchain
When building Swift code into the compiler (e.g, the new Swift parser
along with macros support), make sure we always add the appropriate
paths to (1) link against the host Swift toolchain, and (2) find the
host Swift libraries (such as SwiftSyntax) at runtime.

The CMake code for doing this was only running for Darwin builds, so
generalize it to also work on Linux.
2023-05-28 17:01:01 -07:00
Kuba (Brecka) Mracek
683985e824 Add missing armv7 variants into the lists of allowed CPU types for the 'freestanding' stdlib builds (#65633) 2023-05-04 08:36:43 -07:00
Saleem Abdulrasool
f7c9a28db2 caches: disable more components for the toolchain build
Windows builds in waves:
  - build build tools
  - build tools (compilers, debuggers, linkers, assemblers)
  - build runtimes (Swift runtime, standard library, experimental libraries)
  - build core libraries
  - build Swift tooling

We do not need to build the C++ interop module at the moment when
building the tools.  This disables that and the extra content which
currently does not result in any artifacts.
2023-04-13 09:26:57 -07:00
Alex Langford
7c52fe21d6 [CMake] Workaround sanitizer flag bug in swift driver
Some versions of the swift driver have a bug where passing `-sanitize=`
does not emit the correct `-fsanitize=` flag for the clang link step.
Although this is being fixed, we must be able to correctly build with older
versions of the swift driver for some period of time. We workaround that
issue by explicitly passing the correct `-fsanitize=` argument
ourselves.

This works around rdar://107733898
2023-04-06 16:58:01 -07:00
Saleem Abdulrasool
ffcb4bb281 cmake: rename Windows ARM64 cache file (NFC)
This makes the name homogenous with the naming of the other files.
2023-04-04 07:46:50 -07:00