Commit Graph

1631 Commits

Author SHA1 Message Date
Andrew Trick
10cc06f167 Merge pull request #19911 from atrick/cmake-stdlib-exclusivity
Fix cmake flag: SWIFT_ENABLE_STDLIBCORE_EXCLUSIVITY_CHECKING
2018-10-20 18:37:04 -07: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
Saleem Abdulrasool
9e30ae35d0 build: fix parameter name in cmake
Fix the parameter name in `_add_swift_library_single` which would
previously not pass any value for the `INSTALL_IN_COMPONENT` due to a
missed alteration when the function was refactored.  Spotted by
inspection.
2018-10-16 17:28:15 -07:00
Andrew Trick
8b9c37d153 Fix cmake flag: SWIFT_ENABLE_STDLIBCORE_EXCLUSIVITY_CHECKING 2018-10-16 08:53:16 -07:00
Saleem Abdulrasool
ef14e9dc02 build: replace some is_darwin_sdk usage
Use the simpler inline form of the check in most places.  The two sites
that remain have multiple uses in a single function.  It should be
possible to replace those as well, though it is unclear if the overhead
of inlining the check to all the places in the function will make a
measurable difference.
2018-10-15 18:00:43 -07:00
Saleem Abdulrasool
f0beaf2c6f Merge pull request #19861 from compnerd/symlinks
build: workaround incorrectly cased import libraries in WinSDK
2018-10-13 09:10:57 -07:00
Saleem Abdulrasool
28997eb273 Merge pull request #19823 from drodriguez/remove-unused-linker-variables
Remove unused variables from Android configuration
2018-10-12 15:17:27 -07:00
Saleem Abdulrasool
dae761fbd5 build: workaround incorrectly cased import libraries in WinSDK
The Windows SDK proides kernel32.Lib which on case sensitive file systems will
fail (due to the capital L in the extension).  Workaround that by creating
symbolic links to handle this.  This mirrors the technique used in LLVM.
2018-10-12 14:44:34 -07:00
Daniel Rodríguez Troitiño
8fb8b39e9f Remove unused variables from Android configuration 2018-10-09 17:15:47 -07:00
Saleem Abdulrasool
ab5d729ae0 build: extract the C++ header search path for android
Extract the C++ header search path from the system header search path.  This is
needed to ensure that we do not push the C++ headers into the swift compiler
search path.  The reason here is that when building the module, we would attempt
to include the C++ headers, which we cannot do since the ClangImporter in swift
explicitly sets the langugage to C.  This would break the stdlib build for
android.
2018-10-09 15:41:22 -07:00
Saleem Abdulrasool
b76af893ec build: fix the variable name
The parameter name was not changed, resulting in the string conversion
not working properly for the Windows builds.
2018-10-08 15:53:13 -07:00
swift-ci
505d83983b Merge pull request #19773 from compnerd/vscompat 2018-10-08 15:36:24 -07:00
Saleem Abdulrasool
5b71e5f0f7 build: fix compatibility with VS2017 and VS2015
Adjust the build to work with the VS2017 layout while maintaining the
compatibility with VS2015.  The library location changed which results in the
link failing due to not finding system libraries.
2018-10-08 13:24:50 -07:00
Saleem Abdulrasool
8c0fa0e13a build: prevent printing for unused variables for SDK
Reduce some of the SDK configuration printing for non-Darwin
configurations.  This simplifies the output and SDK configuration.  The
parameter reduction simplifies the setup for cross-compilation.
2018-10-08 09:52:29 -07:00
Saleem Abdulrasool
392082fec6 build: remove unneeded variables for non-Darwin SDKs
This alters the SDK configuration to remove the variables that don't
impact the target configuration.  Simply don't define them.
2018-10-08 09:52:29 -07:00
Saleem Abdulrasool
4880b94dfd build: remove sdk parameters which can be computed
The prefix and platform names are case adjusted values of the name of
the SDK.  Compute the value rather than pass them down.  The
simplifications will yield an easier cross-compilation implementation.
2018-10-08 09:52:29 -07:00
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