Commit Graph

1731 Commits

Author SHA1 Message Date
Michael Gottesman
b9e6adce30 [cmake] Refactor out unittest configuration logic from unittests/CMakeLists.txt => cmake/modules/AddSwiftUnittests.cmake.
rdar://24717107
2016-06-10 01:48:36 -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
swift-ci
a02d518778 Merge pull request #2744 from compnerd/ELF-is-protected 2016-06-05 23:02:39 -07:00
Dmitri Gribenko
85ff8ff556 CMake: work around an issue with CMake Xcode generator and the Swift driver
The Swift driver does not update the mtime of the output files if the
existing output files on disk are identical to the ones that are about
to be written.  This behavior confuses the makefiles used in CMake Xcode
projects: the makefiles will not consider everything up to date after
invoking the compiler.  As a result, the standard library gets rebuilt
multiple times during a single build.

To work around this issue we touch the output files so that their mtime
always gets updated.
2016-06-02 16:04:43 -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
Saleem Abdulrasool
8f01620179 Revert "Build workaround: only consider shims to be protected in Swift code on Darwin."
This reverts commit 3e20817f8c.  Now that we are
using gold, this should work.  The work around is only needed for BFD linkers.
2016-05-27 07:44:59 -07: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
Bryan Chan
85fde8b1fb Add support for Linux s390x. LLVM's Swift calling convention support is used to ensure correct operations of C++ code in the runtime. This patch also includes some (incomplete) changes to enum handling to make enums work in most common cases. 2016-05-24 20:03:28 -04: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
a38a4ce596 SwiftRemoteMirror: Turn on reflection metadata by default
Flip the enable flags to disable and make these IRGen options
true by default.

rdar://problem/26206547
2016-05-21 17:40:37 -07:00
Dmitri Gribenko
cb4a7bd0ff Merge pull request #2560 from karwa/cmake-crosscompiling
Refactored CMake host/target SDK detection to support cross-compiling
2016-05-21 17:05:34 -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
John McCall
3e20817f8c Build workaround: only consider shims to be protected in Swift code on Darwin.
GNU ld seems to have problems with PC-relative references to
protected functions that aren't calls.  We'll generate that
pattern in Swift code in release builds because of function
merging.  The workaround is to just not tell the compiler
that these symbols can be addressed PC-relative when we might
be using GNU ld, which I've conservatively approximated as
"not Darwin" while I try to figure out what changed to cause this.
2016-05-19 16:46:58 -06:00
John McCall
b1983621d3 Fix the declaration of shim visibility on ELF platforms.
Declarations with protected visibility are assumed to be defined
within the current linkage unit, so we have to use default visibility
if we don't know that we're building that.  Teach the shim
visibility header to only use protected visibility when the
__SWIFT_CURRENT_DYLIB macro is defined, and define it when building
the standard library.  Eventually we should change
SWIFT_RUNTIME_STDLIB_INTERFACE and SWIFT_RUNTIME_EXPORT to be
parameterized by the defining dylib so that this works for all the
overlay stubs, too; for now, special-casing swiftCore is necessary
to fix the LInux build.
2016-05-19 14:38:34 -06: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
Erik Eckstein
62597ea58f build_script: Add an option to build the swift libraries multiple times to check if incremental compilation works.
A script checks if the output object file is written only once even if the compiler is invoked multiple times.
The main purpose of this check is to ensure that the compiler is deterministic (until IRGen).
2016-05-18 10:01:14 -07:00
SpringsUp
8c7da8d082 Refactored host/target SDK detection to support cross-compiling 2016-05-18 07:24:47 +02:00
David Farler
83c17d29b7 Remove -enable-refleciton-builtins flag, now unnecessary
We can always potentially emit 'builtin' reflection metadata, since
that now includes imported types referenced by the module.

rdar://problem/26259668
2016-05-12 20:49:35 -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
Michael Gottesman
e5ce27ca32 [lto] Make sure to use lipo from the toolchain ${SWIFT_DARWIN_XCRUN_TOOLCHAIN}.
Otherwise, we may get lipo from the wrong toolchain and it may not be
able to understand all of the architectures/bit code we are lipoing
together yielding an unknown architecture error.

rdar://24717107
2016-05-01 13:12:01 -07:00
David Farler
450a3d82c4 AddSwift: Fix typo in static library dependency append 2016-04-27 12:55:00 -07:00
Dmitri Gribenko
fc9c1f6a61 Merge remote-tracking branch 'origin/master' into swift-3-indexing-model 2016-04-26 10:20:31 -07:00
Rintaro Ishizaki
65bd53c842 [CMakeLists] Factored out cmake function that does single gyb processing
So that we can generate arbitrary output file.
2016-04-26 11:58:53 +09:00
Dmitri Gribenko
b75d2b9df4 Merge remote-tracking branch 'origin/master' into swift-3-indexing-model 2016-04-25 13:50:09 -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
Dmitri Gribenko
0984f81a50 Merge remote-tracking branch 'origin/master' into swift-3-indexing-model 2016-04-22 18:56:35 -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
Dmitri Gribenko
9f0d94c1b8 CMake: add dependencies on common gyb modules in 'utils/' 2016-04-18 14:00:37 -07: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
befbebcd30 [gardening] "OSX" → "OS X" 2016-04-11 23:12:40 +02: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
David Farler
e1eca69d1a Ensure swiftReflection is always built for the host
swift-reflection-dump, a host-side tool, requires this library that
normally builds for the configured platform. So, if the host platform
isn't configured to build for some reason, swift-reflection-dump will
fail to link.
2016-04-04 15:23:07 -07:00
practicalswift
abfecfde17 [gardening] if ([space]…[space]) → if (…), for(…) → for (…), while(…) → while (…), [[space]x, y[space]] → [x, y] 2016-04-04 16:22:11 +02:00
Dmitri Gribenko
495cade645 Drop the libbsd dependency
We were only using arc4random, and now we use C++ <random> instead.  See
also PR #1939.
2016-03-30 17:37:21 -06:00
David Farler
61c14d1759 Use target_link_libraries for fat executable dependencies
These were getting added to the link command line manually,
which can cause coincidental library ordering issues.
2016-03-28 16:34:44 -07:00