-
Notifications
You must be signed in to change notification settings - Fork 469
build: support static builds for Swift #397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci please test |
CC: @kevints |
@compnerd looking at the build the test programs are failing due to undefined ICU symbols needed by swiftCore. This is due to the once-private link dependencies of swiftCore now being needed (as there's no portable way for unix static archives to contain library dependencies; we need swift autolinking, libtool archives, or clang autolinking with lld). The dispatch buildsystem currently creates an IMPORTED target for the swiftCore library without regard to its dependencies. This happens to work in the shared case but doesn't in the static case, but to make it work robustly is equivalent to duplicating the |
@kevints We support creating exported targets from the parent swift cmake. |
ea10963
to
68fabd4
Compare
d53f5be
to
e0ade5e
Compare
Use the exported target from swift rather than recreate the paths locally. This almost works to replace the use of the paths. Unfortunately, swiftrt is not currently exported.
e0ade5e
to
4e27466
Compare
@swift-ci please test |
Please test with following PRs: @swift-ci please test |
@@ -44,38 +44,32 @@ dispatch_common_warnings() | |||
option(ENABLE_DISPATCH_INIT_CONSTRUCTOR "enable libdispatch_init as a constructor" ON) | |||
set(USE_LIBDISPATCH_INIT_CONSTRUCTOR ${ENABLE_DISPATCH_INIT_CONSTRUCTOR}) | |||
|
|||
# NOTE(abdulras) this is the CMake supported way to control whether we generate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider linking straight to the reference: https://cmake.org/cmake/help/v3.4/variable/BUILD_SHARED_LIBS.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do like that better; I think Im going to do that in a follow up (to get this merged first). This was just moving the option around.
Also note that this fixes the builds for me with tests after @DougGregor's change (layout differences between Darwin and Linux bites us again). My follow up change will actually use the swift compiler to link the Swift SDK overlay and split it out, so that actually makes all this significantly more robust and easier to work with. |
This LGTM from the swift side of things. I think the cmake will work fine as well given that we are essentially going through cmake config and performing an identity transformation (since swift's config provides that same information). @MadCoder hows this look to you? |
@MadCoder - ping |
build: support static builds for Swift Signed-off-by: Kim Topley <ktopley@apple.com>
Adjust the paths for static runtime builds of Swift.