Commit Graph

1633 Commits

Author SHA1 Message Date
Saleem Abdulrasool
f9128bac81 build: use the same pattern for detecting Darwin platforms
The host platform should be using `CMAKE_SYSTEM_NAME STREQUAL Darwin`.
However, we currently drive the host side of the compilation against
custom variables.  This makes the migration simpler by ensuring that the
entire file uses the same pattern.

Since `is_darwin_based_sdk` is now used only in the standard library
build, sink it to the standard library build.
2020-06-04 08:39:59 -07:00
Saleem Abdulrasool
ec60746b99 Merge pull request #32120 from compnerd/macOS-cl
build: simplify macOS path (NFC)
2020-06-02 07:36:21 -07:00
Michael Gottesman
21ca9d4519 Merge pull request #32111 from gottesmm/pr-846f5396754c136c8adbf30b79b0b1c4b33ff9e5
[cmake] Move ar linking optimization rule into UnixCompileRules.cmake and only run it on Unix-like platforms.
2020-06-01 11:37:00 -07:00
Saleem Abdulrasool
f5a75dcefd build: simplify macOS path (NFC)
It does not make sense to use the `cl` frontend to clang to build for
macOS.  Remove the unnecessary condition and always perform the
operation.
2020-06-01 08:40:03 -07:00
Michael Gottesman
72d8d9be6b [cmake] Move ar linking optimization rule into UnixCompileRules.cmake and only run it on Unix-like platforms.
This doesn't make sense on Windows and from what compnerd has said it doesnt
even appear in the ninja rules file. This also moves this rule out of the main
flow of the top level CMakeLists.txt file so I can reuse it when compiling the
stdlib using a sub-cmake invocation.
2020-05-30 21:29:04 -07:00
Saleem Abdulrasool
1cc6698ae6 build: remove unnecessary CXX_STANDARD for Windows
The entire project is now at C++14.  Windows had to adopt C++14 earlier
to support processing the Windows SDK headers.  This is no longer
necessary, adopt the global settings instead.
2020-05-30 15:26:02 -07:00
David Zarzycki
3767ece85c [CMake] Simplify two binary variables into one tri-state variable
Also remove some ancient logic to detect and ignore requests to use LLD.
If people want to explicitly use LLD, they probably have a reason and we
shouldn't second guess them.
2020-05-28 06:08:03 -04:00
Saleem Abdulrasool
756bc505f7 build: correct variable in SDK configuration
The variable was supported to be set to the triple, except it was set to
the variable itself, effectively setting the variable to nothing.  This
is needed to clear the path to directory style installation for
non-Apple targets.
2020-05-23 16:45:10 -07:00
Saleem Abdulrasool
79bed6c4a7 Merge pull request #31481 from compnerd/not-everything-that-glitters-is-gold
build: default the lld/gold enabling as per reality
2020-05-23 19:42:24 -04:00
Dmitri Gribenko
b6d0ef5c81 Remove support for a broken std::regex in libstdc++ 4.8
Out of all operating systems ever supported by Swift, only Ubuntu 14.04
had libstdc++ 4.8, and Swift has sunset support for Ubuntu 14.04 for a
while now.
2020-05-19 17:20:55 +02:00
Eric Miotto
0c403fe766 [build] Pass target argument to the linker if needed (#31794)
Following #31125 and #31612, `-target` is not added automatically to
linker flags when that's needed (e.g. when building for Apple SDKs) --
mimic the logic used to add it for compiler flags.

Addresses rdar://63138761
2020-05-18 08:14:59 -07:00
Dario Rexin
32a189c281 Merge pull request #31329 from compnerd/host-library-handling
`add_swift_host_library` cleanup
2020-05-12 12:23:38 -07:00
Dario Rexin
a554f088d6 Merge pull request #31612 from compnerd/out-in
build: convert out parameter to target
2020-05-11 21:50:12 -07:00
Saleem Abdulrasool
f3da784843 Merge pull request #31672 from swiftwasm/maxd/wasi-sdk
build: Add support for WASI in CMake files
2020-05-11 09:32:12 -07:00
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