Commit Graph

506 Commits

Author SHA1 Message Date
Saleem Abdulrasool
46ec2cf0fb add_swift_host_tool: normalize arguments, rename prefix 2019-01-04 15:30:09 -08:00
Saleem Abdulrasool
783e8eceaa Merge pull request #21635 from compnerd/toolchain-only
build: honour LLVM_INSTALL_TOOLCHAIN_ONLY
2019-01-04 10:11:01 -08:00
Saleem Abdulrasool
29e8127d26 build: use the architecture directory for Windows resources
Windows does not support fat binaries, so the target specific components should
be placed into the architecture subdirectory.  Due to the cross-compilation
model that swift has, this needs to be added explicitly for now.
2019-01-04 09:08:35 -08:00
Saleem Abdulrasool
c9c12feacc build: honour LLVM_INSTALL_TOOLCHAIN_ONLY
This improves the integration with LLVM and the unified build.  The
LLVM_INSTALL_TOOLCHAIN_ONLY flag ensures that the the development libraries are
not installed.  Because this option is not defined by default, the beahavioural
changes here are not triggered by default.
2019-01-04 08:56:04 -08:00
Saleem Abdulrasool
1d2a4d65b5 build: attempt to install the import libraries 2019-01-03 12:24:20 -08:00
Saleem Abdulrasool
9624932391 build: add Windows includes to build 2018-12-16 22:23:41 -08:00
swift-ci
8629cd5c2a Merge pull request #21314 from drodriguez/android-link-with-cpp-abi 2018-12-15 14:31:08 -08:00
Saleem Abdulrasool
7020740dcf Merge pull request #21326 from xiaobai/swift_component_required
[CMake] Require SWIFT_COMPONENT for add_swift_host_tool
2018-12-14 17:30:47 -08:00
Saleem Abdulrasool
3225e36d63 stdlib: reorder add_subdirectory to repair the Windows build
Due to the horrible attrocities against software of the attempt to perform
cross-compilation in the swift build system, we need to emulate the linking
behaviour for Windows with the link against the import library.  The emulation
requires the custom creation of import library targets.  In order to actually
get the linking semantics correct, the dependendency targets must be created
prior to use (unlike standard CMake).  The reordering ensures that we get
correct linkage when building for Windows.

Perform a simple optimization to avoid a number of string comparisions for the
host system.
2018-12-14 13:56:16 -08:00
Daniel Rodríguez Troitiño
bcf800a15d [android] Link with static C++ ABI for Android.
Normally, the C++ shared library would have link against the C++ ABI
shared library, but the Android NDK does not distribute the later, so
one need to link manually against the static C++ ABI from the NDK.
2018-12-14 13:23:31 -08:00
Alex Langford
5d5d01a2fe [CMake] Require SWIFT_COMPONENT for add_swift_host_tool 2018-12-14 12:27:53 -08:00
Saleem Abdulrasool
883966edda build: only add -Fsystem path if configured
The system framework paths are only configured for the Apple targets.  Add a
condition to avoid a search path to be added for other SDKs.
2018-12-13 09:42:04 -08: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
Saleem Abdulrasool
0a601defd5 build: use the right extension for Windows for swiftrt
The swift image registrar uses the extension `.obj` as is traditional on
Windows.  Ensure that we get the extension correct when cross-compiling with the
Swift specific cross-compilation system.
2018-12-06 15:51:35 -08:00
Daniel Rodríguez Troitiño
b3b0d87055 [android] Avoid linking twice with C++
The Android targetted libraries already link (manually) with the Android
NDK C++ libraries. When using Clang and lld, an extra link to libc++ is
requested, which will fail because Android names it libc++_shared.so
instead. To avoid looking for the wrong name, and since the library is
referenced manually either way, request no linking with the standard C++
libraries (but add the math library in, which is implicitly linked when
C++ is linked, and it is needed for Glibc at least).
2018-12-06 11:10:22 -08:00
Saleem Abdulrasool
e3b699bb59 build: overwrite the fat libraries with the targets
Ensure that the use the target specific names for the fat libraries for
non-MachO targets which do not support fat libraries.  This fixes the
windows build.
2018-12-03 19:39:50 -08:00
Saleem Abdulrasool
3d1839a016 build: support SWIFT_MODULE_DEPENDS_WINDOWS
Add support for depending on swift modules for the windows target.  This
is needed as the private swift modules start to build on Windows.
2018-11-29 19:26:59 -08:00
Daniel Rodríguez Troitiño
def11722a9 Split link flags and link libraries lists to make gold happy.
gold is more strict than lld about the order of the arguments, that's
why CMake offers two different properties for the linker: LINK_FLAGS and
LINK_LIBRARIES. The former _add_variant_link_flags was adding the
libraries to LINK_FLAGS, when the correct thing is to add them to
LINK_LIBRARIES.

The change adds a new output variable for _add_variant_link_flags which
will containt the linked libraries, and CMake will be able to generate
the correct command line invocation for when gold is used.

This should fix the Android CI build.
2018-11-27 15:24:52 -08:00
Saleem Abdulrasool
d1eb3a54b4 Merge pull request #20766 from compnerd/importing-fat
build; correct swift fat library linking on Windows
2018-11-26 21:36:31 -08:00
Saleem Abdulrasool
d8bce85076 build; correct swift fat library linking on Windows
Windows does not link against the library but the import library.  When
building the target specific bits, we unfortunately do not use the cmake
build infrastructure properly.  This results in us trying to link
against libraries which do not exist.  Redirect the link to the right
files.  This allows us to build swift-reflection-test.
2018-11-26 16:38:38 -08:00
Saleem Abdulrasool
6a0989b7a2 build: pass /GR- when using cl-like drivers
When building with clang-cl, we should pass /GR- rather than the
gcc-style driver options.  This repairs the build of swift on Windows.
2018-11-26 12:50:18 -08:00
Saleem Abdulrasool
66fa742732 Merge pull request #20718 from compnerd/host-tools-dce
host tools DCE
2018-11-26 09:55:17 -08:00
Saleem Abdulrasool
adfb508317 build: specify architecture when building for Windows
The Windows SDK requires that the architecture is specified.
2018-11-25 19:09:29 -08:00
Saleem Abdulrasool
1f9feb550f add_swift_host_tool: DCE DEPENDS (NFC) 2018-11-23 11:03:34 -08:00
Saleem Abdulrasool
9110ae733e add_swift_host_tool: DCE COMPILE_FLAGS (NFC) 2018-11-23 11:03:34 -08:00
Saleem Abdulrasool
47e060878d add_swift_host_tool: DCE SWIFT_MODULE_DEPENDS (NFC) 2018-11-23 11:03:34 -08:00
Saleem Abdulrasool
f3e4982179 build: remove DONT_STRIP_MAIN_SYMBOL, DISABLE_ASLR flags
These flags are unused by the single add_swift_executable call.  Remove
support for these flags.
2018-11-05 22:46:09 -08:00
Xi Ge
103f9a8246 Revert "[Build System: CMake] make add_swift_library a wrapper to add_llvm_library" 2018-11-02 12:49:07 -07:00
Saleem Abdulrasool
c3555cf0c4 add_swift_host_library: special handling for GYB sources 2018-10-31 12:46:31 -07:00
Saleem Abdulrasool
e92c2a251e add_swift_host_library: make a trivial wrapper around add_llvm_library 2018-10-31 12:46:31 -07:00
Saleem Abdulrasool
1bb88b7ec4 add_swift_host_library: remove LINK_FLAGS 2018-10-31 12:46:31 -07:00
Saleem Abdulrasool
ce32a87d79 add_swift_host_library: remove LINK_INTERFACE_LIBRARIES 2018-10-31 12:46:31 -07:00
Saleem Abdulrasool
c5c64ca3ea add_swift_host_library: rename LLVM_COMPONENT_DEPENDS to LINK_COMPONENTS 2018-10-31 12:46:31 -07:00
Saleem Abdulrasool
39dde93c88 add_swift_host_library: rename LINK_LIBRARIES to LINK_LIBS 2018-10-31 12:46:31 -07:00
Saleem Abdulrasool
e0b839330d add_swift_host_library: remove C_COMPILE_FLAGS 2018-10-31 12:46:31 -07:00
Saleem Abdulrasool
738a00a0c0 add_swift_host_library: remove FILE_DEPENDS 2018-10-31 12:46:31 -07:00
Saleem Abdulrasool
b2b8048b3f build: split out host and target library builds fully
Remove this special case handling for building a host library as a target
library.  This is the last piece needed to support cross-compiling lldb.  As a
bonus, it cleans up some of the logic in our special build system.
2018-10-30 10:56:14 -07:00
Devin Coughlin
c119bfaaba [Build] Relax CMAKE_C_COMPILER_ID "Clang" check to match AppleClang
In https://github.com/apple/swift/pull/19973 the logic that adds "-target" when
building the C parts of the Standard Library and overlays was changed to use
CMAKE_C_COMPILER_ID to only do so when the compiler ID is "Clang". However,
on Apple toolchains the compiler ID is "AppleClang", so the target was no
longer being explicitly set.

Update the logic to relax the explicit check for "Clang" to also allow
"AppleClang".

rdar://problem/45579667
2018-10-29 18:01:30 -07:00
swift-ci
ecf29e694a Merge pull request #20115 from compnerd/wimplib 2018-10-28 18:28:44 -07:00
Saleem Abdulrasool
af8fc10bd1 build: install the import libraries for windows
When building the target libraries, we need to install the import
library as well.  Unfortunately, due to the way that the swift build
system works, we do not have the ability to rely on CMake doing the
right thing and taking care of this for us.  We have to manually
construct and track the import library due to the fact that we fight the
cross-compilation support.  Add some logic to extract the import
libraries and install them so that uses can actually build for Windows.
2018-10-28 13:08:50 -07:00
Saleem Abdulrasool
ecf0b58d72 build: remove unused options in add_swift_host_library
Debride the function now that it is handles only the host libraries for
the tools.  These are closer in spirit to the LLVM libraries and this
function can really become a trivial wrapper around llvm_add_library.
2018-10-28 10:45:42 -07:00
Michael Gottesman
aba53ee0ca Merge pull request #20110 from gottesmm/pr-301c86df6766d9a2fc825201c9c10888ba2d4310
[cmake] Eliminate dead target code from add_swift_host_library and de…
2018-10-27 16:58:52 -07:00
swift-ci
2f2ce13953 Merge pull request #20107 from compnerd/frontend-is-not-cc 2018-10-27 15:39:29 -07:00
Michael Gottesman
1e6d9482b1 [cmake] Eliminate dead target code from add_swift_host_library and dead host code from add_swift_target_library. 2018-10-27 15:30:28 -07:00
Michael Gottesman
3f17bb6ddf Carefully split the build's invocation of add_swift_library into host/target variants.
The key thing here is that all of the underlying code is exactly the same. I
purposely did not debride anything. This is to ensure that I am not touching too
much and increasing the probability of weird errors from occurring. Thus the
exact same code should be executed... just the routing changed.
2018-10-27 12:58:51 -07:00
Saleem Abdulrasool
d4ea2781e8 build: pass the Windows headers properly
The Windows headers are the system (sysroot) headers.  They are not
consumed by swift but the clang importer.  Furthermore, they should be
treated as system headers.  Correct the flags used for the invocation.
This fixes the build of the SDK overlay for Windows.
2018-10-27 11:38:30 -07:00
Saleem Abdulrasool
15355ab20a build: be more conservative when passing -target
When building the swift tools with gcc, we would fail as we would try to
pass `-target` to gcc, which does not support this option.  Invert the
condition and only pass the argument when building with clang.
2018-10-21 15:30:49 -07:00
Saleem Abdulrasool
70a32af57b build: make the lipo detection uniform
Change the standalone SDK overlay build and unified build lipo detection
identical.
2018-10-18 12:12:06 -07:00
Saleem Abdulrasool
9e30ae35d0 build: fix parameter name in cmake
Fix the parameter name in `_add_swift_library_single` which would
previously not pass any value for the `INSTALL_IN_COMPONENT` due to a
missed alteration when the function was refactored.  Spotted by
inspection.
2018-10-16 17:28:15 -07:00
Saleem Abdulrasool
ef14e9dc02 build: replace some is_darwin_sdk usage
Use the simpler inline form of the check in most places.  The two sites
that remain have multiple uses in a single function.  It should be
possible to replace those as well, though it is unclear if the overhead
of inlining the check to all the places in the function will make a
measurable difference.
2018-10-15 18:00:43 -07:00