Skip to content
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

[CMake] Reduce path lengths in single-module build #392

Merged

Conversation

jmschonfeld
Copy link
Contributor

@jmschonfeld jmschonfeld commented Jun 18, 2024

Previously, the single module build would add each modules sources to a different list, and then we would combine the list prepending each element with a path like ../BitArray or ../RopeModule. This resulted in extremely long build paths when built as a CMake FetchContent dependency which exceeded the maximum path length on Windows. To resolve this issue, we now create the single module target at the Sources level, and then call target_sources in each subdirectory with a normal relative path such as BitArray+Description.swift. This results in significantly smaller build directory structures keeping the path length within the Windows maximum and also cleans up the CMake a bit.

Checklist

  • I've read the Contribution Guidelines
  • My contributions are licensed under the Swift license.
  • I've followed the coding style of the rest of the project.
  • I've added tests covering all new code paths my change adds to the project (if appropriate).
  • I've added benchmarks covering new functionality (if appropriate).
  • I've verified that my change does not break any existing tests or introduce unexplained benchmark regressions.
  • I've updated the documentation if necessary.

@jmschonfeld jmschonfeld force-pushed the cmake-eliminate-relative-paths branch from 966c0fa to 61e4bdf Compare June 19, 2024 01:40
@jmschonfeld jmschonfeld changed the title [CMake] Eliminate relative paths from single-module build [CMake] Reduce path lengths in single-module build Jun 24, 2024
@jmschonfeld jmschonfeld changed the base branch from main to release/1.1 June 24, 2024 19:07
@jmschonfeld jmschonfeld marked this pull request as ready for review June 24, 2024 19:07
@jmschonfeld jmschonfeld requested a review from lorentey as a code owner June 24, 2024 19:07
Copy link
Member

@lorentey lorentey left a comment

Choose a reason for hiding this comment

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

Huh! 👍

@jmschonfeld jmschonfeld merged commit 3e120b4 into apple:release/1.1 Jun 26, 2024
@jmschonfeld jmschonfeld deleted the cmake-eliminate-relative-paths branch June 26, 2024 16:51
@lorentey lorentey added this to the 1.1.2 milestone Jul 8, 2024
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.

2 participants