Commit Graph

1144 Commits

Author SHA1 Message Date
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
Saleem Abdulrasool
ee5ab9e98a build: prevent accidental addition of LINK_LIBRARIES
Protect against LINK_LIBRARIES, directing the developer to
target_link_libraries.  This has no impact on the build currently.
2019-03-09 20:44:41 -08:00
Ross Bayer
7d251cff1a Merge pull request #23188 from Rostepher/standalone-find-llvm-cmake-modules
[Build System: CMake] Partially revert PR #22840, manually adding the LLVM CMake module path to CMAKE_MODULE_PATH rather than using find_package.
2019-03-08 14:00:58 -08:00
Ross Bayer
3a95da9a69 [Build System: CMake] Partially revert PR #22840, manually adding the LLVM CMake module path to CMAKE_MODULE_PATH rather than using find_package. 2019-03-08 12:55:44 -08:00
Doug Gregor
3bf75e6333 Merge pull request #23147 from DougGregor/disable-abi-breaking-checks
[CMake] Set -DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1 for runtime/overlays
2019-03-07 14:31:12 -08:00
Doug Gregor
c94da3b4da [CMake] Set -DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1 for runtime/overlays
Whenever we're building C++ code as part of the Swift runtime or overlays,
disable the ABI-breaking checks. We are only using header content from
LLVM's ADT library.

Fixes rdar://problem/48618250.
2019-03-06 17:21:17 -08:00
Ben Langmuir
a678e74517 Fix optional stdlib component install 2019-03-06 14:42:52 -08:00
Jordan Rose
13430961b4 [CMake] Fix creation of swiftmodule directories on Apple platforms (2)
The previous commit resulted in multiple targets that claimed to be
able to generate the directories in question. Instead, just create the
directories as a pre-build step for the targets that actually need
them. (This does keep the cleanup for the existing directory creation
target, though.)

More https://bugs.swift.org/browse/SR-10029
2019-03-03 16:36:28 -08:00
Jordan Rose
7135460528 [CMake] Fix creation of swiftmodule directories on Apple platforms
The way it was set up before worked for Ninja but not for Xcode, due
to me not listing the swiftmodule directories as actual outputs of the
create-directories target. The resulting fix here is actually simpler
and involves fewer processes anyway, so good for us.

https://bugs.swift.org/browse/SR-10029
2019-03-01 11:24:19 -08:00
Saleem Abdulrasool
ac5687b81e build: remove some unused variables 2019-02-27 11:14:10 -08:00
David Zarzycki
f1b8c914cb Merge pull request #22860 from davezarzycki/install_FileCheck_fix
[CMake] Don't install FileCheck by default
2019-02-25 15:40:08 -05:00
Vedant Kumar
bafb963d7b Enable linker dead stripping on Darwin (#22839)
* Enable linker dead stripping on Darwin

See r://48283130. This shaves 6MB+ off of swift and SourceKitService,
26.8MB off of swift-llvm-opt, 29.4MB off sil-passpipeline-dumper, etc.

* Disable dead stripping in Debug builds

It can hide linker errors caused by dependency cycles.
2019-02-25 10:52:48 -08:00
David Zarzycki
6b2561876f [CMake] Don't install FileCheck by default
Not everybody can or does use the "build-script" and the build-script
can easily opt into this if it wants.
2019-02-25 06:41:06 -05:00
swift-ci
3172ff426c Merge pull request #22856 from compnerd/a-perfect-library-exports-nothing 2019-02-23 21:08:43 -08:00
Saleem Abdulrasool
22fde69e6c cmake: make swiftRemoteMirror export interfaces on Windows
Unfortunately, `swift-reflection-test` links against the *TARGET*
library `swiftRemoteMirror`.  The linked library is built as a target
library, which means that we use the custom library target construction
which suffixes the target with a variant spelling.  Because the number
of variants is really high, we pass along the explicit EXPORTS macro
manually.  However, we also build the library as a static library for
the *HOST*.  This means that we need the sources to be aware of whether
they are built statically or dyanmically.  This is accomplished by means
of the `_WINDLL` macro.  The target library is shared and is built using
the custom wrapper for the library construction, which will create all
the variants and then use `_compute_variant_c_flags` which does not get
told what type of library is being built, so it assumes static and does
not append `_WINDLL`.  This results in the shared library not exposing
any interfaces on Windows.  When this happens, link will helpfully elide
the import library.  The result of that is that the
swift-reflection-test binary will fail to link due to no import library
for the RemoteMirror.  Explicitly add the -D_WINDLL if appropriate
manually after we have computed the C flags.  *siiiiiiigh*
2019-02-23 20:03:47 -08:00
Saleem Abdulrasool
350cf67788 utils: attempt to replace custom variables
CMake defaults to using a special <package>_DIR for finding packages.
Prefer this to import the CMake package for LLVM/Clang/Swift rather than
custom paths.
2019-02-22 18:47:26 -08:00
Slava Pestov
1d8928425a Revert "utils: attempt to replace custom variables" 2019-02-22 19:21:13 -05:00
Saleem Abdulrasool
972a86b3c9 Merge pull request #22815 from compnerd/a-dll-is-a-dll
CMake: use `_WINDLL` rather than `_USRDLL`
2019-02-22 14:22:05 -08:00