Commit Graph

1731 Commits

Author SHA1 Message Date
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
Michael Gottesman
9e2a0b1979 [cmake] Fix Xcode build for Release LLVM + Debug Swift.
There were a couple of thinkos here that I had to fix. This passed on my
machine. Lets see if the bots agree.
2016-07-12 15:55:23 -07:00
Michael Gottesman
d65d5e3404 [cmake] Remove dead code. NFC. 2016-07-12 15:54:32 -07:00
Michael Gottesman
5c2cda0047 [cmake] Remove duplicated code. 2016-07-12 15:26:55 -07:00
Michael Gottesman
f71e544c62 [cmake] Fix thinko.
Instead of overwriting all of the paths for the other build configurations with
the one that LLVM selected, I was resetting the path for LLVM's build
configuration over and over again. = /.

This fixes the issue.
2016-07-12 13:58:16 -07:00
swift-ci
7ae2ea26cc Merge pull request #3434 from gottesmm/create_add_swift_subdirectory 2016-07-10 00:30:12 -07:00
Michael Gottesman
23987b26f3 [cmake] Add the option SWIFT_BUILD_RUNTIME_WITH_HOST_LIBLTO.
Currently when we build with bitcode, we use the liblto that we just built,
despite the fact that we just compiled the runtime with the host clang. Really,
we should be consistent.

In the short term to unblock LTO (which wants to use the host liblto), provide
an option to use the host liblto but leave it off so that the normal behavior is
preserved.
2016-07-09 23:46:32 -07:00
Michael Gottesman
224d76391c [cmake] Follow LLVM/Clang's example and use add_llvm_subdirectory and invoke add_llvm_subdirectory when adding tools/libs. This allows us to selectively disable the building of tools by setting the variable SWIFT_{TOOL,LIB}_XXX_BUILD=OFF.
This is done by introducing the macros: add_swift_{lib,tool}_subdirectory.
2016-07-09 21:24:20 -07:00
Michael Gottesman
29ddcd8fb7 Merge pull request #3413 from gottesmm/cmake-refactor-xcode-support
Cmake refactor xcode support
2016-07-09 20:59:33 -07:00
Dmitri Gribenko
1302449935 Merge pull request #3411 from compnerd/target-sdk-aliases-and-exclusions
Target sdk aliases and exclusions
2016-07-08 14:10:16 -07:00
Brian Gesiak
c7b21e32f2 Merge pull request #3390 from modocache/3316-add-module-depends-android
[CMake] Expand SWIFT_MODULE_DEPENDS_* to Android
2016-07-08 15:10:34 -04:00
Michael Gottesman
b42b7f43d8 [cmake] Combine apply_xcode_substitutions and escape_llvm_path_for_xcode into a better escape_path_for_xcode that can be reused across cmake. 2016-07-08 09:51:18 -07:00
Michael Gottesman
455d3a1960 [cmake] Move the cmake xcode configuration code from SwiftSharedCMakeConfig.cmake => SwiftXcodeSupport.cmake. 2016-07-08 09:51:18 -07:00
Michael Gottesman
0e95abd35c [cmake] Move SwiftApplyXcodeSubstitutions.cmake => SwiftXcodeSupport.cmake.
As an additional fix, this moves the include of SwiftXcodeSupport to the one
place where its functionality is used, AddSwift.cmake. Keeping the include in
./CMakeLists.txt makes it seem like the functionality is needed there (when it
is not).

In a subsequent commit, I am going to refactor the xcode support I have been
adding to SwiftSharedCMakeConfig into this file and have SwiftSharedCMakeConfig
import it.
2016-07-08 09:51:18 -07:00
Saleem Abdulrasool
b4960195c1 build: support aliases for TARGET_SDKS
Introduce two new aliasees `ALL_POSIX_PLATFORMS` and `ALL_APPLE_PLATFORMS`.  The
latter expands to iOS, tvOS, watchOS, macOS and if relevant, the simulators.
The former expands to the same list as `ALL_APPLE_PLATFORMS` as well as Linux
and FreeBSD.
2016-07-08 09:38:02 -07:00
Michael Gottesman
d004abc088 [cmake] Instead of figuring out the exact location of all of the various libraries when translating Xcode targets, just use the path already provided in LLVMConfig.cmake for the configuration that we compiled LLVM specifically for.
If we compile LLVM for <CONFIG> in build-script with Xcode as our generator,
LLVMExports.cmake will have specific IMPORTED_*_<CONFIG> variables set for all
of our targets. These variables are what we really want to splat across all
Swift Xcode build configurations.

This patch rips out the old code that determined the actual location and instead
just grabs the IMPORTED_*_<CONFIG> variables and splats it accordingly.
2016-07-08 09:06:06 -07:00
Brian Gesiak
3d566a358b [CMake] Expand SWIFT_MODULE_DEPENDS_LINUX to Android
2633a0f3 expanded SWIFT_MODULE_DEPENDS_* to treat Linux and FreeBSD
separately. Android needs the same treatment as Linux, so expand the
Linux check to include Android as well. These changes fix an Android
build error, in which Glibc was not linked to private stdlib libraries
that relied upon it.
2016-07-08 08:00:11 -07:00
practicalswift
9a8bbe0014 [gardening] Fix recently introduced typos. 2016-07-07 13:14:25 +02:00
Saleem Abdulrasool
34dce93062 Merge pull request #3316 from compnerd/multiple-platforms
stdlib: build multiple platform libraries simultaneously
2016-07-06 21:25:47 -07:00
Saleem Abdulrasool
47dbd2f0ef Merge pull request #3324 from compnerd/coff-indirect-addressing
stdlib: be more DLL friendly on Windows
2016-07-06 21:06:15 -07:00
Saleem Abdulrasool
3d174c372a stdlib: be more DLL friendly on Windows
When the standard library is built dynamically on COFF targets, the public
interfaces must be decorated in order to generate a proper DLL which can be
confused by the dependent libraries.  When the exported interface is used, it
must be indirectly addressed.  This can be done manually in code or the MS
extension of `__declspec(dllimport)` may be used to indicate to the compiler
that this symbol be addressed indirectly.  This permits building more pieces of
the standard library dynamically on Windows.
2016-07-06 17:51:31 -07:00
Michael Gottesman
95b659583e [cmake] Also provide absolute paths for shared libraries/executables in addition to static libraries.
Eliminates a warning when building lldb.

It looks like lldb is still able to find the right library. But doing it this
way is guaranteed to be correct (eliminating future bugs is good).
2016-07-06 17:28:38 -07:00
Saleem Abdulrasool
2633a0f312 build: expand SWIFT_MODULE_DEPENDS_<TARGET>
Expand the macros to have Linux and FreeBSD specific module depends.  This
enables us to build more libraries unconditionally.
2016-07-05 17:32:38 -07:00
Michael Gottesman
5eb835cfcf [cmake] Refactor check_working_std_regex into its own cmake file SwiftCheckCXXNativeRegex.cmake and rename it appropriately.
It is better to have the top level CMake file only consist of includes and
settings, rather than have it include business logic like this.

Should be NFC.
2016-07-04 20:45:27 -07:00
Saleem Abdulrasool
7be43242d1 build: prefer SWIFT_SDK_*_OBJECT_FORMAT
Fix another instance of a SDK target check in favour of the object format check.
2016-07-03 11:36:21 -07:00
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
Michael Gottesman
be09b2f873 [cmake] Remove direct computation of dependencies on LLVM libraries and exact paths to those libraries.
Now that we have the full dependency information from LLVM/Clang, this is no
longer necessary. We will just do the *right* thing.

Additionally, since we were passing these libraries as absolute paths, cmake was
always passing through all of the given libraries even if CMake had already
added them to the link line in its non-absolute form. It is not clear to me how
if all linkers would be smart about this.

Regardless, now we just translate components to libraries and continue on our
merry way. In the future, we can even remove the llvm-build code period by just
specifying LLVM dependencies directly via LINK_LIBRARIES instead of having to do
anything with COMPONENT_DEPENDS.

But that is for a future commit.
2016-07-01 17:35:41 -07:00
Michael Gottesman
a0480e5f79 Merge pull request #3299 from gottesmm/fix_xcode_builds
Fix xcode builds
2016-07-01 17:11:41 -07:00
Harlan
1625d97976 Switch to llvm-profdata's pooled profdata merge (#3281) 2016-07-01 16:45:21 -07:00
Michael Gottesman
c2645d07c6 [cmake] Expand $(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) from all LLVM/Clang imported target locations.
Normally when building in Xcode, Xcode will assume that LLVM/Clang use the same
configuration as Swift and will try to pull in the sources from that
configuration's build directory.

This is incorrect when we are compiling a Release LLVM with a Debug Swift. This
commit uses our escaping functionality from 0a48857 and the new imported targets
to fix this issue.

rdar://27062396
2016-07-01 14:02:01 -07:00
Michael Gottesman
0a4885732e [cmake] Expand $(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) in LLVM CMake paths.
In order to support swapping build types without reconfiguring, Swift's CMake
generated Xcode project has one directory for each cmake build type. This
behavior is implemented by placing in variables for Xcode to expand at build
time. This causes issues with our build, namely that our cmake scripts like to
"poke" around the LLVM build directory at configure time. Since the xcode
variables from the commit title are not expanded, failures occur since the
unexpanded paths do not exist.

This patch fixes this problem by expanding out those variables at configure time
from specific LLVM paths. This is essentially tieing LLVM to the specific
build-script build mode used. This is reasonable since we do not support
building in Xcode for configurations that were not selected at build-script
time.

rdar://27062396
2016-07-01 13:47:38 -07:00
Michael Gottesman
523312ed63 Use find_package instead of include.
rdar://27062396
2016-07-01 13:40: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
John McCall
bd3bc93787 Fix unified builds. 2016-06-28 10:04:54 -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
swift-ci
24a5b121ee Merge pull request #3210 from compnerd/experimental-linkers 2016-06-27 23:08:16 -07:00