Commit Graph

1727 Commits

Author SHA1 Message Date
Saleem Abdulrasool
5054a22d0b build: hard code the triple into the SDK configuration
Rather than computing the triple first and passing it down to the SDK
configuration, hard code the triple into the SDK's configuration.  This
is a value which is static and will allow us to configure
cross-compilation of the standard library for Linux.  Although most
other targets do not support the same variety of architectures, this
enables those to be cross-compiled as well.
2018-10-08 09:52:29 -07:00
Saleem Abdulrasool
f02cd8f6f1 build: remove unnecessary parameter to configure_sdk_unix
Remove the duplicated platform name parameter to the unix SDK
configuration..  This value is implicit currently and can be computed.
This needs to be computed to permit parallel co-installations of
architectures for targets which do not support fat binaries (i.e.
non-MachO targets).
2018-10-08 09:52:29 -07:00
Saleem Abdulrasool
f0885be6a0 build: allow specifying the Linux SDK path
The SDK is a sysroot.  Permit the user to specify the location of the
SDK when building Linux.  This is in preparation to cross-compile the
Linux standard library.

While we are exposing more control knobs to the user, we can start
simplifying `configure_sdk_unix`.
2018-10-08 09:52:29 -07:00
Saleem Abdulrasool
6d2ea53dfd build: workaround cross-compilation for Windows
When cross-compiling the Windows standard library in release mode, we
would get undefined symbols due to LLVM invoking
`add_definitions(-D_DEBUG)`.  This would change the behaviour of certain
functions from MSVCRT resulting in undefined symbols.  Scrub out the
unwanted `-D_DEBUG`.
2018-10-05 15:58:29 -07:00
Jordan Rose
c38fcc1e96 [Driver] Expose -emit-parseable-module-interface[-path]
Commit to a command line option spelling so that build systems can
start testing it. I deliberately picked one of the longer names we
were considering because we can always decide to add a shorter alias,
but can't decide a shorter name was too generic.

Like the other supplementary output flags,
-emit-parseable-module-interface-path will emit a .swiftinterface file
to a particular path, while -emit-parseable-module-interface will put
it next to the main output (the one specified with -o).

rdar://problem/43776945
2018-10-04 17:50:04 -07:00
Saleem Abdulrasool
a4d06887df build: simplify a condition further (NFC)
Cleanup the nested conditions here as per Ross' suggestion.  NFC.
2018-09-24 14:55:10 -07:00
Saleem Abdulrasool
9a0422565c Merge pull request #19491 from compnerd/simplify-add-library
[CMake] Simplify add_swift_library
2018-09-24 14:47:36 -07:00
Saleem Abdulrasool
7974e391a9 build: collapse two checks into a single one (NFC)
Merge two cases into a single case rather than keeping them separate.
Additionally check the condition early rather than perform the action
and then revert it.  NFC.
2018-09-24 11:30:50 -07:00
Saleem Abdulrasool
d426a71e1d build: remove nested tautological condition (NFC)
The entire if block is in the `SWIFTLIB_TARGET_LIBRARY` condition, so
these checks add nothing but a level of indentation.  (NFC)
2018-09-24 10:53:24 -07:00
Saleem Abdulrasool
36f77a8901 build: hoist architecture independent variables (NFC)
Hoist out the some of the architecture independent variables outside of
the inner loop.  This should simplify the logic for the function and
improve generation times.  (NFC)
2018-09-24 10:53:18 -07:00
Saleem Abdulrasool
583ceaede5 build: support android aarch64
This adds the needed support to enable building the standard library for android
aarch64 assuming that the appropriate parameters are passed to CMake.
2018-09-24 09:55:10 -07:00
Saleem Abdulrasool
0494ab651e build: hardcode the android triple in the SDK configuration
The SDK configuration can identify the triple for the android targets.  This is
similar to the Windows behaviour.  Doing so will now enable multi-architecture
builds!
2018-09-24 09:54:54 -07:00
Saleem Abdulrasool
30a4853177 build: remove SWIFT_ANDROID_SDK_PATH
The path to the SDK can be computed from the NDK.  Do so to reduce the
parameters needed to pass to CMake.  More importantly, this will allow building
with multiple architectures simultaneously.
2018-09-24 09:54:45 -07:00
Saleem Abdulrasool
777bd91a15 build: rename a variable to be more descriptive (NFC)
This variable is the build host, not a suffix.  Name it appropriately.  NFC.
2018-09-24 09:54:38 -07:00
Saleem Abdulrasool
5e04c26896 build: inline android specific configuration
The android specific configuration here is the same as the non-android in the
sense that it is setting up the triples for the target.  Simply inline it as it
makes it more obvious what it is doing.  This is preparatory work for adding
support for multiple architectures for Android.
2018-09-24 09:54:26 -07:00
swift-ci
662073e440 Merge pull request #19489 from compnerd/debug 2018-09-23 18:54:58 -07:00
Saleem Abdulrasool
dd6a6d3fd7 build: correct build type check
This corrects the casing which would previously not match.
Unfortunately, the `MATCHES` operator also does not handle the case
insensitivity properly.  This enables building just the standard library
on Linux for Windows.
2018-09-23 16:24:39 -07:00
Saleem Abdulrasool
e7ba154d59 build: avoid passing in --sysroot= twice on Android
This just cleans up the invocation generation for android to avoid passing in
`--sysroot=` twice to the driver with the same value.  This has no impact, but
cleans up the command line so it is easier to see what is going on.
2018-09-21 14:26:17 -07:00
Jordan Rose
bdb3a45c85 Merge pull request #19263 from jrose-apple/install-installer-installest
[CMake] Install swiftinterface files alongside swiftmodules
2018-09-13 10:51:45 -07:00
Jordan Rose
0149129ed3 [CMake] Stop compiling API notes files to a binary format (#19205)
Clang's been able to read the textual format for a long time, and
indeed that's what's used in the SDK. This isn't even really a
performance win because the information is cached in PCMs.

rdar://problem/34293901
2018-09-12 14:19:59 -07:00
Saleem Abdulrasool
d9dde28bf1 build: improve the builds with Visual Studio
Visual Studio's compiler does not accept `-Werror=switch`.  Use the equivalent
`-we4062` option instead.  Avoid using the `--` separate that clang uses to
identify that the options that follow are files and not options on the Visual
Studio compiler to reduce the unnecessary spew when building on Windows.
2018-09-12 12:06:48 -07:00
Jordan Rose
bc80fdd4f5 [CMake] Install swiftinterface files alongside swiftmodules
This may not be their final destination, but at least this will
get them into built toolchains, which means it'll be easier to
do integration testing once all the other pieces are in place.

rdar://problem/43823937
2018-09-11 17:30:50 -07:00
Jordan Rose
99dd1be525 [CMake] Remove unnecessary guard for standalone overlay builds
These should install the swiftmodule and swiftdoc files too.
2018-09-11 17:28:03 -07:00
Saleem Abdulrasool
addfb56061 build: do not use the VFS overlay on MSVC
When building for Windows on Windows using Visual Studio, we would attempt to
pass the clang specific flags to cl.  It would then attempt to treat the overlay
definition as an input and fail.  Although this shouldn't be needed on Windows,
it keeps the builds with clang similar across Linux and Windows.
2018-09-11 10:28:57 -07:00
Saleem Abdulrasool
6fb43d44c7 build: don't define _CRT_USE_BUILTIN_OFFSETOF
This is defined by cl in Visual Studio 2017, and causes a warning.  Do not add
this macro when building with MSVC.
2018-09-11 10:28:57 -07:00
Saleem Abdulrasool
a423cc3b33 Merge pull request #17914 from smeenai/find-package
[CMake] Use NO_CMAKE_FIND_ROOT_PATH for LLVM and clang
2018-09-06 17:06:37 -07:00
Doug Gregor
f8e53d9129 [Standard library] Audit protocol member overrides in protocols.
Add the `-warn-implicit-overrides` flag when building the standard library
and overlays, so that each protocol member that overrides a member of an
inherited protocol will produce a warning unless annotated with either
‘override’ or ‘@_nonoverride’.

An annotation of `override` will mean that the overriding requirement will be treated identically to the overridden declaration. If for some reason a concrete type’s conformance to the inheriting protocol provides a different witness for the overriding requirement than the conformance to the inherited protocol’s witness for the overridden requirement, the witness for the inheriting (more-specialized) protocol will be ignored. A protocol requirement marked ‘override’ only makes sense when the declaration is needed to help associated type inference, which is why the ‘override’ annotations correlate so closely with ABI FIXMEs.

An annotation of `@_nonoverride` means that the two protocol requirements will be treated independently, and may be bound to different witnesses. Use `@_nonoverride` when we might need different witnesses, e.g., because the semantics of the potentially-overriding declaration differ from that of the potentially-overridden declaration. `BidirectionalCollection.index(_:offsetBy:)` is the most obvious example, because the `BidirectionalCollection` ’s version of `index(_:offsetBy:)` allows negative indices. `RandomAccessCollection` ’s version is also marked `@_nonoverride` because it is required to be asymptotically faster than the `Collection` or `BidirectionalCollection` versions.
2018-09-05 13:51:26 -07:00
Jordan Rose
b6b3a1b4a7 [CMake] Generate swiftinterface files next to the stdlib swiftmodules
We're not using them for anything yet, but this will exercise
-emit-interface while we're working on it and make sure that it
doesn't crash when processing complex code like the standard library.
2018-08-24 18:06:06 -07:00
Shoaib Meenai
4b9a1b510c [cmake] Clean up FindICU.cmake
- Get rid of the singular (*_INCLUDE_DIR and *_LIBRARY) variables and
  standardize on the plural ones, since that's also what's used by
  CMake's FindICU module (which was added in 3.7).
- Use PKG_CONFIG_FOUND instead of PKGCONFIG_FOUND, since that's what's
  documented in CMake's FindPkgConfig module. (The latter will be set by
  the find_package call, so it's not incorrect, but it's clearer to use
  the documented variable.)
- Search for the headers and libraries even if pkg-config can't find the
  module, since e.g. we might have ICU somewhere in our CMake search
  path but might not have the pkg-config module for it. We're only using
  the pkg-config results as search hints anyway. (This might result in
  an empty HINTS argument to find_path and find_library, but CMake seems
  to handle that fine.) *This should be the only functional change.*
- Remove ICU_${MODULE}_DEFINITIONS, since it's never used anywhere.
- Don't add the *_INCLUDEDIR and *_LIBDIR variables to the hints, since
  they should be the same as the corresponding *_INCLUDE_DIRS and
  *_LIBRARY_DIRS variables (since we're only searching for a single
  module).

The only intended functional change, as mentioned above, is that we can
now successfully find ICU if its include and library directories are in
the CMake search path but its pkg-config module isn't, which might be
the case in certain cross-compilation or hermetic build scenarios. (It's
compounded by CMake only looking for pkg-config modules in
CMAKE_PREFIX_PATH and not CMAKE_SYSTEM_PREFIX_PATH, which I asked about
in https://cmake.org/pipermail/cmake/2018-August/068109.html).
2018-08-24 12:48:09 -07:00
Ted Kremenek
fb6b24f1c1 Revert "build: extract libdispatch build for swift" 2018-08-13 10:06:45 -07:00
Ted Kremenek
6bbcec56f3 Revert "[CMake] Unbreak unified builds on Linux" 2018-08-13 10:06:04 -07:00
David Zarzycki
cddedb4531 [CMake] Unbreak unified builds on Linux 2018-08-10 06:38:34 -04:00
Xi Ge
be38d8a1d0 cmake: simplify Swift module dependency for Swift host tools. NFC (#18600) 2018-08-09 15:18:37 -07:00
Michael Gottesman
ba3fa2f5d3 Merge pull request #18500 from compnerd/swift-syntax-dependency
build: extract libdispatch build for swift
2018-08-09 14:38:49 -07:00
Arnold Schwaighofer
b05f0b428d Code sign swift-reflection-test executables
They run on a target.
2018-08-09 09:18:04 -07:00
Saleem Abdulrasool
f140734584 build: extract libdispatch build for swift
Extract the ExternalProject handling for libdispatch needed to build
SourceKit on Linux into a separate CMake list.  This will allow us to
pull in a dependency on Foundation as well to allow building SwiftSyntax
on Linux which requires Foundation.  Foundation has a dependency on
libdispatch requiring that the external project handling is centralised.
2018-08-08 13:41:49 -07:00
Joe Groff
8f5cd0881d Add option to control building 32-bit iOS slices.
Not building 32-bit slices saves some time during development when doing iOS builds for things that don't particularly care about bitness.
2018-08-03 11:26:23 -07:00
Alex Hoppen
c8fc286428 Merge pull request #18152 from ahoppen/01-incr-tree-transfer
[libSyntax] Incremental syntax tree transfer
2018-07-25 15:26:57 -07:00
Ben Cohen
df22c3647c [stdlib] Build the standard library as Swift 5 (#18121)
* Update std lib to Swift 5.0

* Disable Unicode.* warnings for now

* Slow path to resiliently handle the case where an unknown rounding rule is passed

* Remove resilience from Encoding/DecodingError (which should only happen on slow paths anyway)

* internal typealiases now need @usableFromInline

* Force inlining on Array._owner.get
2018-07-24 20:47:58 -07:00
Alex Hoppen
d926b74836 [incrParse] Add test cases to test the incremental syntax tree transfer 2018-07-24 16:32:23 -07:00
Shoaib Meenai
4a0274acff [CMake] Use NO_CMAKE_FIND_ROOT_PATH for LLVM and clang
When cross-compiling or specifying a custom sysroot and desiring a
hermetic build, many CMake toolchain files will have a custom
CMAKE_FIND_ROOT_PATH and set the CMAKE_FIND_ROOT_PATH_MODE_* variables
to ONLY, meaning packages will only be searched for in the rerooted
directories. We don't want this rerooting to happen when searching for
the LLVM and clang packages though, since we're specifying our search
paths explicitly and excluding search paths from the system, and we
don't want those explicit search paths to be rerooted.

It's standard to set CMAKE_FIND_ROOT_PATH_MODE_PROGRAM to NEVER instead
of ONLY, since you usually want programs to be found for the build
system and not the host system, so the change for the llvm-config search
is not technically required. It doesn't hurt for consistency though, and
I can envision some scenarios in which it might come in handy.
2018-07-12 12:04:04 -07:00
Ben Cohen
a4230ab2ad [stdlib] Update stdlib to 4.0 and reorganize compatibility shims (#17580)
* Update stdlib to 4.0 and move all compatibility shims into a dedicated source file
2018-06-29 06:26:52 -07:00
Davide Italiano
87f61d4b32 [CMake] Export target libraries.
lldb needs this to link against reflection.
Patch by Michael Gottesman, I take no credit.
2018-06-27 14:42:36 -07:00
Michael Gottesman
c01266bcab [cmake] Add an option to not pass bitcode_hide_symbols to libLTO when embedding bitcode. 2018-06-06 20:22:20 -07:00
Ross Bayer
bfbce3695a Always build the "non-overlay" apinotes when building Platform. (#16851) 2018-05-29 10:34:44 -07:00
Michael Gottesman
1914225e58 [benchmark] When building the benchmark suite via subcmake specify CLANG_EXEC.
Given that we already know the clang that we want the benchmark suite to use,
just specify it explicitly.

rdar://40541972
2018-05-27 21:25:23 -07:00
Saleem Abdulrasool
9e7f0e1475 build: filter -z,nodelete on Windows
LLVM recently added a new ELF-only linker flag that gets exported.
Filter this from  the linker flags too.
2018-05-24 09:25:10 -07:00
Michael Gottesman
5e53730c44 [cmake] Cleanup the cmake used for adding new fuzzer host tools. 2018-05-06 09:29:38 -07:00
Michael Gottesman
06b19d7a44 Merge pull request #16341 from dcci/demanglefuzz
[tools] Add a libfuzzer based swift demangler fuzzer.
2018-05-06 09:15:28 -07:00
Bob Wilson
a71dd66eb2 Merge pull request #16407 from bob-wilson/rdar37053028
[build-script] NFC: Update a comment regarding LLD for Apple platforms
2018-05-04 21:36:53 -07:00