Commit Graph

1633 Commits

Author SHA1 Message Date
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
Saleem Abdulrasool
46cbfef03a Merge pull request #22258 from compnerd/integrating-variables
utils: attempt to replace custom variables
2019-02-22 13:22:51 -08:00
Saleem Abdulrasool
8062230cff CMake: use _WINDLL rather than _USRDLL
`_USRDLL` is used to indicate that you are building a MFC DLL while
`_WINDLL` is specified for **ALL** DLL builds.  Use the correct macro.
2019-02-22 10:49:25 -08:00
Jordan Rose
43feb9cbe1 On Apple platforms, use swiftmodule directories for the stdlib (#21797)
This changes the Swift resource directory from looking like

    lib/
      swift/
        macosx/
          libswiftCore.dylib
          libswiftDarwin.dylib
          x86_64/
            Swift.swiftmodule
            Swift.swiftdoc
            Darwin.swiftmodule
            Darwin.swiftdoc

to

    lib/
      swift/
        macosx/
          libswiftCore.dylib
          libswiftDarwin.dylib
          Swift.swiftmodule/
            x86_64.swiftmodule
            x86_64.swiftdoc
          Darwin.swiftmodule/
            x86_64.swiftmodule
            x86_64.swiftdoc

matching the layout we use for multi-architecture swiftmodules
everywhere else (particularly frameworks).

There's no change in this commit to how Linux swiftmodules are
packaged. There's been past interest in going the /opposite/ direction
for Linux, since there's not standard support for fat
(multi-architecture) .so libraries. Moving the .so search path /down/
to an architecture-specific directory on Linux would allow the same
resource directory to be used for both host-compiling and
cross-compiling.

rdar://problem/43545560
2019-02-19 14:47:21 -08:00
Saleem Abdulrasool
817597c7f9 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-14 20:19:08 -08:00
Saleem Abdulrasool
adbb7d7cbd build: simplify condition and IWYU CMake edition
Include a missing CMake module in a couple of locations that we were
using the function.  Simplify a condition to use `MATCHES` rather than
two `STREQUAL`.
2019-02-14 17:35:18 -08:00
Jordan Rose
bc35b34c64 [CMake] StandaloneOverlay: set components before including apinotes/ (#22592)
Otherwise, we'll think we don't need to install the API notes.

No test because this configuration isn't (yet) tested publicly
anywhere, but it is being tested within Apple.
2019-02-13 17:56:31 -08:00
Jordan Rose
4970946265 [CMake] Limit copy-legacy-layouts dependency to the stdlib (#22593)
When we do standalone overlay builds, they should rely on these
layouts already being in the toolchain. (In particular, the target
is never created.)

No tests because this configuration isn't (currently) being tested
outside of Apple.
2019-02-13 16:21:34 -08:00
Ross Bayer
083350af77 Revert "[CMake] Remove LINK_LIBRARIES option from _add_swift_executable_single" 2019-02-12 14:42:22 -08:00
Slava Pestov
c8effd26b3 Merge pull request #22408 from slavapestov/always-use-legacy-layouts
Always use legacy layouts
2019-02-11 19:10:02 -05:00
Ross Bayer
fc58ad4207 Merge pull request #22128 from xiaobai/remove_link_libs_option
[CMake] Remove LINK_LIBRARIES option from _add_swift_executable_single
2019-02-11 12:22:26 -08:00
Saleem Abdulrasool
f441f089cc build: fix mismatch of MSVCRT in release mode
When building RelWithDebInfo, we would accidentally link against the debug
MSVCRT library rather than the release mode one resulting in memory corruptions.
2019-02-08 15:08:56 -08:00