Commit Graph

1731 Commits

Author SHA1 Message Date
Michael Gottesman
2b2b5b8f08 [benchmarks] Remove cmake based external perf testsuite build.
If we do an external benchmark build, we will do it via the toolchain benchmark
build-script job. This will be simpler by allowing us to build against a just
built toolchain and separate us from the rest of swift's main CMakeLists.txt.
2020-05-10 14:16:14 -07:00
Max Desiatov
762079665e Add support for WebAssembly/WASI in CMake files 2020-05-10 11:32:04 +01:00
Saleem Abdulrasool
84a7882419 build: add file dependencies for gyb
Add dependencies on the files for gyb to ensure that updates gyb are
treated as triggers to regenerate the files.  This is suspected to have
caused issues for incremental builds.
2020-05-07 12:33:04 -07:00
Saleem Abdulrasool
f03cd0e9a8 build: convert out parameter to target
Rework `_add_host_variant_c_compile_link_flags` to apply the flags
directly rather than to compute the value and have the caller apply.
2020-05-06 22:03:13 -07:00
Saleem Abdulrasool
d1f798bedb Merge pull request #31548 from compnerd/analytical-methods
build: remove `ANALYZE_CODE_COVERAGE` from `_add_host_variant_c_compi…
2020-05-06 17:18:20 -07:00
Saleem Abdulrasool
58fc3c5920 build: remove explicit link against atomic
This is no longer required after the fix for the over-aligned type for
the atomic type.
2020-05-05 08:50:34 -07:00
Saleem Abdulrasool
d5c2bc20db build: remove ANALYZE_CODE_COVERAGE from _add_host_variant_c_compile_link_flags
This flag does not make sense here as this function is called from
`_add_host_variant_link_flags` and `_add_host_variant_c_compile_flags`.
The latter will add the flags appropriately.  The former is always
invoked *after* `_add_host_variant_c_compile_flags`.  This effectively
was duplicating the flags.
2020-05-04 16:06:29 -07:00
Saleem Abdulrasool
c6cc769a64 build: default the lld/gold enabling as per reality
Rather than defaulting both of these to true, enable gold by default
only on ELFish targets, and enable LLD by default for Windows on
non-Windows hosts.
2020-05-01 13:56:57 -07:00
Saleem Abdulrasool
d6b43e4b6f build: clean up the mac catalyst flag handling in the host
The toolchain does not actually use any catalyst flavor, which resulted
in these paths actually being dead.  Cull them except for the one path
which simply computes the target triple.
2020-05-01 13:19:59 -07:00
Saleem Abdulrasool
cf1f240534 build: cleanup some of the organization in add_swift_host_library
This is just a cleanup of the implementation of
`add_swift_host_library`, reorganizing the flag computation and
application as well as the property setting.
2020-05-01 12:59:44 -07:00
Saleem Abdulrasool
62a4bd67d6 build: inline _add_swift_host_library_single
This function is used at one site and is an internal function.  Host
libraries are always built in a single configuration, just inline it to
avoid unnecessarily reparsing arguments.
2020-05-01 12:59:44 -07:00
Dario Rexin
6290d8c28d Merge pull request #31125 from compnerd/opt-flags
optimize flag computation
2020-05-01 10:16:34 -07:00
Doug Gregor
94e9153878 Merge pull request #31170 from DougGregor/build-module-triples
[CMake] Use proper module triples for the names of standard library modules
2020-04-23 23:57:50 -07:00
Eric Miotto
39ddc67c3a [build] copy Python detection code into StandaloneOverlays.cmake (#31234)
This is to support workflows that do not rely on reading the main
CMakeLists.txt.

Based upon #30992, #31020

Addresses rdar://62245784
2020-04-23 11:53:24 -07:00
Doug Gregor
b27b4d4bb6 [CMake] Use proper module triples for the names of standard library modules.
The standard library (and other Swift modules built by our CMake build system)
has been building module files with an architecture only (e.g., x86_64.swiftmodule)
rather than a proper module triple (x86_86-apple-macosx10.15,
x86_64-apple-ios13.0-simulator, etc.), unlike every other build
system. There are hacks in the compiler and other tools to cope with
this unnecessary build difference. Fix the module file names so we'll
be able to remove the hacks later.

Fixes rdar://problem/49071536.
2020-04-20 21:16:14 -07:00
Saleem Abdulrasool
e6f2e6257f build: de-GYB_SOURCES the host tools
Use a newly introduced `swift_gyb_target_sources` to gyb and use the
generated sources when building.  Let CMake figure out when to run the
command, let it invoke the command properly, and indicate that the
sources being added to the target are generated.
2020-04-19 10:24:40 -07:00
Saleem Abdulrasool
0bbc160a44 build: strength reduce add_dependencies usage
The two invocations here both had a single parameter passed to it.
Replace it with `add_dependencies` which already actually supports
multiple dependencies specified.  Sink the custom wrapper into the
usage location in `AddSwiftStdlib.cmake`.
2020-04-19 10:24:40 -07:00
Saleem Abdulrasool
8e736584fa build: remove ICU handling in the android host handling
The host tools do not use ICU, only the standard library does.  Remove
the special handling in the host tool path for ICU.  This simplifies the
flag computation and allows the ICU handling to be sunk entirely into
the target specific paths.
2020-04-19 10:24:40 -07:00
Saleem Abdulrasool
123c2b06dc build: convert output variables to target
Convert the out parameters for `_add_host_variant_c_compile_flags` to
use the target as an in-parameter.  Doing so allows us to set the
properties on the target directly rather than providing them as out
parameters which then get set subsequently.
2020-04-19 10:24:40 -07:00
Saleem Abdulrasool
9873280853 build: convert output variables to target
Convert the out parameters for `_add_host_variant_link_flags` to use the
target as an in-parameter.  Doing so allows us to set the properties on
the target directly rather than providing them as out parameters which
then get set subsequently.
2020-04-19 10:24:38 -07:00
Saleem Abdulrasool
2e132050e1 build: CF, CVP, DAE over flag computation
Perform some constant folding, constant value propagation, dead argument
elimination over the flag computation methods.  This reduces the
unnecessary parameters and more clearly and succinctly describes what is
happening.
2020-04-19 10:24:03 -07:00
Saleem Abdulrasool
6de2863468 build: CVP some of the flags handling
Apply constant value propagation to the host flag variant operations.
This reduces the parameters needed for the invocations and enables
further cleaning in the hopes that we can apply these per-target using
CMake instead.
2020-04-19 10:23:21 -07:00
Daniel Rodríguez Troitiño
6f4455812b Merge pull request #30235 from buttaface/rpath
[build][android] set INSTALL_RPATH properly for shared libraries
2020-04-18 15:38:23 -07:00
Saleem Abdulrasool
84d8bc7b43 build: merge _add_swift_host_executable_single into add_swift_host_executable
Merge the single use `_add_swift_host_executable_single` into the
singular site.  The host tools are built in a single variant.  This
avoids the custom logic for adding multiple variants.  Folding this
away will allow further simplifications in order to move towards a
standard CMake build.
2020-04-13 17:24:18 -07:00
Dario Rexin
20b2fec8a9 Merge pull request #30978 from compnerd/variants
build: duplicate and rename the `_add_variant_*` functions
2020-04-13 13:55:47 -07:00
Robert Widmann
22b0526917 Merge pull request #30082 from 3405691582/OpenBSD_Port_Build
Build system recognizes OpenBSD.
2020-04-12 09:30:17 -07:00
Saleem Abdulrasool
3d1bfdedb6 Merge pull request #30977 from compnerd/unused
build: prune some unused options for `_add_swift_host_executable_single`
2020-04-11 16:05:17 -07:00
Saleem Abdulrasool
87cbb3132d build: duplicate and rename the _add_variant_* functions
This allows us to start splitting up the swift and C/C++ specific paths.
2020-04-11 13:24:31 -07:00
Saleem Abdulrasool
319a9e0cf0 build: prune some unused options for _add_swift_host_executable_single
Remove some unused parameters for this function.  This simplification
will make it easier to merge `_add_swift_host_executable_single` into
`add_swift_host_executable`.
2020-04-11 12:26:30 -07:00
Saleem Abdulrasool
7e2ca19ba8 build: remove Swift search paths for host
Remove the Swift library search path for the host paths which are C/C++
only.
2020-04-11 12:25:34 -07:00
Doug Gregor
5bbc43c4d2 [CMake] Add -simulator to simulator target triples.
The build systems that drive Swift compilation have been using the
"simulator" environment as part of the increasingly inaccurately
named "target triple" to specify simulator targets for several
years... except our own hand-rolled build system. Identify
simulator targets and append "-simulator" to their target
triples.
2020-04-06 16:52:56 -07:00
3405691582
f8d0174b85 Build system recognizes OpenBSD.
Commit for CMake and build scripts to recognize OpenBSD. To keep this
commit relatively short, this just deals with the rather simple and
uncontroversial changes to the build system.

Note that OpenBSD calls "x86_64" as "amd64", Since the Swift stdlib will
be put in a subdirectory named after ARCH, to ensure the standard
library is properly found later, we use the native architecture name for
OpenBSD in the build system rather than trying to deal with the
difference the other way around.
2020-04-03 13:34:17 -04:00
Butta
4bfbfe935f [build][android] set INSTALL_RPATH properly for shared libraries
Host libraries will likely all need ORIGIN set, whereas only set it for
target libraries that will be packaged with a native toolchain on Android.
2020-03-18 10:32:49 +05:30
Eric Miotto
b3e86610fa [build] set linker parameters in a single way (#30339)
After noticing that also in CMake 3.16 the LINKER: prefix is not
expanded correctly when used in `target_link_options`, prefer to set the
linker parameters in a more verbose way and leave a comment behind on
when this behavior was observed in case we want to change the
implementation later.

Follow up to #29636.
Addresses rdar://problem/59732421
2020-03-11 07:41:50 -07:00
Dario Rexin
6dc4329398 Move SwiftSource.cmake to stdlib 2020-03-08 12:48:34 -07:00
Kuba (Brecka) Mracek
ab6533a40f Merge branch 'master' into mracek/arm64e 2020-03-06 15:07:01 -08:00
Doug Gregor
144ec416e6 [CMake] Stop requiring ${SDK}/System/Library/Frameworks/module.modulemap
Remove anachronistic check for a "blanket" module map in
/System/Library/Frameworks from Darwin SDK configuration. We already
extract other information from the SDK that we actually need, so check
for that directly instead.

Fixes rdar://problem/60084609.
2020-03-06 09:34:45 -08:00
Saleem Abdulrasool
b40bd3ecba build: remove reference to handle_swift_sources in C++ path
The toolchain binaries are all C++ code.  This removes the last tie to
the custom Swift handling in CMake for the host functions.
2020-02-27 21:32:45 -08:00
Kuba Mracek
45ba5cec05 [arm64e] Add arm64e support into Swift's build system 2020-02-27 16:08:15 -08:00
Saleem Abdulrasool
fc67fc74fb build: shuffle around some functions
This is a purely code motion change.  It moves the functions that are
specific to `SwiftSource.cmake` into `SwiftSource.cmake`.  Target
functions are moved to `stdlib/cmake/modules/AddSwiftStdlib.cmake`.
2020-02-26 12:47:43 -08:00
Saleem Abdulrasool
2e2e886832 build: bifurcate _add_swift_executable_single 2020-02-23 14:20:12 -08:00
Michael Gottesman
79716efbee Merge pull request #29960 from compnerd/add-swift-host-library-single-simplifications
`_add_swift_host_library_single` simplifications
2020-02-20 23:26:52 -08:00
Michael Ilseman
bfd0de4928 Revert "Revert "Revert "swift-lang: shuffle the source directory structure (N…" 2020-02-20 15:39:51 -08:00
Saleem Abdulrasool
4b2cbd64f4 build: rename prefix for _add_swift_host_library_single 2020-02-20 09:10:00 -08:00
Saleem Abdulrasool
a32b479250 build: custom import libraries are not needed for host libraries 2020-02-20 09:10:00 -08:00
Saleem Abdulrasool
4a93f70e1f build: use a regular expression in _add_swift_host_library_single 2020-02-20 09:10:00 -08:00
Saleem Abdulrasool
749dd266c3 build: inline constant values for _add_swift_host_library_single 2020-02-20 09:10:00 -08:00
Saleem Abdulrasool
f11ecdec9c build: remove unnecessary set_target_property
Now that `_add_swift_host_library_single` only deals with host
libraries, it is no longer mutating the name of the library target.
This `set_target_property` is no longer needed.
2020-02-20 09:10:00 -08:00
Saleem Abdulrasool
56e58b4764 build: remove duplicated parameter to _add_swift_host_library_single 2020-02-20 09:09:59 -08:00
Saleem Abdulrasool
200b96df81 Revert "Revert "swift-lang: shuffle the source directory structure (NFC)""
This reverts commit beb8ecd8cc.  Add a
workaround for the dependency issue.

It is unclear why `sourcekitd` is getting added improperly as a
dependency on `lib/sourcekitd.framework/sourcekitd`.  This workaround
adjusts the dependency such that we end up with a dependency on
`lib/sourcekitd.framework/Versions/A/sourcekitd` as an order-only
dependency.  This should fix the compile issue.  I am unable to
reproduce this issue with the `add_library` usage for adding a Swift
library.  This allows us to cleave the host and target libraries, and so
the workaround is sufficient to make progress and the problem will be
resolved with the migration towards CMake for handling the dependencies.
2020-02-19 16:09:37 -08:00