-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Updates to get executables building and running on windows #9130
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
case .staticLibrary, .executable: | ||
pifProductName = "\(sourceModule.name).o" | ||
executableName = pifProductName | ||
#if os(Windows) |
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.
We'll need to vary this based on the platform being built for rather than the host platform so we don't break cross-compilation. There's not a great way to conditionalize productType based on platform in the PIF today, so this is where having a new "swiftPMTarget" product type to abstract away the platform specific differences might be useful
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.
as discussed offline, this is only temporary (I can add a comment here indicating such) but I think if we can get some basic windows functionally working like building and running an executable which this change could get us there, with tests that now pass, we can then make the incremental changes like using a new product type and moving this kind of platform conditional into swift-build for that product type, and then have those tests ensure we don't regress with those change.
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.
How long is temporary - something on the order of a few weeks?
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 hope so, will be working on the new product type next.
settings[.GENERATE_PRELINK_OBJECT_FILE] = "NO" | ||
settings[.STRIP_INSTALLED_PRODUCT] = "NO" | ||
|
||
// Macros build as executables, so they need slightly different |
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.
Why did this block need to be dropped?
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.
so correct me if I'm wrong but setting the MACH_O_TYPE should not be required to be set in the PIF as the product type definition in swift-build sets it for us, and with that said i feel CLANG_COVERAGE_MAPPING_LINKER_ARGS should be handled that same way
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.
that's a good point, I wonder why this was put here originally...
and yeah, lets sink the CLANG_COVERAGE_MAPPING_LINKER_ARGS change into Swift Build
delegate: PackagePIFBuilder.BuildDelegate, | ||
) { | ||
self[.TARGET_NAME] = targetName | ||
self[.PRODUCT_NAME] = createDylibForDynamicProducts ? productName : executableName |
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.
Will removing createDylibForDynamicProducts break the use case of xcodebuild building dylibs? We might be missing some tests there...
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.
ya, I think @owenv was saying offline that there is some history here we just don't know about as to why this was like this. I think we should try and move forward with this as it cleans things up and I imagine we should be able to address any fallout quickly if need be...
3d9e171
to
73a4710
Compare
@swift-ci please test |
73a4710
to
6c94016
Compare
@swift-ci please test |
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.
LGTM, once the CLANG_COVERAGE_MAPPING_LINKER_ARGS override is applied at the Swift Build layer
@swift-ci please test |
6c94016
to
4aa3868
Compare
@swift-ci test |
4aa3868
to
2edf621
Compare
@swift-ci test |
- the also changes the source modules on Windows to be a static lib since pre-linked .o is not supported.
2edf621
to
1e660e0
Compare
@swift-ci test |
@swift-ci test windows |
depends on: swiftlang/swift-build#795