Commit Graph

112 Commits

Author SHA1 Message Date
Butta
9ed6766856 [build-script] Move --native-{clang,llvm,swift}-tools-path flags into the Python build-script
Also, fix two places where the LLVM path was wrongly employed to set up clang,
and use the Swift path in install_toolchain_path().
2020-10-27 00:24:46 +05:30
Eric Miotto
303d88ce84 [Build] Remove Differentiation without tgmath (#34409)
Reverts #34116 -- this is no longer needed.

This reverts commit b972bef2ce.
2020-10-23 12:56:23 -07:00
Varun Gandhi
dd4a9f3bde [CMake] Enable library evolution for Darwin overlay.
Fixes rdar://70156840.
2020-10-20 20:34:49 -07:00
Varun Gandhi
a3fc337d01 [CMake] Compile with library evolution for all Darwin platforms.
In practice, SWIFT_HOST_VARIANT_SDK may be IOS or some other non-OSX
Darwin platform.

Fixes part of rdar://70156840.
2020-10-20 19:51:50 -07:00
Eric Miotto
b972bef2ce Add an implementation of Differentiation without tgmath (#34116)
Addresses rdar://68471851
2020-09-30 12:14:35 -07:00
Kuba (Brecka) Mracek
58f2ae695b Add a SWIFT_STDLIB_STABLE_ABI flag to be able to build the stdlib without -enable-library-evolution (#33443) 2020-09-21 16:33:00 -07:00
Kuba (Brecka) Mracek
aa0f8e670b Add a SWIFT_STDLIB_OS_VERSIONING flag to avoid querying OS version at runtime, use it in the freestanding build (#33791) 2020-09-11 08:09:14 -07:00
Kuba (Brecka) Mracek
9de7b59388 Subsume SWIFT_STDLIB_USE_NONATOMIC_RC into SWIFT_STDLIB_SINGLE_THREADED_RUNTIME (#33643) 2020-08-26 21:28:30 -07:00
Kuba (Brecka) Mracek
9ead8d57fa Add a single-threaded stdlib mode, use it for the 'minimal' stdlib (#33437) 2020-08-25 06:03:14 -07:00
Kuba (Brecka) Mracek
db18deaf91 Add a SWIFT_RUNTIME_MACHO_NO_DYLD stdlib mode that doesn't dynamically look up sections in modules, and only assumes a single static module (#33441) 2020-08-18 11:46:42 -07:00
Kuba (Brecka) Mracek
aa924196ff Add a flag to build the stdlib without COMPATIBILITY_OVERRIDE (#33438) 2020-08-14 17:06:38 -07:00
Saleem Abdulrasool
941681fb5d build: hide symbols using CMake
This uses the CMake settings to correctly select the visibility
attribute for the runtime.
2020-05-21 22:31:15 +00:00
Saleem Abdulrasool
1e74c202ef build: optimize the build of LLVMSupport
Rather than build multiple copies of LLVMSupport (4x!) build it one and
merge it into the various targets.  This would ideally not be needed to
be named explicitly everywhere, but that requires using `add_library`
rather than `add_swift_target_library`.
2020-05-19 17:04:59 +00:00
Saleem Abdulrasool
198d091efe build: avoid redundant flag specification
Remove the flag being specified in multiple locations unnecessarily.
The flags flow downwards to all the subdirectories.  Use that to apply
the C/C++ flags from the root of the runtime repository.
2020-05-04 14:27:22 -07:00
Saleem Abdulrasool
4ca4d91ef6 build: remove some left over variables 2020-02-05 14:17:51 -08:00
Ross Bayer
28e90d6f8f [Build System: CMake] Include the stdlib/toolchain directory before the stdlib/public directory, otherwise the clang resource directory symlink is not installed correctly. 2019-07-25 16:05:36 -07:00
Saleem Abdulrasool
f26048df0e Merge pull request #26210 from compnerd/dynamic-only
stdlib: prevent static builds on Darwin
2019-07-23 19:22:54 -07:00
Ross Bayer
6d0450a688 [Build System: CMake] Move the legacy_layouts content into stdlib/toolchain, a new directory of content that is installed only in the toolchain. 2019-07-23 14:15:36 -07:00
Saleem Abdulrasool
9fb525006c stdlib: prevent static builds on Darwin
Static builds of the standard library and the SDK overlay are
unsupported post ABI stability.  Disallow building of the standard
library and SDK overlay statically for Darwin platforms.
2019-07-19 08:05:57 -07:00
Saleem Abdulrasool
34aace6b43 build: define a "top level" project for the stdlib
CMake allows for projects to be added as a subdirectory.  Use this to
permit the construction of a top-level project for the standard library.
2019-06-27 10:30:04 -07:00
Ross Bayer
66691ee3fa [Build System: CMake] Move the legacy_layouts CMake target generation into stdlib/public/legacy_layouts/CMakeLists.txt.
Any time users build and install the compiler they should also be installing the legacy_layouts for the same Darwin platforms.
2019-06-25 11:53:22 -07:00
Saleem Abdulrasool
63c229b4a8 build: do not touch CMAKE_C_FLAGS and CMAKE_CXX_FLAGS
Use the appropriate CMake functions to adjust the build flags rather
than touching the user-controlled `CMAKE_C_FLAGS` and `CMAKE_CXX_FLAGS`.
2019-06-16 16:48:38 -07:00
Saleem Abdulrasool
4eb0ca0c21 build: do not implicitly track build dependencies for host
Because we do a custom cross-compilation, we are tracking the *build*
dependencies when building libraries for the *host*.  That is to say, if
you are building for Linux on Darwin, we track Darwin's libc++ as a
dependency for the Linux swiftCore.
2019-06-14 14:28:34 -07:00
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