Commit Graph

826 Commits

Author SHA1 Message Date
Saleem Abdulrasool
970c059d30 build: simplify check using the SDK OBJECT_FORMAT
_OBJECT_FORMAT was added recentlyish for all the SDKs.  Use that property rather
than enumerating all the ELFish targets.  This ensures that the code path is
correct if another ELFish target is ported to.
2016-07-03 10:01:43 -07:00
Harlan
1625d97976 Switch to llvm-profdata's pooled profdata merge (#3281) 2016-07-01 16:45:21 -07:00
Dmitri Gribenko
ad559f9812 Merge pull request #3205 from compnerd/foreign-icus
build: support having more than one ICU in use
2016-06-28 23:23:01 -07:00
Michael Gottesman
1d28c0ac4d [cmake] Refactor two list processing utility functions from AddSwift.cmake => SwiftList.cmake. 2016-06-28 14:19:18 -07:00
Dmitri Gribenko
37b7d3d9ee Merge pull request #3209 from compnerd/dead-code-elimination
build: clean up dead code
2016-06-27 23:13:35 -07:00
Saleem Abdulrasool
1baeed7c26 build: allow experimental selection of lld
Add an option which the user can specify to switch to the lld linker.  Although
this linker is still nascent, it is interesting to permit linking with this.  It
is also an alternative to the BFD linker for COFF targets.  It will allow for a
cross-compilation story for Windows on non-Windows targets.
2016-06-25 12:39:17 -07:00
Saleem Abdulrasool
956503a975 build: clean up dead code
This is not used currently and is unlikely to be needed in the future as well.
Remove the dead code.
2016-06-25 12:37:44 -07:00
Saleem Abdulrasool
4d2593fb95 build: support having more than one ICU in use
This allows us to cross-compile the standard library to foreign targets on a
single host.  The ICU dependencies can be specified on the command line on a
per-target basis.  If one is not specified, we fall back to the default search
path and use that for the other targets.

Special thanks to Dimitri Gribenko for the various hints in getting this wired
up.
2016-06-25 12:35:12 -07: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
Brian Gesiak
8d4bc744c5 [CMake] Android NDK r12 appends ".x" to libgcc dir
The Android NDK r12 release appends a ".x" to the libgcc directory;
it is now:

```
android-ndk-r12/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x
```

Update the linker path for the Android build to accomodate this change.
2016-06-22 14:39:28 -07:00
Saleem Abdulrasool
d771054c7b build: use the new object format property
Simplify the ELF checks based on review comments from Dimitri Gribenko.
2016-06-22 09:37:56 -07:00
Saleem Abdulrasool
526127be41 build: only use gold on ELF targets
gold only supports ELF.  This adds two new helper functions
(is_windows_based_sdk and is_elfish_sdk) to ensure that we dont try to use gold
on non-ELF targets.  This comes up when trying to setup cross-compilation for
the standard library for Windows.

The ELF check is implemented as the negation of Darwin (which uses MachO) and
Windows (which uses COFF).  The reason for this is that there are additional
targets which also use ELF.  Rather than enumerating the larger set, enumerate
the smaller set (windows) and use the negation.
2016-06-20 20:54:20 -07:00
Saleem Abdulrasool
6cb73cfdf5 cmake: avoid some duplications by using a helper
Create a helper function to determine if we are targeting a Darwin SDK or not.
The repetition is error-prone and verbose.  Simplify by adding a checking
function.  NFC.
2016-06-20 07:09:21 -07:00
swift-ci
7575e66971 Merge pull request #3068 from compnerd/single-is-crossed 2016-06-20 01:29:29 -07:00
Saleem Abdulrasool
b3ba45758d build: make swift_lib_add_single more amenable to cross-compilation
Use the SWIFTLIB_SINGLE_SDK variable rather than the CMAKE_BUILD_SYSTEM variable
to determine the target type.  This allows us to use the logic for adding
libraries for foreign OSes on a build host.  This is needed to pave the road to
cross-crompiling the standard library for different targets.
2016-06-19 22:21:51 -07:00
Saleem Abdulrasool
985651feca build: use -isystem on non-Darwin targets
The use of `-isysroot` is a Darwin specific behaviour.  It is used to switch to
a platform SDK, however, other targets use the `--sysroot` flag.  Windows uses a
custom mechanism which is a set of system header paths.
2016-06-18 17:47:44 -07:00
Brian Gesiak
328de9e280 [SR-1738] add_swift_library takes SHARED/STATIC arg
As a first step to allowing the build script to build *only*
static library versions of the stdlib, change `add_swift_library`
such that callers must pass in `SHARED`, `STATIC`, or `OBJECT_LIBRARY`.

Ideally, only these flags would be used to determine whether to
build shared, static, or object libraries, but that is not currently
the case -- `add_swift_library` also checks whether the library
`IS_STDLIB` before performing certain additional actions. This will be
cleaned up in a future commit.
2016-06-16 13:15:58 -04:00
swift-ci
3de52f4d17 Merge pull request #2985 from gottesmm/thinko_fix_update_unittests_to_use_compute_lto_flag 2016-06-10 15:17:47 -07:00
swift-ci
3826628d81 Merge pull request #2984 from gottesmm/cmake_rename_host_library_to_force_build_for_host_sdk 2016-06-10 14:51:29 -07:00
Michael Gottesman
ee08987896 [lto][cmake] While chopping up patches, I lost an update to AddSwiftUnittests to use _compute_lto_flag.
rdar://24717107
2016-06-10 14:31:42 -07:00
Michael Gottesman
034441a782 [cmake] Rename the variable HOST_LIBRARY => FORCE_BUILD_FOR_HOST_SDK in add_swift_library.
HOST_LIBRARY is supposed to mean "no matter what the defaults say, also build
this library for the host". FORCE_BUILD_FOR_HOST_SDK is a less confusing name.
2016-06-10 14:02:55 -07:00
Michael Gottesman
95d926abb0 [lto] Only build host libraries using LTO.
At some point in the future, we may consider using LTO on the runtime/standard
library, but right now is not that time. We are just trying to use LTO to
improve the compile time performance of the compiler itself.

rdar://24717107
2016-06-10 13:33:54 -07:00
Michael Gottesman
db2126c139 [lto][cmake] Do not access SWIFT_TOOLS_ENABLE_LTO directly in _add_variant_{c_compile,variant_link}_flags. Pass it in as an arg instead.
This will allow control on the outside of these calls on whether or not LTO is
enabled. This is necessary for turning off LTO on target libraries.

rdar://24717107
2016-06-10 13:27:42 -07:00
Harlan
90b05744d0 [build] Don't attempt to build the runtime with coverage (#2958) 2016-06-08 17:58:47 -07:00
Michael Gottesman
a5d817257a [build-script-impl] Rename swift-enable-lto => swift-tools-enable-lto
This makes it clear to the user that they are enabling lto only for swift tools,
not for the swift standard library/runtime.

rdar://24717107
2016-06-07 19:03:03 -07:00
Dmitri Gribenko
83b9815c52 CMake: Xcode: add a dummy source file to standard library dylib as well
This seems to be needed when object libraries are in use.
2016-06-02 01:13:40 -07:00
Dmitri Gribenko
66626baa88 CMake: set the 'header' property on .def and .td files 2016-06-02 01:13:40 -07:00
Dmitri Gribenko
2b001bb7f7 CMake: fix non-optimized standard library builds
Fix fallout from my recent change: SwiftOnoneSupport was attempted to be
linked into the runtime, but only in non-optimized mode.
2016-06-01 10:27:29 -07:00
Dmitri Gribenko
d227aeb64d CMake: use object libraries instead of repacking static archives 2016-06-01 03:06:33 -06:00
SpringsUp
ca24fd5785 Specify '-resource-dir' when compiling Swift libraries, so we can find
libraries for the destination host when cross-compiling.
2016-05-27 15:36:03 +02:00
David Farler
2a81691eab AddSwift.cmake: Install into resource dir based on TARGET_LIBRARY
not IS_STDLIB. There are other non-stdlib libraries that can go
into the platform resource directory, such as libswiftRemoteMirror.dylib.

rdar://problem/26435454
2016-05-23 19:54:02 -07:00
Dmitri Gribenko
d9d0825813 CMake: build target libraries together with the stdlib
This avoids building swiftRemoteMirror for all targets by default.
2016-05-21 23:36:44 -07:00
Dmitri Gribenko
92c34760ad CMake: pass down the HOST_LIBRARY flag to _add_swift_library_single() 2016-05-21 23:36:44 -07:00
Dmitri Gribenko
b31581ca55 CMake: rename an obscure IS_HOST flag to HOST_LIBRARY 2016-05-21 23:36:44 -07:00
David Farler
f3500e4a3c lib/SwiftReflection shouldn't link libswiftCore
Although this is a target library, it does not need to link against
the standard library, because it doesn't have any Swift content in
it. We need to add a separate build flag for having CMake content
because saying a library "IS_STDLIB" isn't correct for this case.

rdar://problem/26399625
2016-05-20 17:28:25 -07:00
Sandeep Dasgupta
c529006896 This will make archiving compatible to other archive tools 2016-05-19 18:37:19 -07:00
Michael Gottesman
b901341bb5 [cmake] Remove debug statement that snuck in.
I believe this came in during changes to cmark. I talked with DFarler and he
said it was debug code. Lets remove it.
2016-05-18 17:22:00 -07:00
Brian Gesiak
4afca9d92b [CMake] Move 'handle_swift_sources', add function
Create a new CMake file responsible for functions that handle Swift
source files, such as `handle_swift_sources`. Also, add a new function,
`add_swift_source_group`, to this file. This function reduces some
duplication in `AddSwift.cmake`.
2016-05-05 16:35:20 -07:00
David Farler
450a3d82c4 AddSwift: Fix typo in static library dependency append 2016-04-27 12:55:00 -07:00
practicalswift
9a078b54ef [gardening] Fix recently introduced typo: "a executable" → "an executable"
[gardening] Fix recently introduced typo: "a offset" → "an offset"
[gardening] Fix recently introduced typo: "accessiblity" → "accessibility"
[gardening] Fix recently introduced typo: "cant" → "can't"
[gardening] Fix recently introduced typo: "inteference" → "interference"
[gardening] Fix recently introduced typo: "unsatified" → "unsatisfied"
[gardening] Remove accidental space.
2016-04-24 22:11:59 +02:00
Slava Pestov
0d34bc21ef IRGen: Emit reflection metadata for certain builtin types when -enable-reflection-builtins flag is passed in
These types are not directly referenced as fields of aggregate types,
but are needed for reflection type lowering.

Also, use a SetVector to collect referenced builtin types, instead of
a SmallPtrSet, to ensure compiler output is deterministic.
2016-04-22 22:36:05 -07:00
Slava Pestov
98abbdb332 Emit reflection metadata, but not reflection names, by default
This allows the reflection type lowering test to pass with the
default build configuration.
2016-04-21 15:15:30 -07:00
Dmitri Gribenko
af874abdbf Merge pull request #2244 from modocache/swiftandroid-ndk-version-bump-r11c
[android] Support latest Android NDK r11c
2016-04-20 15:15:21 -07:00
Brian Gesiak
b1a4fd90b5 [RemoteAST] Only build remoteast-test for host
swift-remote-ast has dependencies that cannot be satisfied by all
of the targets Swift supports. Specifically, the Android target is
unable to link libraries that libRemoteAST depends on, such as uuid.
To fix builds for unsupported platforms, only build remoteast-test
for the host platform.
2016-04-20 17:16:07 -04:00
Brian Gesiak
a7e2329444 [android] Support latest Android NDK r11c
- Update the documentation to reflect that Swift supports (only)
  the latest NDK version. Based on what I've heard from Android
  developers that use the NDK, this is a reasonable requirement.
- The most recent version of the Android NDK no longer includes a
  "4.8" toolchain version. Change the default to "4.9", and update
  the paths in the documentation to match.
- The build script option "--android-ndk-version" was misleading.
  This parameter actually refers to the Android API level. Swift
  currently supports 21 (Android 5.0) and above (although supporting
  lower API levels would be desirable).
2016-04-20 11:20:29 -04:00
swift-ci
728d21a00d Merge pull request #1442 from SwiftAndroid/master 2016-04-12 23:30:17 -07:00
Slava Pestov
9d6f723d14 Reflection: Add -swift-stdlib-enable-reflection-metadata flag for testing
This causes IRGen to emit metadata for our new out-of-process reflection
mechanism. Eventually this flag should be the default.
2016-04-12 19:15:36 -07:00
Zhuowei Zhang
7c502b6344 Port to Android
This adds an Android target for the stdlib. It is also the first
example of cross-compiling outside of Darwin.

Mailing list discussions:

1. https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151207/000171.html
2. https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151214/000492.html

The Android variant of Swift may be built using the following `build-script`
invocation:

```
$ utils/build-script \
  -R \                                           # Build in ReleaseAssert mode.
  --android \                                    # Build for Android.
  --android-ndk ~/android-ndk-r10e \             # Path to an Android NDK.
  --android-ndk-version 21 \
  --android-icu-uc ~/libicu-android/armeabi-v7a/libicuuc.so \
  --android-icu-uc-include ~/libicu-android/armeabi-v7a/icu/source/common \
  --android-icu-i18n ~/libicu-android/armeabi-v7a/libicui18n.so \
  --android-icu-i18n-include ~/libicu-android/armeabi-v7a/icu/source/i18n/
```

Android builds have the following dependencies, as can be seen in
the build script invocation:

1. An Android NDK of version 21 or greater, available to download
   here: http://developer.android.com/ndk/downloads/index.html.
2. A libicu compatible with android-armv7.
2016-04-12 19:26:21 -04:00
practicalswift
1ef6ea8c4c [gardening] \t → " " 2016-04-08 21:59:13 +02:00
Dmitri Gribenko
29e4c4e9b7 CMake: fix spelling of a variable name 2016-04-07 11:44:11 -07:00