Commit Graph

43 Commits

Author SHA1 Message Date
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
Mike Ash
0491192337 [Runtime] Remove ExternalGenericMetadataBuilder. 2024-03-21 17:56:17 -04: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
Ben Barham
119d08c6d1 Merge remote-tracking branch 'origin/main' into 20230929-merge-rebranch
Conflicts:
  - `CMakeLists.txt` caused by the extra `-D` added in rebranch to
    reduce the number of deprecation warnings.
  - `lib/Frontend/PrintingDiagnosticConsumer.cpp` caused by the removal
    of one of the `#if SWIFT_SWIFT_PARSER` on rebranch (probably should
    have been done on main).
2023-09-29 09:50:50 -07:00
Rintaro Ishizaki
8cb651bb69 [CMake] Introduce 'swift-syntax-lib' install component
So that swift-syntax host libraries can be installed independently.
2023-09-18 14:44:13 -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
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
1258d45152 [Backtracing] Build work.
Additional shimming required for some builds, as well as a few other build
related tweaks.

rdar://106234311
2023-03-04 15:46:30 +00:00
Robert Widmann
2d07f382c5 Delete _InternalSwiftSyntaxParser And Its Build Infrastructure
This is the start of the removal of the C++ implementation of libSyntax
in favor of the new Swift Parser and Swift Syntax libraries. Now that
the Swift Parser has switched the SwiftSyntaxParser library over to
being a thin wrapper around the Swift Parser, there is no longer any
reason we need to retain any libSyntax infrastructure in the swift
compiler.

As a first step, delete the infrastructure that builds
lib_InternalSwiftSyntaxParser and convert any scripts that mention
it to instead mention the static mirror libraries. The --swiftsyntax
build-script flag has been retained and will now just execute the
SwiftSyntax and Swift Parser builds with the just-built tools.
2022-11-02 10:35:29 -07:00
Artem Chikin
d24e15812b Build libSwiftStaticMirror as a standalone library with minimal required dependencies.
This separates it from `libSwiftScan` and allows us to build this library without building much of the rest of the compiler.

Also refactor `utils/build-parser-lib` into `utils/build-tooling-libs` which builds both SwiftSyntaxParser and SwiftStaticMirror.
2022-02-09 12:28:21 -08:00
Michael Gottesman
8b8abd6fa2 [cmake] Add a new component llvm-toolchain-dev-tools and make FileCheck installation use it.
This will let me reuse toolchain-dev-tools for tools useful in a just built
toolchain but that are from Swift rather than copied from LLVM.
2021-11-05 20:37:54 -07:00
Doug Gregor
3f749dc13b Add an option to build the concurrency library for back deployment.
Introduce an additional build product to build-script to build
back-deployable concurrency libraries. These libraries would need to
be embedded in apps deployed prior to macOS 12/iOS 15 to support
concurrency.

The built-script option `--back-deploy-concurrency` can be provided to
build these back-deployment libraries. They are built in addition to
the normal concurrency libraries, as a separate product that installs
into `lib/swift-5.5/<platform>` within the toolchain. The macro
`SWIFT_CONCURRENCY_BACK_DEPLOYMENT` is set when building the
concurrency library, so that we can adapt the implementation to older
OS's.
2021-08-26 08:49:43 -07:00
Alex Langford
61be4d969f [CMake][NFC] Introduce component targets for proper dependency tracking
This commit introduces a CMake target for each component, adds install targets
for them, and switches build-script-impl to use the target `install-components`
for installation. Each of the targets for each component depends on each
of the individual targets and outputs that are associated with the
corresponding swift-component.

This is equivalent to what already exists, because right now install rules are
only generated for components that we want to install. Therefore, this commit
should be an NFC.

This is a resubmission (with modifications) of an earlier change. I originally
committed this but there were problems with some installation rules.
2019-08-22 10:16:50 -07:00
Ben Langmuir
327c666b8a Revert "[CMake][NFC] Introduce component targets for proper dependency tracking" 2019-08-08 16:35:59 -07:00
Alex Langford
50a0e87c69 [CMake][NFC] Introduce component targets for proper dependency tracking
This commit introduces a CMake target for each component, adds install targets
for them, and switches build-script-impl to use the target `install-components`
for installation. Each of the targets for each component depends on each
of the individual targets and outputs that are associated with the
corresponding swift-component.

This is equivalent to what already exists, because right now install rules are
only generated for components that we want to install. Therefore, this commit
should be an NFC.
2019-08-08 11:50:35 -07:00
Alex Langford
3d9a28925b [CMake] Modify swift_install_in_component to support cmake install components
CMake supports the notion of installation components. Right now we have some
custom code for supporting swift components. I think that for installation
purposes, it would be nice to use the CMake component system.

This should be a non-functional change. We should still only be generating
install rules for targets and files in components we want to install, and we
still use the install ninja target to install everything.
2019-04-19 14:06:11 -07:00
Michael Gottesman
39846a31e8 [cmake] Remove stdlib-experimental from the default install components.
These are mostly private stdlib APIs. It doesn't really make sense to install
private stdlib APIs by default.
2019-04-10 08:33:56 -07:00
Xi Ge
db0f39fc9a cmake: install swift-api-digester and swift-api-checker into the OSS toolchain. SR-10220 2019-03-29 11:47:17 -07:00
David Zarzycki
6b2561876f [CMake] Don't install FileCheck by default
Not everybody can or does use the "build-script" and the build-script
can easily opt into this if it wants.
2019-02-25 06:41:06 -05:00
Ben Langmuir
2d5fbb9f18 Re-apply "Set a reasonable default for SWIFT_INSTALL_COMPONENTS"
This reverts commit 77689f5945 (#22079)
2019-01-28 16:25:58 -08:00
Jordan Rose
77689f5945 Revert "Set a reasonable default for SWIFT_INSTALL_COMPONENTS" (#22079) 2019-01-23 19:35:09 -08:00
Ben Langmuir
aac60468a2 Set a reasonable default for SWIFT_INSTALL_COMPONENTS
Previously, build-script-impl would set this to "" by default, resulting
in nothing being installed with --install-swift unless you explicitly
set --swift-install-components as well.  Now we defer to cmake by
default.

On the cmake side, change the default value to exclude
* dev - uses a lot of disk space and usually not something you want to
  install into a toolchain
* clang-resource-dir-symlink & clang-builtin-headers-in-clang-resource-dir -
  these are mutually exclusive with clang-builtin-headers
* sourcekit inproc/xpc - these are currently mutually exclusive, so pick
  the best one for the current platform.
2019-01-16 14:48:02 -08:00
Argyrios Kyrtzidis
39019f2292 [CMake] Add 'parser-lib' install component and install the relevant files
The files go into 'lib/swift' so that SwiftSyntax can import the library without needing custom search paths to be added to the swiftpm invocation.
2019-01-10 09:10:11 -08:00
Michael Gottesman
f0fb3cf70f [gardening] Invert an if condition to reduce indentation. 2018-11-28 23:18:27 -08:00
Harlan Haskins
0a861af752 [CMake] Remove swift-syntax install component 2018-11-13 17:29:01 -08:00
Michael Gottesman
1aeb6d54f7 [gardening] Fix documentation thinko.
I was re-reading this documentation and noticed an obvious 'thinko'. This is NFC
since I am just updating the comment.
2018-02-06 21:21:04 -08:00
George Karpenkov
020801beb4 Update -sanitize=fuzzer option to take into account new libFuzzer location. (#11595) 2017-08-28 17:16:55 -07:00
Harlan
ade67ca899 [Syntax] Swift libSyntax API (#11320)
* Create Swift libSyntax API

This patch is an initial implementation of the Swift libSyntax API. It
aims to provide all features of the C++ API but exposed to Swift.

It currently resides in SwiftExperimental and will likely exist in a
molten state for a while.

* Only build SwiftSyntax on macOS
2017-08-14 16:47:48 -07:00
George Karpenkov
efe143c2f4 Adding support for -sanitize=fuzzer flag (#11381)
Similarly to Clang, the flag enables coverage instrumentation, and links
`libLLVMFuzzer.a` to the produced binary.
Additionally, this change affects the driver logic, and enables the
concurrent usage of multiple sanitizers.
2017-08-07 18:16:51 -07:00
Doug Coleman
8c2bd5ae23 cmake: Initial standalone overlays builds.
./utils/build-overlay AVFoundation OSX macosx
rdar://problem/28707246
2017-03-14 12:51:42 -07:00
Argyrios Kyrtzidis
07148f1971 [CMake] Simplify handling for SWIFT_INSTALL_EXCLUDE_[component] option, NFC. 2016-11-30 10:09:49 -08:00
Argyrios Kyrtzidis
446db97367 [CMake] Check if a cmake variable 'SWIFT_INSTALL_EXCLUDE_[component]' is set for a component.
In which case the 'SWIFT_INSTALL_[component]' will be FALSE.
This is useful to get the behavior where all components are set to install by default and exclude just a specific one.
2016-11-28 08:54:37 -08:00
Brian Gesiak
7fbf5014f0 Merge pull request #4999 from modocache/cmake-in-list
[cmake] Enable IN_LIST compare policy
2016-09-29 15:45:01 -04:00
Chris Bieneman
f89461bf22 [CMake] NFC. Updates based on post-merge feedback
* Ensure LLVM_CMAKE_DIR is always set so it can be used
* Use LLVM_CMAKE_DIR instead of searching the module paths
* Label parameters of cmake_parse_arguments in comments
2016-09-28 22:21:03 -07:00
Brian Gesiak
3123b47602 [cmake] Enable IN_LIST compare policy
Enable CMake policy CMP0057, which allows `if()` statements to use the `IN_LIST`
operator. In addition, simplify several `if()` statements that used the
`list(FIND ...)` operation instead.
2016-09-28 22:35:05 -04:00
Chris Bieneman
58ca217e8d [CMake] Fix bad dependency in symlink_clang_headers
The problem here is a bit complicated. The symlink_clang_headers target creates two symlinks to clang's headers, one under the build directory at lib/swift/clang, and the other under a temporary path.

The one under the temporary path is a bad symlink, and it is only created during the build so that it can be installed. It isn't actually used by the build. Ninja treats the bad symlink as a non-existing file, and since the build rule that creates it has the restat property on it this results in the commands to symlink the clang headers directory running over and over and over again during the build.

This patch prevents that by not generating the bad symlink during the build. Instead we generate it at install time using the LLVMInstallSymlink script that is vended as part of LLVM's distribution.
2016-09-27 15:29:29 -07:00
Michael Gottesman
f1ae1f176c Revert "Define swift include build components but dont wire them up" 2016-08-28 15:49:33 -07:00
Michael Gottesman
de3a7d78d1 [cmake][swift-components] Introduce SWIFT_{INCLUDE,BUILD}_COMPONENTS
We also validate that each one of the given components sets are actually sets
and in addition are disjoint from each other.

In order to make sure that this is a NFC change, add all components to all 3
variables. This ensures that we preserve normal behavior of generating cmake
targets for all components and building all components by default even when
nothing is passed in to be installed.
2016-08-28 13:32:51 -07:00
Michael Gottesman
a40e4194ec [cmake] Merge swift_configure_install_components into swift_configure_components. 2016-08-28 12:43:33 -07:00
Michael Gottesman
2c96a8e044 [cmake] Document the component system via the "Swift Component Manifesto". NFC. 2016-08-27 20:04:02 -07:00
Michael Gottesman
b3180657ea [cmake] Refactor swift defined component code from the main CMakeLists.txt => cmake/modules/SwiftConfigure.cmake. 2016-08-27 20:04:02 -07:00
Michael Gottesman
b35d2b38e2 [cmake] Refactor two empty string precondition checks to use the precondition function.
Removing unnecessary control flow in favor of expressing intent in actual words
is clearer to read and requires less text.
2016-07-25 12:05:44 -07:00
Michael Gottesman
df344a8fb7 [cmake] Rename SwiftInstallComponents.cmake => SwiftComponents.cmake. NFC
In the next little bit I am going to be creating a more complex components
system. In order to help with this, I am renaming SwiftInstallComponents =>
SwiftComponents.cmake to reflect the broader purpose.
2016-07-21 13:51:56 -07:00