Commit Graph

39 Commits

Author SHA1 Message Date
Alex Langford
3d9a28925b [CMake] Modify swift_install_in_component to support cmake install components
CMake supports the notion of installation components. Right now we have some
custom code for supporting swift components. I think that for installation
purposes, it would be nice to use the CMake component system.

This should be a non-functional change. We should still only be generating
install rules for targets and files in components we want to install, and we
still use the install ninja target to install everything.
2019-04-19 14:06:11 -07:00
Ross Bayer
d1f4ddc1b3 [Build System: CMake] Install the layouts-*.yaml files in the compiler component. 2019-04-09 11:55:58 -07:00
Mishal Shah
c4626baf88 Un-set CMAKE_C_COMPILER_LAUNCHER and CMAKE_CXX_COMPILER_LAUNCHER in s… (#23806)
[CMake] Add check for distcc before setting CMAKE_C_COMPILER_LAUNCHER and CMAKE_CXX_COMPILER_LAUNCHER
2019-04-08 12:53:35 -07:00
Michael Gottesman
cfbb97af79 [cmake] Add an option to enable/disable creation of "sib" stdlib targets and disable it by default.
These aren't really being used and generating these cause unnecessary configure
time in cmake.
2019-03-07 19:43:39 -08:00
Saleem Abdulrasool
adbb7d7cbd build: simplify condition and IWYU CMake edition
Include a missing CMake module in a couple of locations that we were
using the function.  Simplify a condition to use `MATCHES` rather than
two `STREQUAL`.
2019-02-14 17:35:18 -08:00
Slava Pestov
9f80a9cff0 Copy legacy layouts to stdlib build directory
This adds a new copy-legacy-layouts-${platform}-${arch} target for each
platform and architecture that the standard library is built for.

If the platform and architecture has a corresponding layout file in
stdlib/public/legacy_layouts/${platform}/layouts-${arch}.yaml, the
target copies this file to the build directory; otherwise, it does
nothing.

When building Swift code, the subroutines in SwiftSource.cmake add a
dependency on this target from each Swift code target.

Finally, we ensure that the YAML files are copied into the toolchain
package when building a toolchain.
2019-02-08 14:22:00 -05:00
Michael Gottesman
f13b8eb10b [cmake] Rather than using CMAKE_{C,CXX}_COMPILER and CMAKE_{C,CXX}_COMPILER_ARG1 for distcc, use CMAKE_{C,CXX}_COMPILER_LAUNCHER.
This is a cleaner, more principled way of adding "compiler launcher" support and
ensures that cmake understands that distcc is not the "actual" compiler.

This ensures that when we compile SwiftRemoteMirrors for the host, we do not try
to compile using distcc without needing to reset CMAKE_{C,CXX}_COMPILER_ARG1
(which is unset when compiling things in the stdlib).
2019-02-05 13:22:53 -08:00
Michael Gottesman
b2ae3a8b2c [cmake] Move add_swift_target_executable into the new stdlib cmake directory.
This will ensure that additional target executables can not be added to the rest
of the swift project without anyone noticing since the non-stdlib parts of
Swift's cmake will not have visibility of the declaration unless they change the
cmake lookup paths.
2018-12-11 16:43:49 -08:00
Michael Gottesman
089e3a8ecd [cmake] tools/swift-reflection-test => stdlib/tools/swift-reflection-test.
If one thinks about it, swift's build has two sections: a runtime or target
section (i.e. ./stdlib) and a host section (everything
else). swift-reflection-test is an abberation from that pattern since it is
built for target platforms but is in the section of host tools.

In this commit, I move it into ./stdlib. Beyond being a bitter location
conceptually this will additionally allow me to avoid a dependency cycle in
between the compiler and the stdlib build.

After this, there is only one more target in the compiler code: swift-lang. From
talking with Xi Ge, we can move that into its own separate project as a
package. Once that is done, I will not have any more cycles.
2018-12-09 02:20:33 -08:00
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
Saleem Abdulrasool
686bdd706b build: create a helper function to define custom targets
Replace the duplicated logic for defining the targets for the standard
library variants with a call to a function that creates the targets.
This allows us to easily add variants of the standard library without
having to track all the sites for the name.
2018-09-26 08:48:59 -07:00
Michael Gottesman
5648ef219d [+0-all-args] Clean up remains of +1 convention from the runtime. 2018-07-06 23:10:12 -07:00
Jordan Rose
20ae19ef22 [CMake] Improve Xcode project generation with folders (#15738)
- Re-enable the use of folders with the USE_FOLDER setting. This got
  lost a while ago when we stopped including LLVM's top-level
  CMakeLists.txt.

- Put a bunch of new targets into folders.

Should not affect the built product and definitely shouldn't affect
anyone not building with Xcode (or MSVC, I guess).
2018-04-04 18:22:59 -07:00
Michael Gottesman
4683663cae [cmake] Make sure that we use SWIFT_RUNTIME_ENABLE_GUARANTEED_NORMAL_ARGUMENTS for /all/ of the runtime.
This includes the private stdlib sources since there are some parts of stdlib
unittest that I need to make conditionally +0.

rdar://34222540
2018-01-24 16:50:42 -08:00
Roman Levenstein
c3bc08ec06 Remove any mention of sil-serialize-all related flags from CMake files and build-script-impl
These flags are not needed anymore.
2017-10-21 19:18:15 -07:00
Roman Levenstein
5047e1b475 Enable the serialization of sil_vtables by default and completely remove the -sil-serialize-vtables option
Only sil_vtables of public classes with fixed layout are serialized.
2017-10-21 11:36:12 -07:00
Roman Levenstein
48d9b99675 Remove -sil-serialize-witness-tables flag completely
The functionality is always enabled now and there is no need to have a dedicated flag for it.
2017-10-20 19:45:29 -07:00
Roman Levenstein
9134153bd3 Stop using -sil-serialize-all when building the standard library
We can finally get rid of -sil-serialize-all when building the standard library! This option will be completely eliminated in the future commits.

Instead of serializing just everything as we did before, we now serialize only functions annotated with @_inlineable. This way we can selectively control what needs to be available to the clients. This is an important step towards building a resilient standard library.

While this is a huge change for the serialization of the stdlib, it should be virtually invisible to the clients. For example, there are no noticeable performance regressions on any of the benchmarks.
2017-10-02 14:34:14 -07:00
Robert Widmann
e4bfd600cc Remove SwiftExperimental 2017-08-11 14:21:06 -07:00
Roman Levenstein
2f920c4ad2 Add a new frontend option -sil-serialize-witness-tables to force serialization of SIL witness tables
This option is supposed to be used only for compiling overlays. User code should never be compiled with this option.
2017-06-19 19:49:01 -07:00
Bob Wilson
03ff046afc Replace a cmake option with a preprocessor macro.
When moving to the swift-4.0-branch of LLVM, we started using the
LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING cmake option to turn off those
checks. This was necessary for the stdlib build, where it uses some LLVM
headers without linking libSupport.a, but the cmake option forced us to
disable the checks across the board. It also caused a lot of churn for
people who needed to remove their cmake caches when switching to the new
version of LLVM. This change switches to use a preprocessor macro to
disable the checks only in the context of the stdlib build. It requires
LLVM r295090. rdar://problem/30098953
2017-02-14 11:27:20 -08:00
Michael Gottesman
c9a6532e08 [cmake] Add support for generating targets for a -Onone sib stdlib and a -O sib stdlib, but do not build them by default.
This is useful for engineers who do not want to reconfigure to look at a
-Onone/-O sib stdlib.
2017-01-09 16:39:23 -08:00
SpringsUp
e3c82fb2e3 [CMake] Don't reject AppleClang from building stdlib 2016-12-19 01:45:19 +01:00
Michael Gottesman
7f06ef40dc [cmake] Instead of using EMIT_SIB to generate sib output, just generate targets
for sib/sibgen files for libraries without building them by default.

This will let engineers just cd into the build directory and type:

ninja swift-stdlib-sib
ninja swift-stdlib-sibgen

To generate sib and sibgen files respectively.

There are still some dependency issues in between the sib targets, so to get
this to work well, I would suggest doing a full build and then using these
targets.
2016-12-17 18:38:32 -08:00
Hugh Bellamy
8e576ebccd [CMake] improve support for Clang-CL 2016-12-16 16:33:00 +00:00
Bob Wilson
c2e63dcbc1 Disable sanitizers for the runtime with SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER
My recent change to enable SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER by default
exposed this problem with ASan. There are some places, e.g., the
swift-reflection-dump tool, where we link together Swift runtime code with
other code built by the host compiler. If we try to use the sanitizers
with both compilers mixed together, this can cause link failures.
To get the same coverage, we probably need to sanitize the runtime
separately. rdar://problem/29567862
2016-12-08 19:02:16 -08:00
Brian Gesiak
f12a1323ce [SR-1738] Allow *only* static libraries to be built
This splits the `--build-swift-stdlib` and `--build-swift-sdk-overlay`
arguments into `dynamic` and `static` variants, which makes the
following build command possible:

```
utils/build-script -- \
  --build-swift-dynamic-stdlib=0 --build-swift-dynamic-sdk-overlay=0 \
  --build-swift-static-stdlib=1 --build-swift-static-sdk-overlay=0
```

This command produces *only* static libraries for the stdlib, and no
SDK overlay libraries at all. Many other finely-grained build options
are now possible.
2016-06-24 09:18:24 -07:00
Brian Gesiak
328de9e280 [SR-1738] add_swift_library takes SHARED/STATIC arg
As a first step to allowing the build script to build *only*
static library versions of the stdlib, change `add_swift_library`
such that callers must pass in `SHARED`, `STATIC`, or `OBJECT_LIBRARY`.

Ideally, only these flags would be used to determine whether to
build shared, static, or object libraries, but that is not currently
the case -- `add_swift_library` also checks whether the library
`IS_STDLIB` before performing certain additional actions. This will be
cleaned up in a future commit.
2016-06-16 13:15:58 -04:00
Nadav Rotem
78968ae1af Add a flag to disable building the swift runtime with the just-built compiler. 2016-03-31 17:14:43 -07:00
Dmitri Gribenko
933d95ebf5 Fix distcc after PR #1968, which switched the runtime to build with the just-built Clang 2016-03-31 01:24:50 -07:00
Nadav Rotem
8681578193 Merge pull request #1968 from apple/revert-1955-revert-1928-cleanup
Reapply "Build the Swift runtime using the locally built clang compliler.""
2016-03-30 21:39:11 -07:00
Nadav Rotem
6a11924038 Revert "Revert "Build the Swift runtime using the locally built clang compliler."" 2016-03-30 17:26:35 -07:00
Dmitri Gribenko
495cade645 Drop the libbsd dependency
We were only using arc4random, and now we use C++ <random> instead.  See
also PR #1939.
2016-03-30 17:37:21 -06:00
Nadav Rotem
0c1a8f308a Revert "Build the Swift runtime using the locally built clang compliler." 2016-03-30 11:08:21 -07:00
Nadav Rotem
56eb498a74 Build the Swift runtime using the locally built clang compliler.
This commit makes the swift build scripts use the clang that we build as part of
the build process in order to build the Swift runtime, and not the host
compiler. This change is necessary for using new clang features immediately after they are introduced.
One example for such feature is new function calling conventions, or new c-level attributes.
2016-03-29 13:34:15 -07:00
Slava Pestov
34e41f2e81 built-script: Add --swift-stdlib-sil-serialize-all flag
We want to have the option of building the standard library without
-sil-serialize-all.

For now, the build crashes in the SIL verifier due to various issues;
upcoming patches will address these.

This is part of the larger goal of building the stdlib with
-enable-resilience.

Part of https://bugs.swift.org/browse/SR-267.
2016-03-22 17:13:34 -07:00
Jordan Rose
a4a4a80ac4 [CMake] Don't pass -sil-serialize-all under SWIFT_STDLIB_ENABLE_RESILIENCE.
Thanks, Slava!
2016-02-10 10:29:01 -08:00
Dmitri Gribenko
aeeb9c1325 Move collection testing code from StdlibUnittest to a new library
This brings down StdlibUnittest build time to 90 seconds with either
a DebugAssert or a ReleaseAssert compiler.

The new library, StdlibCollectionTests, is only built when running
validation tests.
2016-01-26 18:58:03 -08:00
David Farler
4ac9c80809 Add back remaining files for building and testing in Open Source 2015-10-31 00:19:20 -07:00