Commit Graph

911 Commits

Author SHA1 Message Date
Saleem Abdulrasool
fdf0fa2775 build: improve debug builds on Windows
Ensure that we build all the target libraries with the correct build
configuration.  This is needed on Windows where the different MSVC
runtime libraries are ABI incompatible.
2019-05-18 20:04:09 -07:00
Saleem Abdulrasool
4d5470f905 build: remove unnecessary property sets (NFC)
These properties are extraneous.  They are never queried, and the
`set(...CACHE)` which precedes them will ensure that the value is
cached.  This should be functionally equivalent.
2019-05-17 14:33:19 -07:00
Saleem Abdulrasool
7514adf66a Driver: introduce new -libc option for Windows
On Windows, there are multiple variants of the C runtime that must be
explicitly specified and consistently used from the runtime to the
application.  The new `-libc` option allows us to control the linking
phase by correctly embedding the requested library to be linked.  It is
made into a required parameter on Windows and will add in the
appropriate flags for the imported C headers as well.  This ensures that
the C library is not incorrectly linked.
2019-05-16 21:01:47 -07:00
Ross Bayer
d84e2aa115 [Build System: CMake] Add missing SWIFT_STDLIB_LIBRARY_TYPES to the StandaloneOverlay.cmake module. 2019-05-13 16:26:00 -07:00
Ross Bayer
23a868e9f2 Merge pull request #24382 from Rostepher/usr-lib-install-name-dir
[Build System: CMake] Update the default install_name_dir to /usr/lib/swift for the standard library and overlays.
2019-05-13 15:05:22 -07:00
Ross Bayer
2966af316b [Build System: CMake] Add CMake module paths before importing in StandaloneOverlay.cmake. 2019-05-10 16:39:30 -07:00
Ross Bayer
5c06d77490 [Build System: CMake] Cleanup the StandaloneOveraly CMake module.
Preconditions have been moved to the top of the file. All the variables set have been grouped by kind and a few converted to cache variables for better control when building. This should cut down on merge-conflicts as well."
2019-05-10 15:09:11 -07:00
Saleem Abdulrasool
cd0c1e7150 build: correct flags for Windows build
Adjust the preprocessor macros to get correct DLL Storage for imported
functions.  This should help identify cases of incorrect linkage to
msvcrt/ucrt.
2019-05-09 17:16:51 -07:00
Michael Gottesman
4d4d6f6779 Merge pull request #24508 from compnerd/matchy-matchy
build: rename `LLVM_COMPONENT_DEPENDS`
2019-05-06 11:45:36 -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
Saleem Abdulrasool
f9b304e14b build: obsolete INTERFACE_LINK_LIBRARIES
This was deprecated a while ago, remove support for it.  This is no
longer used in the Swift build.  Remove the dead code.
2019-05-04 18:13:38 -07:00
Saleem Abdulrasool
816dfe23ac build: don't always load clang/cmark
clang/cmark are only needed for the tools, not for the runtime/SDK
overlay.  Do not attempt to configure clang and CMark in the case we do
not build the tools.  This is needed to enable the standalone standard
library only builds.
2019-05-01 22:18:29 -07:00
Saleem Abdulrasool
2e7c328077 Merge pull request #24168 from xiaobai/sink_component_arg
[CMake] Modify swift_install_in_component to support cmake install components
2019-04-30 21:06:32 -07:00
Ross Bayer
316a3b2b9e Merge pull request #24352 from Rostepher/standalone-stdlib-build-type
[Build System: CMake] Convert the SWIFT_STDLIB_BUILD_TYPE variable into a CMake cache variable in cmake/modules/StandaloneOverlay.cmake
2019-04-29 18:30:32 -07:00
Jordan Rose
d20a7ca64e [CMake] Switch to building the overlays in Swift 5 mode (#24350)
Now that that's stabilized, we don't have to keep them in Swift 4 mode
any longer. (Arguably we don't need the CMake variable at all, but it
may be useful again in the future.)

rdar://problem/49040980
2019-04-29 17:55:20 -07:00
Ross Bayer
dfb2d31e74 Rename the LIBRARY_INSTALL_NAME_DIR argument in add_swift_target_library to DARWIN_INSTALL_NAME_DIR which better explains that this argument only controls the install_name_dir for Darwin platforms. 2019-04-29 16:46:09 -07:00
Ross Bayer
bec25a1dad Added a new argument to add_swift_target_library to control the install_name_dir. 2019-04-29 16:46:09 -07:00
Ross Bayer
4cddfccbc1 [Build System: CMake] Convert the SWIFT_STDLIB_BUILD_TYPE variable into a CMake cache variable in cmake/modules/StandaloneOverlay.cmake 2019-04-27 22:44:01 -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
Dave Lee
374c2c82ce [cmake] Fix typo in SWIFT_INCLUDE_DIRS definition 2019-04-17 13:52:49 -07:00
Michael Gottesman
39846a31e8 [cmake] Remove stdlib-experimental from the default install components.
These are mostly private stdlib APIs. It doesn't really make sense to install
private stdlib APIs by default.
2019-04-10 08:33:56 -07:00
swift-ci
7f73f47cb4 Merge pull request #23909 from compnerd/cmake-in-cmake-is-something-something 2019-04-09 16:19:58 -07:00
Saleem Abdulrasool
22859376c6 build: do not search for native LLVM when not building tools
The standard library does not depend on the LLVM libraries at runtime.  Do not
perform the search for the LLVM configuration when the tools are not being
built.  This is needed to permit cross-compiling the standard library standalone
for android on a Linux host without building LLVM and Clang for android.
2019-04-09 12:38:57 -07:00
Saleem Abdulrasool
d3ce6a6da5 build: fix a mixup with the cmake variables
This adjusts the windows build for cross-compiling to use the correct
variable.  Import libraries will be generated and tracked properly if
the CMAKE_SYSTEM_NAME is set to Windows.  It does not matter what the
build system is.
2019-04-09 12:12:27 -07:00
Michael Gottesman
91dbbc3088 Merge pull request #23204 from compnerd/silence-in-the-library
Remove custom handling in add_swift_host_library
2019-04-08 10:49:42 -07:00
Saleem Abdulrasool
a5705d6825 build: add a workaround for reflection test on Windows
Copy the runtime component into the swift runtime directory.  Normally
the runtime directory is not the same as the library directory on
Windows.  This copies the runtime component into the build tree into the
runtime directory to permit the tests to find the standard library.
2019-04-07 14:41:30 -07:00
Saleem Abdulrasool
7e79874e0c build: inline the ICU handling into the CFLAGS handling
Rather than have the ICU handling be pushed down into the library handling, this
will move it into the CFLAGS calulation which was being augmented previously.
It is a cleanup that makes it easier to reason about the flags handling.
2019-04-05 16:05:15 -07:00
Saleem Abdulrasool
7e32c43653 build: append to the computed c_compile_flags
Adjust the `c_compile_flags` variable to ensure that the flags are ordered
correctly.  This is of import for the android build which may end up using
invalid header search path ordering otherwise.  This ensures that the path
for the ICU includes comes after the C++ headers which is necessary in new
C++ releases which shadow math.h
2019-04-05 15:52:51 -07:00
Saleem Abdulrasool
871c9a9418 build: sink the ICU flag handling lower (NFC)
Move the ICU flag handling to the same area as `_c_compile_variant_flags` which
computes the C compile flags.  This allows us to ensure that we order the flags
correctly when they are merged into the `c_compile_flags`.
2019-04-05 15:52:51 -07:00
Alex Langford
4cf2af591d [CMake] Make sure ICU libdir is correctly added to library_search_directories
The CMake variables ${sdk} and ${arch} are only set if
_add_variant_link_flags is invoked from add_swift_target_library calling
_add_swift_library_single. If you get to _add_swift_library_single from
add_swift_host_library, those variables will not be set and subsequent
linking will not find ICU libraries. This was an issue when building
swift host libraries on Android.
2019-04-02 12:11:14 -07:00
Ross Bayer
3acef63892 [Build System: CMake] Add back the missing install_name_dir for the standard library. 2019-04-01 11:19:27 -07:00
Ross Bayer
b0a533aa9a [Build System: CMake] Cleanup the install_name_dir special-casing for XCTest in add_swift_target_library. 2019-03-29 17:27:04 -07:00
Xi Ge
db0f39fc9a cmake: install swift-api-digester and swift-api-checker into the OSS toolchain. SR-10220 2019-03-29 11:47:17 -07:00
Saleem Abdulrasool
620c796312 Merge pull request #23594 from compnerd/syntactically-correct
Enable SwiftSynax/Parser globally
2019-03-27 22:07:35 -07:00
Michael Gottesman
f699e0e8d0 [ownership] Remove the -enable-mandatory-semantic-arc-opts flag now that it is enabled by default. 2019-03-27 18:33:21 -07:00
Saleem Abdulrasool
9b8310c3f9 build: extract compiler swap into a helper
This is needed as SwiftSyntaxParser also needs to be built with clang as
it uses blocks unconditionally.  However, building with cl provides much
better diagnostics and debugging as well as a significantly faster
build (~15-20% faster) as well as a faster compiler.
2019-03-27 15:04:49 -07:00
Mike Ash
965953d7a0 Merge pull request #23451 from mikeash/magic-symbols-for-install-name
[Build] Use magic linker symbols to specify an @rpath-relative install name when targeting pre-stable-ABI OSes.
2019-03-27 08:10:30 -07:00
Michael Gottesman
f854547c55 [ownership] Enable ownership verification by default.
I also removed the -verify-sil-ownership flag in favor of a disable flag
-disable-sil-ownership-verifier. I used this on only two tests that still need
work to get them to pass with ownership, but whose problems are well understood,
small corner cases. I am going to fix them in follow on commits. I detail them
below:

1. SILOptimizer/definite_init_inout_super_init.swift. This is a test case where
DI is supposed to error. The only problem is that we crash before we error since
the code emitting by SILGen to trigger this error does not pass ownership
invariants. I have spoken with JoeG about this and he suggested that I fix this
earlier in the compiler. Since we do not run the ownership verifier without
asserts enabled, this should not affect compiler users. Given that it has
triggered DI errors previously I think it is safe to disable ownership here.

2. PrintAsObjC/extensions.swift. In this case, the signature generated by type
lowering for one of the thunks here uses an unsafe +0 return value instead of
doing an autorelease return. The ownership checker rightly flags this leak. This
is going to require either an AST level change or a change to TypeLowering. I
think it is safe to turn this off since it is such a corner case that it was
found by a test that has nothing to do with it.

rdar://43398898
2019-03-25 00:11:52 -07:00
Mike Ash
26d44d5214 Properly configure the target library name used by magic-symbols-for-install-name.c. 2019-03-22 11:41:00 -04:00
Michael Gottesman
384882d5f3 Merge pull request #23201 from compnerd/patience-is-not-always-a-virtue
build: introduce and switch to GYB_SOURCES
2019-03-20 13:27:32 -07:00
Saleem Abdulrasool
01f6a2ad6d build: correct the variable name for cross-compiling
A typo snuck into the cross-compiling path and due to the machine that it was
tested on hvaing `/bin/llvm-tblgen`, the build succeeded.  Correct the typo to
ensure that we use the correct tblgen.
2019-03-18 08:55:31 -07:00
Michael Gottesman
0dfaa19f9f [ownership] Rename enable-sil-ownership => verify-sil-ownership.
I have been meaning to do this change for a minute, but kept on putting it off.
This describes what is actually happening and is a better name for the option.
2019-03-18 01:31:44 -07:00
Slava Pestov
1159af50d9 Rename -enable-resilience to -enable-library-evolution and make it a driver flag
Fixes <rdar://problem/47679085>.
2019-03-14 22:24:26 -04:00
Saleem Abdulrasool
4b9e9d3164 build: excise the concept of fat libraries
This was used for the swift-reflection-test tool.  Instead of using fat
binaries, use the target binary itself.  This simplifies the build logic
as well as paves the road to sub-builds for each target rather than a
monolithic build as we have today.

Originally, the swift-reflection-test was a host tool that linked
against the target libraries since it was testing the target layout.
Now that the tool has been split into a host and target component
(5ea5bb06a3) and we have target and host
libraries that we can link against appropriately, we do not need to link
against the FAT binary.  Since there was exactly one use of this
functionality, switching that from fat linking to regular linking allows
us to remove this functionality entirely.  Switch to regular linking and
remove the option.
2019-03-12 22:30:20 -07:00
Saleem Abdulrasool
8ed5c1a4bc build: introduce and switch to GYB_SOURCES
This avoids us having to pattern match every source file which should
help speed up the CMake generation.  A secondary optimization is
possible with CMake 3.14 which has the ability to remove the last
extension component without having to resort to regular expressions.  It
also helps easily identify the GYB'ed sources.
2019-03-11 13:48:54 -07:00
Saleem Abdulrasool
533a26a5eb build: remove outdated documentation (NFC) 2019-03-10 17:01:27 -07:00
Saleem Abdulrasool
f9df4cad97 build: remove DEPENDS from add_swift_host_library
Use the appropriate CMake mechanisms for building the libraries.
2019-03-10 17:01:27 -07:00
Saleem Abdulrasool
c1c75a4b2d build: drop LINK_FLAGS from add_swift_host_library
This is not currently being used.  Unfortunately, setting linker options
is difficult until CMake 3.13 which introduced target_link_options.
Prior to that, you needed to do:

set_property(TARGET <TARGET> APPEND_STRING LINK_FLAGS <NEW FLAGS>)

If needed, we could write a helper to provide the target_link_options
interface on earlier CMake versions.
2019-03-10 17:01:27 -07:00
Saleem Abdulrasool
31a5ae7f56 build: remove LINK_INTERFACE_LIBRARIES from add_swift_host_library
Use the appropriate CMake mechanism for building the libraries.
2019-03-10 17:01:27 -07:00
Saleem Abdulrasool
b0005e9f87 build: remove C_COMPILE_FLAGS from add_swift_host_library
Use the appropriate CMake mechanism for controlling flags for building
the code.
2019-03-10 15:38:55 -07:00