Skip to content

[CMake] Copy legacy layouts for module architectures #34921

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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stdlib/toolchain/legacy_layouts/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
add_custom_target("copy-legacy-layouts" ALL)

foreach(sdk ${SWIFT_SDKS})
foreach(arch ${SWIFT_SDK_${sdk}_ARCHITECTURES})
foreach(arch ${SWIFT_SDK_${sdk}_ARCHITECTURES} ${SWIFT_SDK_${sdk}_MODULE_ARCHITECTURES})
Copy link
Contributor

Choose a reason for hiding this comment

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

If these are overlapping this might run an architecture multiple times, correct?
Is this fine because this is only copying files & adding targets that copy?

Copy link
Contributor Author

@edymtt edymtt Dec 2, 2020

Choose a reason for hiding this comment

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

There should be no overlapping architecture, since we check for duplicates in ${SWIFT_SDK_${sdk}_MODULE_ARCHITECTURES} when including SwiftConfigureSDK.cmake in the main CMakeLists.txt

https://github.com/apple/swift/blob/main/cmake/modules/SwiftConfigureSDK.cmake#L212

(list_subtract is defined at https://github.com/apple/swift/blob/main/cmake/modules/SwiftList.cmake#L3)

If that were not the case, we would need to filter duplicates, otherwise CMake would throw an error when adding a target with the same name as an existing one (at least in my experience).

set(platform "${SWIFT_SDK_${sdk}_LIB_SUBDIR}")

set(input "${SWIFT_SOURCE_DIR}/stdlib/toolchain/legacy_layouts/${platform}/layouts-${arch}.yaml")
Expand Down