Commit Graph

29 Commits

Author SHA1 Message Date
Varun Gandhi
dd4a9f3bde [CMake] Enable library evolution for Darwin overlay.
Fixes rdar://70156840.
2020-10-20 20:34:49 -07:00
Saleem Abdulrasool
644b700d62 build: remove python fallback in overlay builds
Remove the Python 2 fallback from the standalone overlay build.  This
is part of the migration to Python 3.
2020-07-28 16:55:24 +00:00
Eric Miotto
39ddc67c3a [build] copy Python detection code into StandaloneOverlays.cmake (#31234)
This is to support workflows that do not rely on reading the main
CMakeLists.txt.

Based upon #30992, #31020

Addresses rdar://62245784
2020-04-23 11:53:24 -07:00
Dario Rexin
6dc4329398 Move SwiftSource.cmake to stdlib 2020-03-08 12:48:34 -07:00
Devin Coughlin
63ce243437 [CMake] Add initial build system support for macCatalyst
This commit adds initial build system support for macCatalyst,
an Apple technology that enables code targeting iOS
to be recompiled so that it can be executed on macOS while still using
iOS APIs. This is the first in a series of commits building out support for
macCatalyst in the compiler, runtime, standard library, and overlays. Swift
for macCatalyst represents the work of multiple people, including
Devin Coughlin, Ross Bayer, and Brent Royal-Gordon.

Under macCatalyst, compiler-provided shared libraries (including overlays)
are built as one of four kinds (or "flavors") of libraries,
each with different install names and Mach-O load commands. This commit
adds the build system infrastructure to produce these different
library flavors.

**macOS-like Libraries**

A "macOS-like" library (such as the GLKit overlay) is a plain-old macOS library
that can only be loaded into regular macOS processes. It has a macOS slice with
a single load command allowing it to be loaded into normal macOS processes.

**iOS-like Libraries**

An "iOS-like" library, such as the UIKit overlay, is a library with a
macOS slice but with a load command that only allows it be loaded into
macCatalyst processes. iOS-like libraries are produced by passing a new
target tuple to the compiler:

  swiftc ... -target x86_64-apple-ios13.0-macabi ...

Here 'ios' (and an iOS version number) is used for OS portion
of the triple, but the 'macabi' environment tells the compiler
that the library is intended for macCatalyst.

**Zippered Libraries**

A "zippered" library can be loaded into either a macCatalyst process or
a standard macOS process. Since macCatalyst does not introduce a new Mach-O
slice, the same code is shared between both processes. Zippered libraries
are usually relatively low level and with an API surface that is similar
between macOS and iOS (for example, both the Foundation overlay and the Swift
Standard Library/Runtime itself are zippered).

Zippered libraries are created by passing both the usual `-target`
flag to the compiler and an additional `-target-variant` flag:

   swiftc ... -target x86_64-apple-macos10.15 \
              -target-variant x86_64-apple-ios13.0-macabi

Just like the -target flag, -target-variant takes a target tuple.
This tells the compiler to compile the library for the -target tuple but
to add an extra load command, allowing the library to be loaded into processes
of the -target-variant flavor as well.

While a single zippered library and slice is shared between macOS and
macCatalyst, zippered libraries require two separate .swiftinterface/.swiftmodule
files, one for macOS and one for macCatalyst. When a macOS or macCatalyst client
imports the library, it will use module file for its flavor to determine what
symbols are present. This enables a zippered library to expose a subset of its
target APIs to its target-variant.

**Unzippered-Twin Libraries**

"Unzippered Twins" are pairs of libraries with the same name but different
contents and install locations, one for use from macOS processes and one for
use from macCatalyst processes. Unzippered twins are usually libraries that
depend on AppKit on macOS and UIKit on iOS (for example, the MapKit overlay)
and so do not share a common implementation between macOS and macCatalyst.

The macCatalyst version of an unzippered twin is installed in a parallel
directory hierarchy rooted at /System/iOSSupport/. So, for example, while macOS
and zippered Swift overlays are installed in /usr/lib/swift/, iOS-like and
the macCatalyst side of unzippered twins are installed in
/System/iOSSupport/usr/lib/swift. When building for macCatalyst, the build system
passes additional search paths so that the macCatalyst version of libraries is
found before macOS versions.

The add_swift_target_library() funciton now take an
optional  MACCATALYST_BUILD_FLAVOR, which enables swift libraries to indicate
which flavor of library they are.
2020-01-21 18:26:13 -08:00
Eric Miotto
4990bc4c1e [build] amend search path for Cmake modules
Since we are not using symlinks anymore, we need to point to the correct
directory with LLVM cmake modules.

Fixes rdar://problem/57294763
2019-11-18 13:34:41 -08:00
Harlan Haskins
c82c9b8210 [ModuleInterfaces] Remove references to 'parseable' interfaces everywhere
Now that we've settled on Module Interface as the name, let's remove the
vestiges of "Parseable Interfaces"
2019-09-13 14:55:48 -07:00
Ross Bayer
03dbada12f [Build System: CMake] Convert SWIFT_DARWIN_SUPPORTED_ARCHS and SWIFT_DARWIN_MODULE_ARCHS into semicolon-separated lists rather than space-separated. 2019-05-29 14:39:08 -07:00
Ross Bayer
4ec60332f9 [Build System: CMake] Add new SWIFT_DARWIN_MODULE_ARCHS CMake cache variable which allows users to specify architectures they wish to configure and build _just_ the .swiftmodule content, even if they are not 'supported' via SWIFT_DARWIN_SUPPORTED_ARCHS. 2019-05-29 13:34:05 -07:00
Ross Bayer
f90cdf563d [Build System: CMake] Add new SWIFT_DARWIN_SUPPORTED_ARCHS CMake cache variable to allow users to specify a subset of architectures they wish to build. 2019-05-29 13:34:05 -07:00
Saleem Abdulrasool
4d5470f905 build: remove unnecessary property sets (NFC)
These properties are extraneous.  They are never queried, and the
`set(...CACHE)` which precedes them will ensure that the value is
cached.  This should be functionally equivalent.
2019-05-17 14:33:19 -07:00
Ross Bayer
d84e2aa115 [Build System: CMake] Add missing SWIFT_STDLIB_LIBRARY_TYPES to the StandaloneOverlay.cmake module. 2019-05-13 16:26:00 -07:00
Ross Bayer
2966af316b [Build System: CMake] Add CMake module paths before importing in StandaloneOverlay.cmake. 2019-05-10 16:39:30 -07:00
Ross Bayer
5c06d77490 [Build System: CMake] Cleanup the StandaloneOveraly CMake module.
Preconditions have been moved to the top of the file. All the variables set have been grouped by kind and a few converted to cache variables for better control when building. This should cut down on merge-conflicts as well."
2019-05-10 15:09:11 -07:00
Ross Bayer
4cddfccbc1 [Build System: CMake] Convert the SWIFT_STDLIB_BUILD_TYPE variable into a CMake cache variable in cmake/modules/StandaloneOverlay.cmake 2019-04-27 22:44:01 -07:00
Ross Bayer
3a95da9a69 [Build System: CMake] Partially revert PR #22840, manually adding the LLVM CMake module path to CMAKE_MODULE_PATH rather than using find_package. 2019-03-08 12:55:44 -08:00
Saleem Abdulrasool
350cf67788 utils: attempt to replace custom variables
CMake defaults to using a special <package>_DIR for finding packages.
Prefer this to import the CMake package for LLVM/Clang/Swift rather than
custom paths.
2019-02-22 18:47:26 -08:00
Slava Pestov
1d8928425a Revert "utils: attempt to replace custom variables" 2019-02-22 19:21:13 -05:00
Saleem Abdulrasool
817597c7f9 utils: attempt to replace custom variables
CMake defaults to using a special <package>_DIR for finding packages.
Prefer this to import the CMake package for LLVM/Clang/Swift rather than
custom paths.
2019-02-14 20:19:08 -08:00
Jordan Rose
bc35b34c64 [CMake] StandaloneOverlay: set components before including apinotes/ (#22592)
Otherwise, we'll think we don't need to install the API notes.

No test because this configuration isn't (yet) tested publicly
anywhere, but it is being tested within Apple.
2019-02-13 17:56:31 -08:00
Ross Bayer
b88edd117e [Build System: CMake] Set the binary dir for the bundled apinotes to the source dir when building the standalone overlays. 2019-01-26 20:41:30 -08:00
Ross Bayer
7c84d14066 [Build System: CMake] Set the binary dir for the generated runtime headers to the source dir when building the standalone overlays (rdar://47558666). 2019-01-25 15:28:06 -08:00
Harlan Haskins
3300762ce4 [CMake] Set SWIFT_ENABLE_PARSEABLE_MODULE_INTERFACES for standalone overlays
This should be true when building standalone overlays as well.
2019-01-17 15:48:52 -08:00
Jordan Rose
bb6c6435d4 [CMake] Include apinotes in StandaloneOverlay.cmake (#21928)
...because the Darwin overlay is responsible for installing them.

Context: Within Apple, overlays are sometimes built separately from
the rest of the Swift project. This doesn't currently work with just
the public repo (rdar://problem/47324189), but it could, and I broke
it with my recent API notes cleanup. This should get things working
again.

rdar://problem/47294352
2019-01-17 10:34:18 -08:00
Greg Parker
41f048410a [build] Fix generated header files in standalone overlay builds. (#21206) 2018-12-14 13:28:53 -08:00
Saleem Abdulrasool
70a32af57b build: make the lipo detection uniform
Change the standalone SDK overlay build and unified build lipo detection
identical.
2018-10-18 12:12:06 -07:00
Doug Coleman
f3ce6b78f4 cmake: Allow version numbers to be cache variables.
This change allows them to be overridden from the command line yet still
keep default values.
2017-03-29 14:39:54 -07:00
Doug Coleman
9adb2385df cmake: Remove non-useful message. 2017-03-15 16:09:50 -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