Commit Graph

901 Commits

Author SHA1 Message Date
Saleem Abdulrasool
4356e95c3b Merge pull request #29371 from compnerd/bs-dead-variables
build: cleanup unreferenced CMake variables
2020-01-23 08:14:29 -08:00
Saleem Abdulrasool
a3a88dd16e build: cleanup unreferenced CMake variables
`SWIFT_CMARK_LIBRARY_DIR` is not referenced in the build, remove the
variable.
2020-01-22 17:03:24 -08:00
Saleem Abdulrasool
f1ef08af7c Merge pull request #29363 from compnerd/bs-check
build-script: reduce duplication of check
2020-01-22 15:45:14 -08:00
Saleem Abdulrasool
53c7bb0fbc build-script: reduce duplication of check
This hoists the shared check to the beginning of the product
installation phase.  This can be done as a shared phase option.  In
theory it should be possible to hoist this further to a single check at
the beginning of the phase.
2020-01-22 13:40:58 -08:00
Saleem Abdulrasool
45af79d1a3 build-script: generate options (NFC)
Rather than individually list the options, generate the options which
ensures that options are more uniform and makes it easier to alter them
globally.
2020-01-22 08:23:41 -08:00
Saleem Abdulrasool
4e59d397ca Merge pull request #29340 from compnerd/bs-check
build-script: use more terse checks
2020-01-22 08:19:38 -08:00
Devin Coughlin
89e381ca66 [CMake/Tests] CMake and lit.cfg support for running macCatalyst tests
Add support for testing with macCatalyst to lit.cfg and the test CMake.

This adds lit test features for whether the standard library and runtime was
built with macCatalyst support:

  REQUIRES: maccatalyst_support

The test suite can also be run in two modes: one where the macOS tests
are run as usual (against a zippered standard library, runtime, and overlays)
and another where iOS tests are compiled with the macCatalyst target
triple and executed as macCatalyst processes.

The iOS tests for macCatalyst can be run by passing `--maccatalyst-ios-tests`
to build-script. There are new lit test features to enable a test to specify
whether it supports that environment:

  REQUIRES: OS=maccatalyst
  UNSUPPORTED: OS=macCatalyst
2020-01-21 18:28:17 -08: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
Saleem Abdulrasool
64aebf47c5 build-script: use more terse checks
This uses the bash extension of regex based comparison rather than the
more portable shell approach which is a bit more terse.
2020-01-21 16:39:45 -08:00
Saleem Abdulrasool
1aafd55d16 build-script: add missing options, use more terse syntax
This makes the product computation more terse and adds the missing
options.  The functional aspects of this change include renaming the
`SKIP_BUILD_SWIFT_STATIC_LIBDISPATCH` to `SKIP_BUILD_STATIC_LIBDISPATCH`
which keeps it in line with the other skip options.  We also now list
the option properly.
2020-01-21 11:47:03 -08:00
Saleem Abdulrasool
5a75996d1d Merge pull request #29320 from compnerd/android-is-simple
build-script: android does not do multi-arch builds
2020-01-21 08:25:37 -08:00
Saleem Abdulrasool
b11977a8b3 Merge pull request #29319 from compnerd/atomic-flag
build-script: handle special build rules for non-atomic runtime
2020-01-21 08:17:53 -08:00
Saleem Abdulrasool
9e9d3fd84c build-script: android does not do multi-arch builds 2020-01-20 15:07:54 -08:00
Saleem Abdulrasool
b855260cae build-script: handle special build rules for non-atomic runtime
Move the special flag handling for the non-atomic runtime into the build
system rather than spreading it across the build system and the helper
utilities.
2020-01-20 14:51:27 -08:00
Saleem Abdulrasool
95102bc258 build-script: remove dead CMake options for Swift
The build system does not support fine grained control over the tools.
Ideally we would do this by hooking into the llvm distribution
mechanism.
2020-01-20 14:43:12 -08:00
Ross Bayer
6a5c1662dd Merge pull request #29280 from compnerd/bs-options
build-script-impl: reorganise the option
2020-01-17 16:56:13 -08:00
Saleem Abdulrasool
6f096be5d5 build-script-impl: reorganise the option
This reorders the option list.  It tries to categorise them by area and
then sort them alphabetically.  This should help work through the list
and remove the now defunct options as well as try to reduce the set of
options into different build configurations that we can support and try
to organise the CMake invocations properly.

There is still a group of uncategorised options that should get sorted
out at some point.  However, this is still a huge step forward towards
simplifying (and hopefully eradicating) this monstrous script.
2020-01-17 12:01:25 -08:00
Saleem Abdulrasool
7691188f60 Merge pull request #29267 from xiaobai/simplify-common-c-flags
[build] Simplify common_cross_c_flags
2020-01-17 11:28:21 -08:00
Saleem Abdulrasool
8d21f1bc70 build-script: minor cleanup 2020-01-17 08:57:36 -08:00
Alex Langford
973b962c2f [build] Simplify common_cross_c_flags 2020-01-16 23:06:07 -08:00
Vedant Kumar
f562da97f0 build-script: Don't build compiler-rt for embedded devices (#29256)
Compiler-rt isn't needed for the on-device build.
2020-01-16 16:03:42 -08:00
Alex Langford
6ff8722227 [build] Remove function contains_product from build-script-impl 2020-01-14 18:13:24 -08:00
Saleem Abdulrasool
988b660113 Merge pull request #28862 from xiaobai/fix-thinko
[build] Unify android-arm64 and android-aarch64 in build-script-impl
2020-01-12 17:52:25 -08:00
Eric Miotto
cdb4072e4b [build][gardening] obtain CMAKE_OSX_SYSROOT value once (#29098)
Supports rdar://problem/58347344
2020-01-09 14:21:54 -08:00
Saleem Abdulrasool
d0343aeb31 build: remove more unused functions (NFC)
These build-script-impl functions were not used.  Simply remove them as
they are no longer needed.
2020-01-02 10:25:20 -08:00
Saleem Abdulrasool
51365d9f69 Merge pull request #28961 from compnerd/dispatch-everything
build: remove remnants of libdispatch staging (NFC)
2020-01-02 10:10:00 -08:00
Saleem Abdulrasool
d228fb212d Merge pull request #28959 from compnerd/obsoleted
build: remove `USER_CONFIG_ARGS` (NFC)
2020-01-02 10:09:40 -08:00
Saleem Abdulrasool
5090203430 Merge pull request #28958 from compnerd/deprecated
build: remove workaround for CMake 3.4.0
2020-01-02 10:09:20 -08:00
Saleem Abdulrasool
d2681c0fbb Merge pull request #28957 from compnerd/unused
build: remove unnecessary variable (NFC)
2020-01-02 10:09:04 -08:00
Saleem Abdulrasool
ad94bc8f2e build: remove remnants of libdispatch staging (NFC)
libdispatch is required by Foundation.  The
`FOUNDATION_ENABLE_LIBDISPATCH` flag was removed a while ago from
Foundation itself.  Remove the handling for this option and simplify the
flag handling.
2019-12-27 16:03:30 -08:00
Saleem Abdulrasool
3b578ab25a build: remove USER_CONFIG_ARGS (NFC)
This was deprecated 4 years ago: obsolete the option.
2019-12-27 15:46:25 -08:00
Saleem Abdulrasool
14ecd9fa93 build: remove workaround for CMake 3.4.0
With the dependencies now requiring CMake 3.15, everything is built with
a newer CMake.  This removes the workaround for the 3.4 CMake release.
2019-12-27 15:42:29 -08:00
Saleem Abdulrasool
a1357c1bed build: remove unnecessary variable (NFC)
The `platform` variable already contains the SDK name, no need to create
a new variable for that.
2019-12-27 15:36:18 -08:00
Saleem Abdulrasool
34c7c2f209 build: remove some dead code (NFC)
This removes an unused function in `build-script-impl`.
2019-12-27 15:32:25 -08:00
Alex Langford
540c0204a5 [build] Unify android-arm64 and android-aarch64 in build-script-impl 2019-12-18 14:57:30 -08:00
Alex Langford
a6fd37e128 [build] Remove make_relative_symlink from build-script-impl
Nothing uses this anymore, remove it.
2019-12-18 14:31:54 -08:00
Eric Miotto
f67ccf5c9d Unset IFS after its use in set_build_options_for_host (#28811)
If IFS remains set, it may cause compilation errors due to unanticipated
replacement of characters in some parameters.

Addresses rdar://problem/57927748
2019-12-17 07:43:58 -08:00
Alex Langford
81e3c76c1d [build] Simplify setting SWIFT_HOST_VARIANT and related variables
In the majority of cases, we can derive the value of SWIFT_HOST_VARIANT,
SWIFT_HOST_VARIANT_SDK, and SWIFT_HOST_VARIANT_ARCH from the value of `host`
itself. The goal of this patch is to make those derivations and avoid lots of
manual setting of values. Because we verify that we have a valid host before
doing this, we can be sure that errors should be caught before we try to
deconstruct the host into platform and architecture values.

For situations where you can't derive those values from the host, we leave
existing behavior -- that is, we handle them in a switch statement.
2019-12-12 11:33:34 -08:00
Alex Langford
24d191d1e6 [build] Verify a host is supported when setting build options
By verifying that the host is supported before doing any operations, we can
assume that the host value is properly formed, meaning we can simplify the logic
to set values based on the host. Follow-up commits will do exactly that.
2019-12-12 11:32:00 -08:00
Saleem Abdulrasool
3a24f59d15 Merge pull request #28667 from xiaobai/leaving-my-cmark
[build] Reduce redundancy in setting cmark cmake options
2019-12-11 14:26:40 -08:00
Vedant Kumar
59fe43a7c5 Revert "[build-script] Do not specify LLDB_FRAMEWORK_INSTALL_PATH (#28418)" (#28675)
This reverts commit 486e2e76ba.
2019-12-10 11:46:03 -07:00
Alex Langford
3d50fa829c [build] Reduce redundancy in setting cmark cmake options 2019-12-09 16:16:26 -08:00
Butta
14cc620016 [android] A few tweaks for native compilation and to get more tests working
Now that CMAKE_HOST_SYSTEM_NAME and CMAKE_SYSTEM_NAME are set by default to
Android in the Termux app, make the needed tweaks. Some tests were adapted
to work natively on Android too, adds sys/cdefs.h to the Bionic modulemap,
and includes the start of native Android platform support in the build-script.
2019-12-07 01:01:59 +05:30
Robert Widmann
e6cfd51e3d Merge pull request #28537 from edymtt/skip-clang-tools-extra
[build] allow to skip build of clang-tools-extras
2019-12-03 18:44:22 -08:00
Eric Miotto
ee99bf1f57 [build] prefer picking up sqlite3 from Darwin SDK for llbuild (#28440)
* [build] prefer picking up sqlite3 from Darwin SDK for llbuild

When building llbuild on Darwin platforms, ensure that we prefer the SQLite from the SDK
instead of picking one found elsewhere (e.g. in /usr/include )
Also consider only the SQLite dylib shipped with the OS.

Addresses rdar://problem/57300418
2019-12-03 12:55:17 -08:00
Eric Miotto
f19f97839f [build] allow to skip build of clang-tools-extras
Also at the same time refactor code that composes LLVM_ENABLE_PROJECTS

Supports rdar://problem/57432088
2019-12-03 09:50:14 -08:00
Alexander Sokol
4c8f91db98 [build] SR-11880 skip building compiler-rt with --xcode 2019-12-01 21:32:06 +03:00
Vedant Kumar
486e2e76ba [build-script] Do not specify LLDB_FRAMEWORK_INSTALL_PATH (#28418)
This should be provided by the appropriate lldb cmake cache.
2019-11-21 13:12:52 -08:00
Alex Langford
ac4ac89ece [build] Remove build-script-impl logic to set up project symlinks
Instead of manually setting up symlinks in the project, it would be easier and
cleaner to use LLVM_ENABLE_PROJECT.
2019-11-18 16:10:05 -08:00
swift-ci
4bf1059f52 Merge pull request #28293 from spevans/pr_static_foundation 2019-11-17 01:57:44 -08:00