Commit Graph

246 Commits

Author SHA1 Message Date
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
28a2826ef4 Start using optimization (-O0/-O2/-O3/-Os) and debug (-g) flags from CMAKE_CXX_FLAGS_${CFLAGS_BUILD_TYPE} (#33388) 2020-08-17 19:26:24 -07:00
Kuba (Brecka) Mracek
925835f158 NFC: Use SWIFT_APPLE_PLATFORMS and remove is_darwin_based_sdk 2020-08-14 21:04:02 -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
Kuba (Brecka) Mracek
11c9184c6c Use SWIFT_SDK_${sdk}_OBJECT_FORMAT to choose whether to use lipo and multi-arch builds 2020-08-14 17:05:51 -07:00
Kuba (Brecka) Mracek
f91fe9c0c1 Use SWIFT_SDK_${prefix}_USE_ISYSROOT to select which SDKs should be building with -isysroot (#33469) 2020-08-14 14:33:28 -07:00
Kuba (Brecka) Mracek
e2e69578a6 For the 'minimal' stdlib, disable Objective-C interop (#33427) 2020-08-13 15:26:04 -07:00
Kuba (Brecka) Mracek
ef89b0dc51 Add a 'standalone_minimal' preset to build a minimal, static, OS independent, self-contained binaries of stdlib. (#33286) 2020-08-12 07:28:34 -07:00
Dario Rexin
0850436d9f Properly compute resource folder when linking statically
- deduplicate the logic to compute the resource folder
- install headers and module files in shared and static resource folders
- forward -static flag when calling swiftc with -print-target-info
2020-07-30 15:07:03 -07:00
Eric Miotto
e497089d88 [build] don't embed bitcode for target libs built for simulators (#32871)
At the same time rework condition so that it is more amenable to code
searches.

Addresses rdar://65501878
2020-07-14 11:37:46 -07:00
Saleem Abdulrasool
46c4c2bf72 Merge pull request #30733 from allevato/rt-inline-ns
Wrap (de)mangling namespaces in an inline namespace.
2020-06-24 08:34:53 -07:00
Mishal Shah
272c466e47 Update master to build with Xcode 12 beta 2020-06-22 15:43:20 -07:00
Tony Allevato
5b1daa9055 Conditionally wrap (de)mangling symbols in an inline namespace.
Since libDemangling is included in the Swift standard library,
ODR violations can occur on platforms that allow statically
linking stdlib if Swift code is linked with other compiler
libraries that also transitively pull in libDemangling, and if
the stdlib version and compiler version do not match exactly
(even down to commit drift between releases). This lets the
runtime conditionally segregate its copies of the libDemangling
symbols from those in the compiler using an inline namespace
without affecting usage throughout source.
2020-06-19 11:20:56 -07:00
Saleem Abdulrasool
e9548b019b Merge pull request #32182 from compnerd/uniformity
build: use the same pattern for detecting Darwin platforms
2020-06-04 13:43:58 -07:00
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
3405691582
9a93b61f67 [stdlib][cmake] OpenBSD target requires -lpthread.
Like FreeBSD, OpenBSD needs -lpthread for a target link. This is
necessary to get the swift-reflection-test to link and build correctly.
2020-06-03 20:18:19 -04: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
4c115e1484 build: cleanup some unnecessary settings for Windows
Windows had moved to C++14 much earlier than the rest of Swift.  This
was required in order to deal with the Windows SDK headers.  Now that
the project has fully moved to C++14, remove the unnecessary settings
for Windows.
2020-05-23 11:21:10 -07:00
Saleem Abdulrasool
3fa1d1fe3f runtime: ingest LLVMSupport into the runtime
This adds a new copy of LLVMSupport into the runtime.  This is the final
step before changing the inline namespace for the runtime support.  This
will allow us to avoid the ODR violations from the header definitions of
LLVMSupport.

LLVMSupport forked at: 22492eead218ec91d349c8c50439880fbeacf2b7
Changes made to LLVMSupport from that revision:
  process.inc forward declares `_beginthreadex` due to compilation issues due to custom flag handling

API changes required that we alter the `Deallocate` routine to account
for the alignment.

This is a temporary state, meant to simplify the process.  We do not use
the entire LLVMSupport library and there is no value in keeping the
entire library.  Subsequent commits will prune the library to the needs
for the runtime.
2020-05-15 09:55:36 -07:00
Max Desiatov
762079665e Add support for WebAssembly/WASI in CMake files 2020-05-10 11:32:04 +01:00
Saleem Abdulrasool
923def217f Merge pull request #31544 from compnerd/runtime-defines
build: avoid redundant flag specification
2020-05-06 14:05:19 -07:00
Saleem Abdulrasool
a994d65b3e build: remove LLVM_LINK_COMPONENTS in the standard library (NFC)
The standard library does not use the LLVM components.  Remove the
unused parameter support.
2020-05-06 08:33:53 -07: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
Dario Rexin
6290d8c28d Merge pull request #31125 from compnerd/opt-flags
optimize flag computation
2020-05-01 10:16:34 -07:00
Saleem Abdulrasool
82cdf91512 Merge pull request #31033 from 3405691582/OpenBSD_Port_BuildfixDifferentiation
[stdlib] Buildfix differentiation for OpenBSD.
2020-04-20 08:12:50 -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
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
Dario Rexin
93da1a428d Merge pull request #30956 from buttaface/soname
[build] re-enable setting soname for Android shared libraries
2020-04-17 09:26:10 -07:00
3405691582
f32a6e2565 [stdlib] Buildfix differentiation for OpenBSD.
New files were added in #30875 which did not include os(OpenBSD), so add
this.

add_swift_target_library in AddSwiftStdlib subsequently required
modification. _add_target_variant_link_flags likely needs modification as
well, but this is better suited to a separate PR.
2020-04-15 00:32:54 -04: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
Butta
8b4dadcda1 [build] re-enable setting soname for Android shared libraries, as in #30020 2020-04-10 22:23:45 +05:30
Xi Ge
516b4d4ca5 Revert "[build] Don't reset 'swiftlib_link_flags_all' unnecessarily" 2020-04-06 21:18:07 -07:00
Saleem Abdulrasool
905341321b Merge pull request #30020 from buttaface/link_flags
[build] Don't reset 'swiftlib_link_flags_all' unnecessarily
2020-04-06 15:47:36 -07:00
Eric Miotto
d8de5bafb0 [build] set linker parameters in a single way (for stdlib) (#30596)
Match the same fix as #30339 for `AddSwiftStdlib.cmake`.

Addresses rdar://problem/60791444
2020-03-24 06:51:44 -07: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
Dario Rexin
6dc4329398 Move SwiftSource.cmake to stdlib 2020-03-08 12:48:34 -07:00
Butta
c2a73c88ce [build] Don't reset 'swiftlib_link_flags_all' unnecessarily 2020-02-28 03:11:44 +05:30
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
Saleem Abdulrasool
c5c7ed17b8 build: hoist LINK_LIBRARIES out of _add_swift_executable_single
Hoist the responsibility for adding the linked libraries out of
`_add_swift_executable_single` to the invoker.  This impacts only
`swift_add_target_executable`.  This continues to bring the computation
of the properties nearer the site of definition.
2020-02-02 08:58:41 -08:00
Saleem Abdulrasool
183de849d4 build: begin rooting out EXCLUDE_FROM_ALL
`EXCLUDE_FROM_ALL` should be discouraged.  `ALL` should build *all*
targets.  If a subset of targets are desired to be built, we should
provide targets which make sense.  Sink the single use of this flag
into the standard library setup.  The custom cross-compilation was
the reason that the flag was plumbed all the way through.  Cleaning
up the macros that have been built up is needed to migrate towards
proper cross-compilation support.
2020-01-24 22:20:07 -08:00
Saleem Abdulrasool
b94ea98516 build: remove SWIFT_BUILD_STDLIB check (NFC)
The `add_swift_target_executable` is used in a single case, where it is
already being built in a standard library only build.  This removes the
unnecessary condition in the build path.
2020-01-23 11:14:42 -08:00
Saleem Abdulrasool
218b37e1bb build: rename LLVM_COMPONENT_DEPENDS
This is not a target dependency but a target link.  Name the parameter
to be less misleading.  This also makes the name identical to the LLVM
parameter.
2019-05-04 19:58:28 -07: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
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