Commit Graph

1731 Commits

Author SHA1 Message Date
Slava Pestov
1159af50d9 Rename -enable-resilience to -enable-library-evolution and make it a driver flag
Fixes <rdar://problem/47679085>.
2019-03-14 22:24:26 -04:00
Saleem Abdulrasool
4b9e9d3164 build: excise the concept of fat libraries
This was used for the swift-reflection-test tool.  Instead of using fat
binaries, use the target binary itself.  This simplifies the build logic
as well as paves the road to sub-builds for each target rather than a
monolithic build as we have today.

Originally, the swift-reflection-test was a host tool that linked
against the target libraries since it was testing the target layout.
Now that the tool has been split into a host and target component
(5ea5bb06a3) and we have target and host
libraries that we can link against appropriately, we do not need to link
against the FAT binary.  Since there was exactly one use of this
functionality, switching that from fat linking to regular linking allows
us to remove this functionality entirely.  Switch to regular linking and
remove the option.
2019-03-12 22:30:20 -07:00
Saleem Abdulrasool
8ed5c1a4bc build: introduce and switch to GYB_SOURCES
This avoids us having to pattern match every source file which should
help speed up the CMake generation.  A secondary optimization is
possible with CMake 3.14 which has the ability to remove the last
extension component without having to resort to regular expressions.  It
also helps easily identify the GYB'ed sources.
2019-03-11 13:48:54 -07:00
Saleem Abdulrasool
533a26a5eb build: remove outdated documentation (NFC) 2019-03-10 17:01:27 -07:00
Saleem Abdulrasool
f9df4cad97 build: remove DEPENDS from add_swift_host_library
Use the appropriate CMake mechanisms for building the libraries.
2019-03-10 17:01:27 -07:00
Saleem Abdulrasool
c1c75a4b2d build: drop LINK_FLAGS from add_swift_host_library
This is not currently being used.  Unfortunately, setting linker options
is difficult until CMake 3.13 which introduced target_link_options.
Prior to that, you needed to do:

set_property(TARGET <TARGET> APPEND_STRING LINK_FLAGS <NEW FLAGS>)

If needed, we could write a helper to provide the target_link_options
interface on earlier CMake versions.
2019-03-10 17:01:27 -07:00
Saleem Abdulrasool
31a5ae7f56 build: remove LINK_INTERFACE_LIBRARIES from add_swift_host_library
Use the appropriate CMake mechanism for building the libraries.
2019-03-10 17:01:27 -07:00
Saleem Abdulrasool
b0005e9f87 build: remove C_COMPILE_FLAGS from add_swift_host_library
Use the appropriate CMake mechanism for controlling flags for building
the code.
2019-03-10 15:38:55 -07:00
Saleem Abdulrasool
ee5ab9e98a build: prevent accidental addition of LINK_LIBRARIES
Protect against LINK_LIBRARIES, directing the developer to
target_link_libraries.  This has no impact on the build currently.
2019-03-09 20:44:41 -08:00
Ross Bayer
7d251cff1a Merge pull request #23188 from Rostepher/standalone-find-llvm-cmake-modules
[Build System: CMake] Partially revert PR #22840, manually adding the LLVM CMake module path to CMAKE_MODULE_PATH rather than using find_package.
2019-03-08 14:00:58 -08:00
Ross Bayer
3a95da9a69 [Build System: CMake] Partially revert PR #22840, manually adding the LLVM CMake module path to CMAKE_MODULE_PATH rather than using find_package. 2019-03-08 12:55:44 -08:00
Doug Gregor
3bf75e6333 Merge pull request #23147 from DougGregor/disable-abi-breaking-checks
[CMake] Set -DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1 for runtime/overlays
2019-03-07 14:31:12 -08:00
Doug Gregor
c94da3b4da [CMake] Set -DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1 for runtime/overlays
Whenever we're building C++ code as part of the Swift runtime or overlays,
disable the ABI-breaking checks. We are only using header content from
LLVM's ADT library.

Fixes rdar://problem/48618250.
2019-03-06 17:21:17 -08:00
Ben Langmuir
a678e74517 Fix optional stdlib component install 2019-03-06 14:42:52 -08:00
Jordan Rose
13430961b4 [CMake] Fix creation of swiftmodule directories on Apple platforms (2)
The previous commit resulted in multiple targets that claimed to be
able to generate the directories in question. Instead, just create the
directories as a pre-build step for the targets that actually need
them. (This does keep the cleanup for the existing directory creation
target, though.)

More https://bugs.swift.org/browse/SR-10029
2019-03-03 16:36:28 -08:00
Jordan Rose
7135460528 [CMake] Fix creation of swiftmodule directories on Apple platforms
The way it was set up before worked for Ninja but not for Xcode, due
to me not listing the swiftmodule directories as actual outputs of the
create-directories target. The resulting fix here is actually simpler
and involves fewer processes anyway, so good for us.

https://bugs.swift.org/browse/SR-10029
2019-03-01 11:24:19 -08:00
Saleem Abdulrasool
ac5687b81e build: remove some unused variables 2019-02-27 11:14:10 -08:00
David Zarzycki
f1b8c914cb Merge pull request #22860 from davezarzycki/install_FileCheck_fix
[CMake] Don't install FileCheck by default
2019-02-25 15:40:08 -05:00
Vedant Kumar
bafb963d7b Enable linker dead stripping on Darwin (#22839)
* Enable linker dead stripping on Darwin

See r://48283130. This shaves 6MB+ off of swift and SourceKitService,
26.8MB off of swift-llvm-opt, 29.4MB off sil-passpipeline-dumper, etc.

* Disable dead stripping in Debug builds

It can hide linker errors caused by dependency cycles.
2019-02-25 10:52:48 -08:00
David Zarzycki
6b2561876f [CMake] Don't install FileCheck by default
Not everybody can or does use the "build-script" and the build-script
can easily opt into this if it wants.
2019-02-25 06:41:06 -05:00
swift-ci
3172ff426c Merge pull request #22856 from compnerd/a-perfect-library-exports-nothing 2019-02-23 21:08:43 -08:00
Saleem Abdulrasool
22fde69e6c cmake: make swiftRemoteMirror export interfaces on Windows
Unfortunately, `swift-reflection-test` links against the *TARGET*
library `swiftRemoteMirror`.  The linked library is built as a target
library, which means that we use the custom library target construction
which suffixes the target with a variant spelling.  Because the number
of variants is really high, we pass along the explicit EXPORTS macro
manually.  However, we also build the library as a static library for
the *HOST*.  This means that we need the sources to be aware of whether
they are built statically or dyanmically.  This is accomplished by means
of the `_WINDLL` macro.  The target library is shared and is built using
the custom wrapper for the library construction, which will create all
the variants and then use `_compute_variant_c_flags` which does not get
told what type of library is being built, so it assumes static and does
not append `_WINDLL`.  This results in the shared library not exposing
any interfaces on Windows.  When this happens, link will helpfully elide
the import library.  The result of that is that the
swift-reflection-test binary will fail to link due to no import library
for the RemoteMirror.  Explicitly add the -D_WINDLL if appropriate
manually after we have computed the C flags.  *siiiiiiigh*
2019-02-23 20:03:47 -08:00
Saleem Abdulrasool
350cf67788 utils: attempt to replace custom variables
CMake defaults to using a special <package>_DIR for finding packages.
Prefer this to import the CMake package for LLVM/Clang/Swift rather than
custom paths.
2019-02-22 18:47:26 -08:00
Slava Pestov
1d8928425a Revert "utils: attempt to replace custom variables" 2019-02-22 19:21:13 -05:00
Saleem Abdulrasool
972a86b3c9 Merge pull request #22815 from compnerd/a-dll-is-a-dll
CMake: use `_WINDLL` rather than `_USRDLL`
2019-02-22 14:22:05 -08:00
Saleem Abdulrasool
46cbfef03a Merge pull request #22258 from compnerd/integrating-variables
utils: attempt to replace custom variables
2019-02-22 13:22:51 -08:00
Saleem Abdulrasool
8062230cff CMake: use _WINDLL rather than _USRDLL
`_USRDLL` is used to indicate that you are building a MFC DLL while
`_WINDLL` is specified for **ALL** DLL builds.  Use the correct macro.
2019-02-22 10:49:25 -08:00
Jordan Rose
43feb9cbe1 On Apple platforms, use swiftmodule directories for the stdlib (#21797)
This changes the Swift resource directory from looking like

    lib/
      swift/
        macosx/
          libswiftCore.dylib
          libswiftDarwin.dylib
          x86_64/
            Swift.swiftmodule
            Swift.swiftdoc
            Darwin.swiftmodule
            Darwin.swiftdoc

to

    lib/
      swift/
        macosx/
          libswiftCore.dylib
          libswiftDarwin.dylib
          Swift.swiftmodule/
            x86_64.swiftmodule
            x86_64.swiftdoc
          Darwin.swiftmodule/
            x86_64.swiftmodule
            x86_64.swiftdoc

matching the layout we use for multi-architecture swiftmodules
everywhere else (particularly frameworks).

There's no change in this commit to how Linux swiftmodules are
packaged. There's been past interest in going the /opposite/ direction
for Linux, since there's not standard support for fat
(multi-architecture) .so libraries. Moving the .so search path /down/
to an architecture-specific directory on Linux would allow the same
resource directory to be used for both host-compiling and
cross-compiling.

rdar://problem/43545560
2019-02-19 14:47:21 -08:00
Saleem Abdulrasool
817597c7f9 utils: attempt to replace custom variables
CMake defaults to using a special <package>_DIR for finding packages.
Prefer this to import the CMake package for LLVM/Clang/Swift rather than
custom paths.
2019-02-14 20:19:08 -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
Jordan Rose
bc35b34c64 [CMake] StandaloneOverlay: set components before including apinotes/ (#22592)
Otherwise, we'll think we don't need to install the API notes.

No test because this configuration isn't (yet) tested publicly
anywhere, but it is being tested within Apple.
2019-02-13 17:56:31 -08:00
Jordan Rose
4970946265 [CMake] Limit copy-legacy-layouts dependency to the stdlib (#22593)
When we do standalone overlay builds, they should rely on these
layouts already being in the toolchain. (In particular, the target
is never created.)

No tests because this configuration isn't (currently) being tested
outside of Apple.
2019-02-13 16:21:34 -08:00
Ross Bayer
083350af77 Revert "[CMake] Remove LINK_LIBRARIES option from _add_swift_executable_single" 2019-02-12 14:42:22 -08:00
Slava Pestov
c8effd26b3 Merge pull request #22408 from slavapestov/always-use-legacy-layouts
Always use legacy layouts
2019-02-11 19:10:02 -05:00
Ross Bayer
fc58ad4207 Merge pull request #22128 from xiaobai/remove_link_libs_option
[CMake] Remove LINK_LIBRARIES option from _add_swift_executable_single
2019-02-11 12:22:26 -08:00
Saleem Abdulrasool
f441f089cc build: fix mismatch of MSVCRT in release mode
When building RelWithDebInfo, we would accidentally link against the debug
MSVCRT library rather than the release mode one resulting in memory corruptions.
2019-02-08 15:08:56 -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
fredriss
b6077176ee Merge pull request #21904 from compnerd/mirror-mirror-on-the-wall
SwiftRemoteMirror: add a host build for the tools
2019-02-04 14:56:42 -08:00
Ben Langmuir
c1744de648 Merge pull request #22193 from benlangmuir/crash-cmake-less
Re-apply "Set a reasonable default for SWIFT_INSTALL_COMPONENTS"
2019-01-29 09:31:01 -08:00
Saleem Abdulrasool
85f45dfe30 SwiftRemoteMirror: add a host build for the tools
This adds an explicit version of the SwiftRemoteMirror library for use
in the tools that comprise the toolchain.  This is a separate build from
the target specific builds of the library even though we may be building
the runtime for the (same) host.
2019-01-28 18:00:58 -08:00
Ben Langmuir
2d5fbb9f18 Re-apply "Set a reasonable default for SWIFT_INSTALL_COMPONENTS"
This reverts commit 77689f5945 (#22079)
2019-01-28 16:25:58 -08:00
swift-ci
d83705b3e1 Merge pull request #22161 from gottesmm/pr-3e0ca67a6062567588ea7d5d8d94f564f4266ab3 2019-01-28 12:54:49 -08:00
Michael Gottesman
cc68e6a0d5 Remove some remaining dead code from the +0 argument convention bring up.
I already removed the option from SILOptions, so all of this stuff is dead.
2019-01-27 13:18:06 -08:00
Ross Bayer
b88edd117e [Build System: CMake] Set the binary dir for the bundled apinotes to the source dir when building the standalone overlays. 2019-01-26 20:41:30 -08:00
Ross Bayer
7c84d14066 [Build System: CMake] Set the binary dir for the generated runtime headers to the source dir when building the standalone overlays (rdar://47558666). 2019-01-25 15:28:06 -08:00
Alex Langford
6c63f4d3f5 [CMake] Remove LINK_LIBRARIES option from _add_swift_executable_single
This option has been unused since commit
dd85d79105. We now use
target_link_libraries instead of this option.
2019-01-25 14:25:58 -08:00
Jordan Rose
bad30a5313 [CMake] Remove logic to set unused macro __SWIFT_CURRENT_DYLIB (#22105)
Once upon a time we tried to use this to limit the visibility of
symbols in the Swift runtime in a way that didn't really make sense.
Dave Z removed it last year in 91823273d2.

No functionality change.
2019-01-24 20:15:29 -08:00
Jordan Rose
77689f5945 Revert "Set a reasonable default for SWIFT_INSTALL_COMPONENTS" (#22079) 2019-01-23 19:35:09 -08:00
Robert Widmann
9c755e0e66 Merge pull request #21529 from coypoop/master
Fix typo regarding supported FreeBSD architectures
2019-01-23 12:30:18 -05:00
Ben Langmuir
753eb53f1c Merge pull request #21721 from benlangmuir/optionalize
[cmake] Make install of stdlib target libraries OPTIONAL
2019-01-22 16:19:06 -08:00