Commit Graph

458 Commits

Author SHA1 Message Date
Brian Gesiak
1c90753e7b Merge pull request #5160 from modocache/cmake-plist-info-apple-platforms
[CMake] Check target, not host, for Info.plist
2016-10-06 18:26:12 -04:00
Doug Coleman
7d95b6630d Revert "[CMake] Fix dependency on codesign steps"
This reverts commit 10506e00c0.

There are dylibs in lib/swift/macosx/x86_64/ and lib/swift/macosx/, and
with this patch the dylibs in the latter path don't get updated when the
code changes and are stale.

I'm not sure exactly how to correct this patch so let's just try again
when it updates both sets of dylibs.

rdar://28660201
2016-10-06 15:16:59 -07:00
Brian Gesiak
5ef02f69b0 [CMake] Check target, not host, for Info.plist
The CMake variable `APPLE` is set to true when building on a macOS
host, which means that logic to include linker flags for application
extensions, etc., will be enabled on a macOS host. That is, they will
be enabled even when cross-compiling the standard library to a
non-Apple platform, such as Android.

Instead of using `APPLE` to check the host OS, check whether the target
is an Apple platform.
2016-10-06 16:33:01 -04:00
Brian Gesiak
99cad87ea0 [CMake] Explicitly set Android lib prefix/suffix
When compiling the Swift standard library for Android on Linux, the
target prefixes and suffixes for static and shared libraries happen to
be the same for both platforms. When using a macOS host to compile,
however, the suffixes are different, causing build errors.

Explicitly set the prefixes and suffixes to prevent errors when
building on macOS.
2016-10-06 16:23:51 -04:00
Brian Gesiak
47bd025feb [cmake] Use is_darwin_sdk over CMAKE_SYSTEM_NAME
Checking CMAKE_SYSTEM_NAME to append Darwin-specific flags happens to
work when cross-compiling from one Darwinian system to another -- like
using a macOS host to build the standard library for iOS. It doesn't
work, however, when cross-compiling from macOS to Android, for example.

Instead of checking the host system name, check whether the SDK target
is Darwinian.
2016-10-05 11:04:59 -04:00
Brian Gesiak
f653d52fc1 Merge pull request #5101 from modocache/cmake-add-lipo-target-sdk
[cmake] Only add lipo targets for Darwin
2016-10-04 13:39:59 -04:00
swift-ci
95bd36f327 Merge pull request #5068 from modocache/add-swift-cmake-refactor-suffix-prefix 2016-10-03 20:13:48 -07:00
Brian Gesiak
60edee9155 [cmake] Only add lipo targets for Darwin
Swift's CMake build system creates "fat" binaries for Swift libraries,
so long as the host machine used to compile the libraries is a macOS
machine. However, when a non-Darwin target, such as Android, is being
compiled on a macOS host, this doesn't work. Instead, only add lipo
targets if the *target* is Darwin.
2016-10-03 14:23:15 -04:00
swift-ci
6568b2081c Merge pull request #5067 from modocache/add-swift-lipo-target-use-precondition 2016-09-29 14:17:54 -07:00
Brian Gesiak
126aed5abb [CMake] Add library target prefix/suffix in func
Add a function to set library target prefixes and suffixes. When new
targets require setting these prefixes/suffixes, contributors will be
able to modify this one function. NFC.
2016-09-29 16:22:04 -04:00
Brian Gesiak
68c99665b7 [CMake] Use precondition in _add_swift_lipo_target
Use the `precondition` CMake function added in e12fff76fd, rather than
custom logic, to check if arguments to `_add_swift_lipo_target` are not
set.
2016-09-29 15:59:01 -04:00
Brian Gesiak
7fbf5014f0 Merge pull request #4999 from modocache/cmake-in-list
[cmake] Enable IN_LIST compare policy
2016-09-29 15:45:01 -04:00
Chris Bieneman
f89461bf22 [CMake] NFC. Updates based on post-merge feedback
* Ensure LLVM_CMAKE_DIR is always set so it can be used
* Use LLVM_CMAKE_DIR instead of searching the module paths
* Label parameters of cmake_parse_arguments in comments
2016-09-28 22:21:03 -07:00
Brian Gesiak
3123b47602 [cmake] Enable IN_LIST compare policy
Enable CMake policy CMP0057, which allows `if()` statements to use the `IN_LIST`
operator. In addition, simplify several `if()` statements that used the
`list(FIND ...)` operation instead.
2016-09-28 22:35:05 -04:00
Chris B
3f0adbd6fd Merge pull request #5034 from llvm-beanz/fix-swiftshims-dependency
[CMake] Fix bad dependency in symlink_clang_headers
2016-09-28 13:34:06 -07:00
Chris Bieneman
10506e00c0 [CMake] Fix dependency on codesign steps
CMake's ninja generator doesn't apply POST_BUILD steps to phony targets, instead in creates standalone CUSTOM_COMMAND actions for them. The generated CUSTOM_COMMANDS then end up running always because they don't have properly specified dependencies.

This patch changes the code sign step on the lipo commands from being POST_BUILD commands to being standalone commands with properly specified inputs and outputs. It works by appending "-unsigned" to the name of the lipo target and the lipo output on Darwin build and replacing the lipo target with a target that wraps the code sign command.

With this patch re-running ninja on an already built build directory no longer results in re-codesigning all the stdlib dylibs.
2016-09-27 16:17:09 -07:00
Chris Bieneman
58ca217e8d [CMake] Fix bad dependency in symlink_clang_headers
The problem here is a bit complicated. The symlink_clang_headers target creates two symlinks to clang's headers, one under the build directory at lib/swift/clang, and the other under a temporary path.

The one under the temporary path is a bad symlink, and it is only created during the build so that it can be installed. It isn't actually used by the build. Ninja treats the bad symlink as a non-existing file, and since the build rule that creates it has the restat property on it this results in the commands to symlink the clang headers directory running over and over and over again during the build.

This patch prevents that by not generating the bad symlink during the build. Instead we generate it at install time using the LLVMInstallSymlink script that is vended as part of LLVM's distribution.
2016-09-27 15:29:29 -07:00
Michael Gottesman
82cc5cab3d Merge pull request #5005 from gottesmm/specify_lto_object_path_on_macos
Specify lto object path on macos
2016-09-25 02:44:20 -07:00
Michael Gottesman
e338c45964 [lto][cmake] When building with lto on macOS, specify to the linker the path where it should put the generated LTO object file.
This is important so that the object file references in the debug info are
preserved for possible use by dsymutil.

rdar://28062659
2016-09-24 22:38:33 -07:00
Chris Bieneman
239df580bb [CMake] Updates based on post-merge feedback on PR4966
This update addresses feedback from gottesmm.
2016-09-23 18:04:12 -07:00
Chris Bieneman
fde50dcc81 [CMake] Swift target libraries should depend on clang in non-standalone builds
When building non-standalone and using the in-tree clang all TARGET_LIBRARIES should depend on clang. This ensures clang is built before the build tries to use it.
2016-09-23 10:59:08 -07:00
Michael Gottesman
f1ae1f176c Revert "Define swift include build components but dont wire them up" 2016-08-28 15:49:33 -07:00
Michael Gottesman
7e2568dcf0 [cmake-components] Introduce a new API add_swift_host_tool for creating/initializing swift tool targets.
The main action here is to sink the creation of the installation rule for all of
the swift host tools into this API. In a latter commit, I will use this API to
create include and build rules for add_swift_host_tool.
2016-08-28 14:12:14 -07:00
Michael Gottesman
de3a7d78d1 [cmake][swift-components] Introduce SWIFT_{INCLUDE,BUILD}_COMPONENTS
We also validate that each one of the given components sets are actually sets
and in addition are disjoint from each other.

In order to make sure that this is a NFC change, add all components to all 3
variables. This ensures that we preserve normal behavior of generating cmake
targets for all components and building all components by default even when
nothing is passed in to be installed.
2016-08-28 13:32:51 -07:00
Michael Gottesman
a40e4194ec [cmake] Merge swift_configure_install_components into swift_configure_components. 2016-08-28 12:43:33 -07:00
Michael Gottesman
2c96a8e044 [cmake] Document the component system via the "Swift Component Manifesto". NFC. 2016-08-27 20:04:02 -07:00
Michael Gottesman
b3180657ea [cmake] Refactor swift defined component code from the main CMakeLists.txt => cmake/modules/SwiftConfigure.cmake. 2016-08-27 20:04:02 -07:00
Michael Gottesman
3c9fc6c2b8 Fix precondition_list_is_disjoint to actually test something. 2016-08-27 20:04:02 -07:00
Jordan Rose
aaebfc11c0 [CMake] Derive module names from target names rather than source file names. (#4494)
This will remove the restriction that overlays always need to have a source
file matching the name of the framework, at the "cost" of standardizing the
"swiftFoo" convention for libraries with a module named "Foo". (Until
someone exposes the MODULE_NAME setting at the add_swift_library level.)

If this passes all tests, a follow-up commit will adjust the names of
some of the source files in stdlib/.

rdar://problem/17535693
2016-08-26 09:08:26 -07:00
Michael Gottesman
b3819c6783 [cmake] Rename COMPONENT_DEPENDS to LLVM_COMPONENT_DEPENDS (#4311)
Now that I am going to be adding an IN_SWIFT_COMPONENT argument, I need to do
this to distinguish the concepts of an LLVM_COMPONENT and a SWIFT_COMPONENT.
2016-08-16 12:13:34 -04:00
Dmitri Gribenko
1d6b08ba97 stdlib: share the Unicode dataset across different test files 2016-08-07 23:29:24 -07:00
Michael Gottesman
06a70d3942 [cmake] Add cmake support for only applying tsan to the swift stdlib/runtime. 2016-08-03 17:53:57 -07:00
Luke Larson
4c421c5fd9 Ad-hoc sign stdlib dylibs
rdar://problem/27432896
2016-07-28 16:13:23 -07:00
Michael Gottesman
b35d2b38e2 [cmake] Refactor two empty string precondition checks to use the precondition function.
Removing unnecessary control flow in favor of expressing intent in actual words
is clearer to read and requires less text.
2016-07-25 12:05:44 -07:00
Michael Gottesman
69bf6ce306 [cmake][list] Add utilities to SwiftList.cmake for using cmake lists as sets.
This will allow for one to work with sets in cmake in a much cleaner
fashion.
2016-07-25 12:04:53 -07:00
Michael Gottesman
a6524d436b [cmake][utils] Add a new utility function precondition_binary_op.
This is a flexible way to assert that a binary operation succeeds. For
instance to precondition equality:

  precondition(EQUAL FOO BAR)

or string equality:

  precondition(STREQUALS FOO BAR)

Since cmake is so loosely typed, it is really important that we
precondition as much as possible to ensure sane behavior.
2016-07-25 12:03:25 -07:00
Michael Gottesman
27f2a8018e [cmake] Add an optional message parameter to precondition to allow for more specific precondition messages. 2016-07-25 12:03:25 -07:00
Michael Gottesman
aed9a81d00 [cmake][utils] Add a NEGATE flag to precondition.
Now one can do:

  precondition(VAR NEGATE)

to avoid typing:

  if (VAR)
    message(FATAL_ERROR ...)
  endif()

Normal precondition functionality is preserved.
2016-07-25 11:59:38 -07:00
practicalswift
7e89679404 [gardening] Fix recently introduced typos. 2016-07-24 22:32:40 +02:00
Lukas Stabe
4e291f0b09 Add release version to manpage
This also fixes compatibility with newer versions of pod2man.
2016-07-23 06:33:56 +00:00
Michael Gottesman
d417b48c77 [cmake] Move SwiftBuildType.cmake into SwiftUtils.cmake. NFC.
The contents of that .cmake file are cmake utility functions. Move them into
SwiftUtils.cmake, a file that contains cmake utility functions. This is just a
quick cleanup.
2016-07-21 13:55:42 -07:00
Michael Gottesman
df344a8fb7 [cmake] Rename SwiftInstallComponents.cmake => SwiftComponents.cmake. NFC
In the next little bit I am going to be creating a more complex components
system. In order to help with this, I am renaming SwiftInstallComponents =>
SwiftComponents.cmake to reflect the broader purpose.
2016-07-21 13:51:56 -07:00
Robert Widmann
97c6598e9d Merge pull request #3507 from compnerd/windows-msvc
build: support cross-compiling to windows
2016-07-14 16:54:15 -07:00
Saleem Abdulrasool
5e170ebcb5 build: support cross-compiling to windows 2016-07-13 21:37:04 -07:00
Michael Gottesman
031e8e52c6 [cmake] Remove dead code. NFC. 2016-07-13 15:50:22 -07:00
Dmitri Gribenko
0e838c4bbe Merge pull request #3428 from compnerd/msvc
Platform: port to msvcrt, add msvcrt module
2016-07-13 14:10:47 -07:00
Michael Gottesman
968f1b459b Merge pull request #3487 from gottesmm/merge_swifttranslateflag_into_swiftutils
[cmake] Merge SwiftTranslateFlag.cmake into SwiftUtils.cmake
2016-07-13 10:09:03 -07:00
Michael Gottesman
c92f51a479 [cmake] Merge SwiftTranslateFlag.cmake into SwiftUtils.cmake
Both files are relatively small and contain utilities used by the build system.
So it makes sense to merge them.
2016-07-12 21:47:33 -07:00
Michael Gottesman
51af90bc8e [cmake] Rename SWIFT_BUILD_TOOLS => SWIFT_INCLUDE_TOOLS
In LLVM, the convention is that *_INCLUDE_* means that cmake will generate
targets but says nothing about whether or not something will be built by default
or not. This means that as far as cmake is concerned, those targets do not
exist.

On the other hand, *_BUILD_* determines whether or not a class of things is a
dependency of the "all" target. Of course this implies that *_BUILD_* implies
that *_INCLUDE_* must be set to TRUE.

Currently SWIFT_BUILD_TOOLS is implemented like a *_INCLUDE_* option, so change
its name to SWIFT_INCLUDE_TOOLS.
2016-07-12 21:08:55 -07:00
Saleem Abdulrasool
a05fd17b64 Platform: port to msvcrt, add msvcrt module
This adds the swiftMSVCRT module which is similar in spirit to swiftGlibc and
swiftDarwin, exposing the Microsoft C Runtime library to swift.  Furthermore,
disable pieces of the standard library which are not immediately trivially
portable to Windows.  A lot of this functionality can still be implemented and
exposed to the user, however, this is the quickest means to a PoC for native
windows support.

As a temporary solution, add a -DCYGWIN flag to indicate that we are building
for the cygwin windows target.  This allows us to continue supporting the cygwin
environment whilst making the windows port work natively against the windows
environment (msvc).  Eventually, that will hopefully be replaced with an
environment check in swift.
2016-07-12 17:31:06 -07:00