Skip to content

[CMake] Update defines to indicate combined, dynamic module build #28

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

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

jmschonfeld
Copy link
Contributor

While this didn't cause issues on Linux/Darwin, the Windows builds fails due to incorrect defines specified. Since we are building all pieces as one module, we need to set U_COMBINED_IMPLEMENTATION along with the other U_X_IMPLEMENTATION defines for all source files. Doing this also revealed that setting U_ATTRIBUTE_DEPRECATED to an empty string causes build failures so I've removed that define.

@jmschonfeld jmschonfeld requested a review from iCharlesHu June 26, 2024 17:39
@parkera parkera requested a review from compnerd June 26, 2024 17:52
$<$<COMPILE_LANGUAGE:C,CXX>:U_SHOW_CPLUSPLUS_API=1>
$<$<COMPILE_LANGUAGE:C,CXX>:U_SHOW_INTERNAL_API=1>
$<$<COMPILE_LANGUAGE:C,CXX>:U_STATIC_IMPLEMENTATION>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has broader implications on Windows. If this module is now being built dynamically, it needs to be explicitly packaged (see https://github.com/apple/swift-installer-scripts).

Is there a reason to build this dynamically now rather than statically? The only consumer of this library is Foundation right?

Copy link
Contributor Author

@jmschonfeld jmschonfeld Jun 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both CoreFoundation (which is a static library that is statically linked into the Foundation dynamic library) and FoundationInternationalization (a dynamic library) link this _FoundationICU module, so rather than statically linking ICU into both we took the approach of having them both link the same dynamic library. Would FoundationEssentials and FoundationInternationalization (which are new dynamic libraries that we are installing) also be in the same boat here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a look at that repo, looks like we'll need to update the installer scripts to account for the new _FoundationICU.dll, FoundationEssentials.dll, and FoundationInternationalization.dll libraries along with the new FoundationEssentials.swiftmodule and FoundationInternationalization.swiftmodule. That should be doable, I can post a PR to update it once we get far enough along in our toolchain builds to test it. Since we have to update it for FoundationEssentials and FoundationInternationalization anyways I don't think adding _FoundationICU to that list adds any additional burden - are there any other implications that we need to make sure we address here? (looks like we need to add the repos to the lists in the linux files too)

@jmschonfeld
Copy link
Contributor Author

Confirmed that SwiftPM builds of swift-foundation with this change build/pass tests on both Darwin and Windows. Linux and Windows toolchain builds are ongoing for validating the CMake build

@jmschonfeld
Copy link
Contributor Author

Linux toolchain build has passed and Windows toolchain build did not encounter any errors not seen previously

@jmschonfeld
Copy link
Contributor Author

I'm going to merge this change as is to keep the ball rolling here, will followup with the installer script concerns separately

@jmschonfeld jmschonfeld merged commit ab4133a into swiftlang:main Jun 27, 2024
@jmschonfeld jmschonfeld deleted the cmake/fix-windows branch June 27, 2024 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants