Commit Graph

15 Commits

Author SHA1 Message Date
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
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
Saleem Abdulrasool
cd216843e1 macros: install the runtime component for Windows
Windows uses the runtime component for the DLL, the library component
for the import library, and archive component for static archives.  This
is in contrast to Darwin that uses library for the DLL and archive for
static archives.

This is required to enable packaging the ObservableMacros.
2023-11-14 12:36:27 -08: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
Rintaro Ishizaki
de4370bba6 Merge pull request #68225 from rintaro/cmake-macroplugins-disabled
[CMake] Handle cases where Swift parser integration is disabled in Linux
2023-08-30 22:32:13 -07:00
Rintaro Ishizaki
ad2dacd404 [CMake] Handle cases where Swift parser integration is disabled in Linux
When Swift parser integration is disabled (i.e. NOT SWIFT_SWIFT_PARSER),
macro plugins targets are not created. So CMake should bail out.
2023-08-30 14:05:41 -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
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
Doug Gregor
0e9c3eff8a [Macros] Add OptionSet and plumb it through 2023-03-03 21:39:16 -08:00
Doug Gregor
e9ebcba6af Fix install path for macro plugin libraries 2023-03-03 17:26:35 -08:00
Doug Gregor
8a16c8b18c [CMake] Don't try to modify a macro target when it wasn't built 2023-03-03 15:01:00 -08:00
Doug Gregor
5786cbd602 [Macros] Make the compiler frontend depend on the macro plugin libraries
The dependency of the Observation library on the observation macro
plugin introduces a direct dependency of a target library on a host
library, (lib -> stdlib) that we'd like to avoid. Instead, make the
Swift frontend binary depend on the macro plugin libraries that we
build, so that it's the complete host-side stack.
2023-03-03 14:58:42 -08:00
Doug Gregor
6b0a0b6555 [CMake] Rework build of ASTGen and ObservationMacros
Refactor the build support for ASTGen and ObservationMacros. Both have
nearly-identical copies of a bunch of messy, workaround-laden CMake
code to build "pure" Swift host libraries using CMake's Swift support.

Instead, introduce `add_pure_swift_host_library` to centralize all of
the hacks to build a host library that's all Swift, using CMake's
support directly (rather than custom commands), and link against the
swift-syntax stack. Switch ASTGen directly over to this.

Add `add_swift_macro_library` on top of this, to make it easy to
create a macro library and install it into the appopriate plugin
directory. Switch ObservationMacros over to this.
2023-03-03 14:01:30 -08:00
Philippe Hausler
40c277b245 Observation and associated macros 2023-03-02 15:30:59 -08:00