Commit Graph

1731 Commits

Author SHA1 Message Date
Dario Rexin
feb7bb1a06 one more try 2020-02-02 09:53:18 -08:00
Saleem Abdulrasool
c5c7ed17b8 build: hoist LINK_LIBRARIES out of _add_swift_executable_single
Hoist the responsibility for adding the linked libraries out of
`_add_swift_executable_single` to the invoker.  This impacts only
`swift_add_target_executable`.  This continues to bring the computation
of the properties nearer the site of definition.
2020-02-02 08:58:41 -08:00
Dario Rexin
34a331eb4d Fix march flag in unittest 2020-02-02 00:29:09 -08:00
Dario Rexin
6db05fdbca Set march for unittest on Linux 2020-02-01 23:25:31 -08:00
Dario Rexin
d913eefcc9 Remove dependency on libatomic on Linux
Due to some unfortunate interplay between clang and libstdc++, clang was
not able to correctly identify to alignment of PoolRange and
SideTableRefCountBits, causing it to emit library calls instead of
inlining atomic operations. This was fixed by adding the appropriate
alignment to those types. In addition to that the march for the Linux
target was set to 'core2', which is the earliest architecture to support
cx16, which is necessary for the atomic operations on PoolRange.
2020-01-31 15:59:54 -08:00
swift-ci
b5c8853f3f Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-29 10:23:57 -08:00
Eric Miotto
0bd1e61a20 [build][gardening] adjust one more framework path (#29529)
This is a follow to #29507 addressing one more place in which we need to
collate -F with the framework path

Addresses rdar://problem/58934566
2020-01-29 10:09:32 -08:00
swift-ci
e6085cb5cb Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-28 11:23:21 -08:00
Saleem Abdulrasool
1fff12f663 Merge pull request #29511 from compnerd/cohabitation
build: move `compute_library_subdir` to where it is used
2020-01-28 11:08:16 -08:00
swift-ci
10cc7cfcfc Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-28 09:24:15 -08:00
Eric Miotto
5428060ca8 [build][gardening] adjust framework paths (#29507)
Collate -F with the framework path to avoid unwanted deduplication of options by `target_compile_options` (which is the case after #29451) -- this way no undesired side effects are introduced should a new search path be added.

Addresses rdar://problem/58934566
2020-01-28 09:23:46 -08:00
Saleem Abdulrasool
049e384436 build: move compute_library_subdir to where it is used
This function is only used in SwiftSource.cmake.  Locate the function
there to make it easier to find.
2020-01-28 09:22:12 -08:00
swift-ci
0373bc26c1 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-28 08:03:20 -08:00
Saleem Abdulrasool
02b6161aef Merge pull request #29483 from compnerd/duplication-is-good-for-you
build: repair the Windows build
2020-01-28 07:58:12 -08:00
Daniel Rodríguez Troitiño
8777a873a5 Merge pull request #29502 from drodriguez/android-escape-include-paths-correctly
[android] Escape include paths in Android.
2020-01-28 07:53:13 -08:00
swift-ci
e4f3574c7f Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-27 23:04:17 -08:00
Daniel Rodríguez Troitiño
3e42a0f1ca [android] Escape include paths in Android.
Before the result of `_add_variant_c_compile_flags` was a string, so appending several "-isystem" was not a problem. With #29451 the rules have changed since the list is now handled by CMake, and it deduplicates the repeated members in the list. Thanks, CMake.

Should fix the Android CI builds that were failing since the merging of #29451.
2020-01-27 22:51:25 -08:00
Saleem Abdulrasool
a1c971907b build: repair the Windows build
This should repair the Windows build after #29451.  The quoting
behaviour was incorrect and was constructing an invalid compiler
invocation.  Solve the issue by using `target_include_directories`
instead.  However, since this needs the target, hoist the flag
computation to the local sites.  This replicates more logic because of
the custom build trying to replicate the CMake build logic in CMake.
2020-01-27 22:35:28 -08:00
Yuta Saito
68730053f5 Fix mismatch use of target_link_options 2020-01-28 03:58:25 +00:00
swift-ci
91799178d3 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-27 15:43:24 -08:00
Saleem Abdulrasool
fbcb41facf build: simplify the ICU include handling
This simplifies the ICU flags handling.  This inlines the use into just
the library case, as the ICU usage is for the standard library targets
only.  It uses CMake to properly add the include paths as a system
search path.  This should fix the Linux builds as the include flags were
being de-duplicated as we are now using CMake more than we were
previously.
2020-01-27 13:48:09 -08:00
swift-ci
8c23dec23e Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-27 09:04:20 -08:00
Saleem Abdulrasool
efa526ea71 Merge pull request #29451 from compnerd/someone-else-can-do-it
build: use modern target property handling
2020-01-27 08:49:20 -08:00
swift-ci
3137a0acab Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-27 08:44:11 -08:00
Saleem Abdulrasool
e80bb6717c build: remove a hack for clang dependencies
This was introduced in 2014.  This should not be needed any longer,
especially with the use of the clang dependencies being satisfied by
export targets through `Clang_DIR`.
2020-01-26 12:25:46 -08:00
swift-ci
26ab9840a4 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-26 09:03:30 -08:00
Saleem Abdulrasool
80d9e0aab6 Merge pull request #29450 from compnerd/inclusive-builds
build: begin rooting out `EXCLUDE_FROM_ALL`
2020-01-26 08:56:26 -08:00
Saleem Abdulrasool
729ad36b80 build: delegate rpath handling to CMake
This moves the rpath handling to the build system rather than trying to
figure out the correct flags to pass to the driver.
2020-01-25 17:01:07 -08:00
Saleem Abdulrasool
d8b3b626fe build: use modern target property handling
Use specific operations for setting the compile flags, link flags,
linked libraries, and library search paths.  This allows us to use CMake
more effectively, simplifies the logic, and will ensure that flags are
not duplicated.
2020-01-25 16:08:51 -08:00
Saleem Abdulrasool
183de849d4 build: begin rooting out EXCLUDE_FROM_ALL
`EXCLUDE_FROM_ALL` should be discouraged.  `ALL` should build *all*
targets.  If a subset of targets are desired to be built, we should
provide targets which make sense.  Sink the single use of this flag
into the standard library setup.  The custom cross-compilation was
the reason that the flag was plumbed all the way through.  Cleaning
up the macros that have been built up is needed to migrate towards
proper cross-compilation support.
2020-01-24 22:20:07 -08:00
Mike Ash
cd2b54f74e Merge branch 'master' into master-rebranch 2020-01-24 11:30:32 -05:00
Saleem Abdulrasool
07ea64bb9d Merge pull request #29404 from compnerd/edit-your-patterns
build: add imported library for libedit
2020-01-24 08:17:03 -08:00
swift-ci
f324eb6a1e Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-23 15:04:45 -08:00
Saleem Abdulrasool
9d9a5ce340 build: add imported library for libedit
This allows us to use CMake more effectively rather than proliferating
the linking and header search path logic.
2020-01-23 14:14:43 -08:00
Saleem Abdulrasool
a8df8ef03c build: remove FORCE_BUILD_OPTIMIZED
This is used in two places.  Rather than plumbing the option through
everywhere, set the two locations to use compiler-specific optimization
flags.  Note that this improves the optimizations enabled for the debug
build with an optimized type-checker.

This also clears the way to have `add_swift_host_library` be entirely a
trivial wrapper over `add_library` enabling us to finally move towards
more standard CMake rules.
2020-01-23 13:17:25 -08:00
Erik Eckstein
bbfaccda4b Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-22 08:25:23 +01: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
Arnold Schwaighofer
43c24be5cd Merge remote-tracking branch 'upstream/master' into master-next 2020-01-08 06:41:34 -08:00
Xi Ge
7a1ac6b5a4 cmake: add SDK library search path for overlays unavailable in the source
When force linking auto-linked libraries, an overlay will fail to link if the dependence
libraries are missing from the source. This change provides linker flags
to search overlay libraries from the SDK.
2020-01-06 21:17:02 -08:00
swift_jenkins
bb3811a25a Merge remote-tracking branch 'origin/master' into master-next 2020-01-03 16:59:05 -08:00
Saleem Abdulrasool
5f428f594a build: use the new CMark export targets
CMark upstream now provides an exports target entry that we can use.
2020-01-03 14:40:58 -08:00
swift_jenkins
615101cbb5 Merge remote-tracking branch 'origin/master' into master-next 2020-01-02 16:39:11 -08:00
Saleem Abdulrasool
dbc3b433ad build: synchronise with LLDB's version of FindLibEdit
The current FOUND_VAR for FindLibEdit is libedit_FOUND but wasn't set by
find_package_handle_standard_args. However this isn't valid for the
package name.

  The argument for FOUND_VAR is "libedit_FOUND", but only
  "LibEdit_FOUND" and "LIBEDIT_FOUND" are valid names.

This fixes all the variables set by FindLibEdit to match the desired
naming scheme.

Thanks to Jonas for fixing the variable names!
2020-01-02 14:16:58 -08:00
swift_jenkins
81c0ed297a Merge remote-tracking branch 'origin/master' into master-next 2020-01-02 10:19:08 -08:00
Saleem Abdulrasool
1b850a2afd build: improve libedit handling for builds
Use the FindLibEdit.cmake module from LLDB to properly control where
the libedit libraries are searched for and linked from as well as where
the headers come from. This uses the standard mechanisms which allows
users to control where libedit is pulled from (which is important for
cross-compilation).

This second version is more aggressive about pruning the libedit
handling.  The Ubuntu 14.04 version of libedit does not have
`histedit.h`, and the intent is to rely on that to determine if we have
unicode support or not.
2019-12-29 16:32:49 -08:00
Joe Groff
fb34044408 Merge remote-tracking branch 'origin/master' into master-next 2019-12-10 12:46:41 -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
Eric Miotto
a0e7edde67 Merge pull request #28127 from edymtt/search-in-sdkroot
Build: search libraries in Apple SDKs (if needed)
2019-11-21 14:55:16 -08:00
Eric Miotto
88a046c959 Incorporate review feedback from Micheal 2019-11-20 14:27:24 -08:00
swift_jenkins
92d21b9976 Merge remote-tracking branch 'origin/master' into master-next 2019-11-19 08:00:33 -08:00