Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Cmake] Add Synchronization #80841

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

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

Conversation

justice-adams-apple
Copy link
Contributor

@justice-adams-apple justice-adams-apple commented Apr 15, 2025

Add the Synchronization supplemental library

Built atop some of the changes from #80513

Comment on lines +21 to +23
set(${PROJECT_NAME}_SWIFTC_SOURCE_DIR
"${PROJECT_SOURCE_DIR}/../../../"
CACHE FILEPATH "Path to the root source directory of the Swift compiler")
Copy link
Member

Choose a reason for hiding this comment

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

Do you reference anything from there? I think that we should just drop this if possible. The supplemental libraries don't tend to reach into the sources of the core libraries AFAIK.

Copy link
Contributor

Choose a reason for hiding this comment

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

*gyb enters chat*

Copy link
Contributor

Choose a reason for hiding this comment

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

Though, for the purposes of the supplemental libraries, the gyb module should probably reach up into the compiler bits so that each of the supplemental projects don't need to explicitly.


add_compile_options(
$<$<COMPILE_LANGUAGE:Swift>:-explicit-module-build>
$<$<COMPILE_LANGUAGE:Swift>:-enable-builtin-module> # Are these contradictory?
Copy link
Member

Choose a reason for hiding this comment

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

Which options does the comment refer to? I don't see any contradictory options.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@compnerd it was for

$&lt;$&lt;COMPILE_LANGUAGE:Swift>:-explicit-module-build>
$&lt;$&lt;COMPILE_LANGUAGE:Swift>:-enable-builtin-module>

It was mainly a note for myself to confirm I needed both of those compiler flags as I wasn't sure if they contradicted each other. Evan answered my question below

@@ -0,0 +1,47 @@
find_package(Python3 REQUIRED COMPONENTS Interpreter)
Copy link
Member

Choose a reason for hiding this comment

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

Is this a copy from the core libraries gyb implementation? It really is unfortunate that we do not have a Runtimes/cmake/modules to share some of these through.

@etcwilde - what do you think of creating that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, it's a copy in the same way we have AvailabilityMacros

Copy link
Contributor

Choose a reason for hiding this comment

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

I've been doing my best to prevent cross-pollination between the layers.
Worried about folks trying to be overly DRY and ending up with another umbrella add_swift_target_library function with 97 arguments.


add_compile_options(
$<$<COMPILE_LANGUAGE:Swift>:-explicit-module-build>
$<$<COMPILE_LANGUAGE:Swift>:-enable-builtin-module> # Are these contradictory?
Copy link
Contributor

Choose a reason for hiding this comment

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

These don't conflict. explicit module builds affect how the driver looks up modules, while builtin-module allows libraries that are not part of the core Swift module to use builtins. It's not for use outside of the distribution of standard libraries, but everything in Supplemental is part of that distribution so it's fine.

@justice-adams-apple justice-adams-apple changed the title [Cmake][WIP]Add Synchronization [Cmake] Add Synchronization Apr 21, 2025
@justice-adams-apple justice-adams-apple marked this pull request as ready for review April 21, 2025 19:41
@justice-adams-apple
Copy link
Contributor Author

Going to merge #81179 and #81180 first then rebase this


install(TARGETS swiftSynchronization
EXPORT SwiftSupplementalTargets
COMPONENT SwiftCore_runtime
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems a remnant from the reference code in SwiftCore -- maybe we can use the project name directly

Suggested change
COMPONENT SwiftCore_runtime
COMPONENT ${PROJECT_NAME}

Copy link
Contributor

Choose a reason for hiding this comment

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

Namespacing the component with the project name is good. Let's keep the _runtime suffix since this is only installing the runtime library. This will make it easier to split up the install story for different use cases.

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.

4 participants