Commit Graph

83 Commits

Author SHA1 Message Date
Saleem Abdulrasool
a1c971907b build: repair the Windows build
This should repair the Windows build after #29451.  The quoting
behaviour was incorrect and was constructing an invalid compiler
invocation.  Solve the issue by using `target_include_directories`
instead.  However, since this needs the target, hoist the flag
computation to the local sites.  This replicates more logic because of
the custom build trying to replicate the CMake build logic in CMake.
2020-01-27 22:35:28 -08:00
Saleem Abdulrasool
d8b3b626fe build: use modern target property handling
Use specific operations for setting the compile flags, link flags,
linked libraries, and library search paths.  This allows us to use CMake
more effectively, simplifies the logic, and will ensure that flags are
not duplicated.
2020-01-25 16:08:51 -08:00
Saleem Abdulrasool
d3f72155d8 Merge pull request #29399 from compnerd/sk-rpath
build: move the RPATH handling to the executables
2020-01-24 08:19:27 -08:00
Saleem Abdulrasool
bc21d4ff46 build: move the RPATH handling to the executables
This moves the handling of the RPATH and the exported symbol to the
binary themselves.  The exported symbol is needed due to the use of the
exported symbol list.  This makes the small difference that `_main` is
always exported on Darwin which is not strictly needed in ASAN as ASAN
provides the entry point.

The RPATH is only setup on installation which is sufficient for testing
purposes as CMake ensures that the libraries are fully linked and will
be loaded properly when run from the build tree.
2020-01-23 13:38:22 -08:00
Saleem Abdulrasool
1f961414a5 build: remove support for EXCLUDE_FROM_ALL (NFC)
This parameter is unused.  Simply remove the option from the
`add_swift_sourcekit_executable`.
2020-01-23 12:44:28 -08:00
Michael Gottesman
8d712af965 [cmake] Add support for exporting frameworks/libraries into cmake export files.
I think this was just an oversight. The new cmake 3.16 seems to choke if we do
not add SourceKit to the exports file since there are dependencies upon it in
other swift libraries.
2019-12-18 10:44:55 -08:00
Butta
14cc620016 [android] A few tweaks for native compilation and to get more tests working
Now that CMAKE_HOST_SYSTEM_NAME and CMAKE_SYSTEM_NAME are set by default to
Android in the Termux app, make the needed tweaks. Some tests were adapted
to work natively on Android too, adds sys/cdefs.h to the Bionic modulemap,
and includes the start of native Android platform support in the build-script.
2019-12-07 01:01:59 +05:30
Saleem Abdulrasool
717c4d3ebf SourceKit: remove LINK_LIBS (NFC)
This removes the custom `LINK_LIBS` in favour of
`target_link_libraries`.  This simplifies the custom functions that we
have for adding libraries, makes it easier to query the information from
ninja and will allow us to slowly remove more of the custom logic for
building the products.
2019-11-14 13:41:01 -08:00
Saleem Abdulrasool
2dbb7fae96 build: add a dependency on the just built clang (NFC)
When building in a unified build and building the host tools with a
non-clang compiler, we switch compilers.  In such a case, we need to
actually add an explicit dependency on the new compiler.
2019-10-26 17:17:41 -07:00
Alex Langford
61be4d969f [CMake][NFC] Introduce component targets for proper dependency tracking
This commit introduces a CMake target for each component, adds install targets
for them, and switches build-script-impl to use the target `install-components`
for installation. Each of the targets for each component depends on each
of the individual targets and outputs that are associated with the
corresponding swift-component.

This is equivalent to what already exists, because right now install rules are
only generated for components that we want to install. Therefore, this commit
should be an NFC.

This is a resubmission (with modifications) of an earlier change. I originally
committed this but there were problems with some installation rules.
2019-08-22 10:16:50 -07:00
Ben Langmuir
327c666b8a Revert "[CMake][NFC] Introduce component targets for proper dependency tracking" 2019-08-08 16:35:59 -07:00
Alex Langford
50a0e87c69 [CMake][NFC] Introduce component targets for proper dependency tracking
This commit introduces a CMake target for each component, adds install targets
for them, and switches build-script-impl to use the target `install-components`
for installation. Each of the targets for each component depends on each
of the individual targets and outputs that are associated with the
corresponding swift-component.

This is equivalent to what already exists, because right now install rules are
only generated for components that we want to install. Therefore, this commit
should be an NFC.
2019-08-08 11:50:35 -07:00
Alex Langford
07214e1377 [CMake] Support cmake install components for targets with multiple target files
When installing a target, you could have multiple target files with
different rules for installation. For example, you can specify rules for
`RUNTIME` files, `LIBRARY` files, `ARCHIVE` files, etc. Each of these
can take several options, e.g. `DESTINATION`. When you want to specify
the install component for a target, each of the different target file
rules need to have their own `COMPONENT` field. If not, they end up as
"Unspecified" which means they will not get installed with the
associated swift component.
2019-07-17 13:27:41 -07:00
Saleem Abdulrasool
218b37e1bb build: rename LLVM_COMPONENT_DEPENDS
This is not a target dependency but a target link.  Name the parameter
to be less misleading.  This also makes the name identical to the LLVM
parameter.
2019-05-04 19:58:28 -07:00
Alex Langford
3d9a28925b [CMake] Modify swift_install_in_component to support cmake install components
CMake supports the notion of installation components. Right now we have some
custom code for supporting swift components. I think that for installation
purposes, it would be nice to use the CMake component system.

This should be a non-functional change. We should still only be generating
install rules for targets and files in components we want to install, and we
still use the install ninja target to install everything.
2019-04-19 14:06:11 -07:00
Alex Langford
799eb632c8 [CMake] Make SourceKit respect link_libraries and library_search_directories
add_sourcekit_default_compiler_flags was invoking
_add_variant_link_flags and getting link flags but not actually using
the link_libraries or library_search_directories. In android builds,
this means that the correct libc++ is not being linked against.
2019-04-02 12:06:44 -07:00
Ben Langmuir
1efade0b47 [cmake] Move install() after set_target_properties() to workaround crash
Calling install() on a framework target before setting the FRAMEWORK
property triggers a [crash](https://gitlab.kitware.com/cmake/cmake/issues/18848). Workaround by changing the call order.
2019-01-28 16:24:09 -08:00
Saleem Abdulrasool
522f97da43 build: simplify the blocks handling
`-fblocks` is a core driver option now, so it can be used with both the GCC
style driver as well as the cl style driver.  Simplify the logic for the
handling of this option.
2018-12-07 08:24:19 -08:00
Argyrios Kyrtzidis
92377cc145 [CMake] Move cross-platform dispatch/blocks support to the tools level, in preparation for the syntax parser library 2018-12-05 22:41:39 -08:00
Jordan Rose
6afe77ae98 [CMake] Clean up (somewhat) the generated Xcode project (#20586)
Still to do: have command-only targets that present sources, for things
like copy_shim_headers.
2018-11-26 11:31:41 -08: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
2f8a4dbf4a Merge pull request #19933 from compnerd/micro-opt
SourceKit: micro-optimization of CMake (NFC)
2018-10-19 14:58:20 -07:00
Saleem Abdulrasool
13c83b121e SourceKit: always install headers
Ensure that we install the client header for the InProc sourcekitd. This is
needed to actually make it usable. With this, it is now possible to develop
against SourceKit on Linux and Windows.
2018-10-17 15:01:27 -07:00
Saleem Abdulrasool
8395e355e5 SourceKit: micro-optimization of CMake (NFC)
Set all the target properties in a single shot.  This avoids the multiple string
parsing within CMake.  Although this makes no noticable differnce, it is
slightly more efficient and also colocates all the target properties.
2018-10-17 14:53:24 -07:00
Saleem Abdulrasool
0df7b2f4be SourceKit: enable builds for Windows
SourceKit's build is now ammenable to building for Windows.  Generalize the path
to enable building it for Windows as well as Linux.  The libdispatch build for
the compiler is needed for all non-Darwin targets currently.
2018-10-04 16:44:54 -07:00
Saleem Abdulrasool
3469797df5 SourceKit: use shared BlocksRuntime
Adjust the SourceKit's embedded libdispatch build to use the shared build of
BlocksRuntime now that we can generate that.
2018-10-03 09:27:49 -07:00
Saleem Abdulrasool
6c8c7151ff SourceKit: repair the build when cross-compiling
Not all targets (CMAKE_SYSTEM_NAME) use `lib` and `.a` for the static library
name.  Adjust the name properly for the host that we are building for.  This
repairs the build when performing a cross-compile from Linux to Windows.
2018-10-01 14:54:06 -07:00
Argyrios Kyrtzidis
4179ceb4f9 Add a comment for the AddSwiftSourceKit.cmake change 2018-06-26 10:57:01 -07:00
Argyrios Kyrtzidis
7f6afa0357 [SourceKit/CMake] Make sure the XPC service executable isn't linked with an absolute build directory rpath
rdar://40462455
2018-06-26 10:47:11 -07:00
Argyrios Kyrtzidis
3156180c08 [SourceKit] For the XPC service identifier, also include the platform name
This is useful because the embedded platforms may have the same toolchain version but they contain
different stdlibs. We need to make sure the XPC service name is unique between them, otherwise we may load
and use the incorrect toolchain service.

rdar://39077520
2018-04-10 11:24:55 -07:00
Bob Wilson
390058972a [master-next] Use PRIVATE in target_link_libraries for executables
This is needed to work with LLVM r319840.
2017-12-06 21:55:22 -08:00
Saleem Abdulrasool
9fff09d817 build: improve SourceKit handling of libdispatch
Avoid overwriting the `swiftCore` target in the SourceKit build.
Instead, link to the explicit variant of the swiftCore.  This tracks the
dependency better and enables multiple parallel cross-compilations of
the stdlib.

Implicitly link against swiftCore when linking against libdispatch.
Remove the extraneous link against the Blocks runtime on Linux.  The
`add_sourcekit_executable` call already handles this.  Ensure that we
enable the swift SDK overlay for libdispatch by sending it the path to
the swift compiler.
2017-10-02 21:40:29 -07:00
Michael Gottesman
a05c4dda07 [cmake] Move the 'routines' of SourceKit's cmake into a cmake module.
This is a NFC change that makes it easier to read SourceKit's main
CMakeLists.txt file since you only see "actions" rather than also this huge list
of helper routines.
2017-09-20 20:33:16 -07:00