Commit Graph

1144 Commits

Author SHA1 Message Date
Saleem Abdulrasool
b2b8048b3f build: split out host and target library builds fully
Remove this special case handling for building a host library as a target
library.  This is the last piece needed to support cross-compiling lldb.  As a
bonus, it cleans up some of the logic in our special build system.
2018-10-30 10:56:14 -07:00
Devin Coughlin
c119bfaaba [Build] Relax CMAKE_C_COMPILER_ID "Clang" check to match AppleClang
In https://github.com/apple/swift/pull/19973 the logic that adds "-target" when
building the C parts of the Standard Library and overlays was changed to use
CMAKE_C_COMPILER_ID to only do so when the compiler ID is "Clang". However,
on Apple toolchains the compiler ID is "AppleClang", so the target was no
longer being explicitly set.

Update the logic to relax the explicit check for "Clang" to also allow
"AppleClang".

rdar://problem/45579667
2018-10-29 18:01:30 -07:00
swift-ci
ecf29e694a Merge pull request #20115 from compnerd/wimplib 2018-10-28 18:28:44 -07:00
Saleem Abdulrasool
af8fc10bd1 build: install the import libraries for windows
When building the target libraries, we need to install the import
library as well.  Unfortunately, due to the way that the swift build
system works, we do not have the ability to rely on CMake doing the
right thing and taking care of this for us.  We have to manually
construct and track the import library due to the fact that we fight the
cross-compilation support.  Add some logic to extract the import
libraries and install them so that uses can actually build for Windows.
2018-10-28 13:08:50 -07:00
Saleem Abdulrasool
ecf0b58d72 build: remove unused options in add_swift_host_library
Debride the function now that it is handles only the host libraries for
the tools.  These are closer in spirit to the LLVM libraries and this
function can really become a trivial wrapper around llvm_add_library.
2018-10-28 10:45:42 -07:00
Michael Gottesman
aba53ee0ca Merge pull request #20110 from gottesmm/pr-301c86df6766d9a2fc825201c9c10888ba2d4310
[cmake] Eliminate dead target code from add_swift_host_library and de…
2018-10-27 16:58:52 -07:00
swift-ci
2f2ce13953 Merge pull request #20107 from compnerd/frontend-is-not-cc 2018-10-27 15:39:29 -07:00
Michael Gottesman
1e6d9482b1 [cmake] Eliminate dead target code from add_swift_host_library and dead host code from add_swift_target_library. 2018-10-27 15:30:28 -07:00
Michael Gottesman
3f17bb6ddf Carefully split the build's invocation of add_swift_library into host/target variants.
The key thing here is that all of the underlying code is exactly the same. I
purposely did not debride anything. This is to ensure that I am not touching too
much and increasing the probability of weird errors from occurring. Thus the
exact same code should be executed... just the routing changed.
2018-10-27 12:58:51 -07:00
Saleem Abdulrasool
d4ea2781e8 build: pass the Windows headers properly
The Windows headers are the system (sysroot) headers.  They are not
consumed by swift but the clang importer.  Furthermore, they should be
treated as system headers.  Correct the flags used for the invocation.
This fixes the build of the SDK overlay for Windows.
2018-10-27 11:38:30 -07:00
Michael Gottesman
b36c6e5dd6 [sil-ownership] Enable ownership verification on all of the stdlib libraries.
rdar://29791263
2018-10-26 12:09:53 -07:00
Jordan Rose
6cd780395b [CMake] Make GNU-style response files for long argument lists (#18958)
...i.e. an actual shell-like argument list, rather than a
semicolon-separated list (CMake's internal stringification mechanism
for lists). Apart from being a little easier to read, this also works
directly with the response file support in swiftc itself now (not
depending on utils/line-directive).

(It's still not /quite/ enough to expand on a command-line, though,
since that will escape the quotes. The 'sed' command can get around
that: $(sed "s/'//g" foo.txt).)
2018-10-23 19:45:56 -07:00
Saleem Abdulrasool
15355ab20a build: be more conservative when passing -target
When building the swift tools with gcc, we would fail as we would try to
pass `-target` to gcc, which does not support this option.  Invert the
condition and only pass the argument when building with clang.
2018-10-21 15:30:49 -07:00
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