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: SwiftCore Install Story #79548

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

etcwilde
Copy link
Contributor

Adding an installation story, complete with a generated SwiftCoreConfig.cmake file that allows pulling the just-built standard library into the downstream projects using find_package(SwiftCore). This will make it easier to ensure that the overlays and supplemental libraries are built against the expected runtimes.

This also separates out the development and runtime components to allow
installing just the runtimes without the headers.

Component List:

  • SwiftCore_runtime

The runtime libraries that are required for running code.

  • SwiftCore_development:

These are the files needed to interface with the standard library while doing development.
These include the shims headers as well as the swift modules and swift interfaces.

  • SwiftCore_cmake

Files for interfacing CMake projects with the built runtimes.
This includes the target list and flags needed to use the targets
built by the specific configuration used to build the runtime
libraries.

These files are used for mapping flags, definitions, and locations
into the overlay libraries and supplemental libraries.

Note

We will need to clean up how we find shims. As it stands today, if the Swift shims are copied into the build directory next to the compiler as the current builds are, those will be picked up in addition to the shims from the standard library resulting in build failures due to duplicate SwiftShims modules. Still looking for a way around that.

@etcwilde
Copy link
Contributor Author

@swift-ci please smoke test

FILE "SwiftCoreTargets.cmake"
COMPONENT SwiftCore_cmake)
include(CMakePackageConfigHelpers)
configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/installer/SwiftCoreConfig.cmake.in"
Copy link
Member

Choose a reason for hiding this comment

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

Can we use a different name than "installer"? We currently have the macOS and Windows installers, and this can be confusing as to how they are related.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to cmake/interface/SwiftCoreConfig.cmake.in.

@etcwilde etcwilde force-pushed the ewilde/stdlib-rebuild-install-story branch from 5124e7c to 37512a1 Compare February 22, 2025 00:19
@etcwilde
Copy link
Contributor Author

@swift-ci please smoke test

@compnerd
Copy link
Member

@swift-ci please smoke test

Starting to work on a full installation story for the Swift runtimes.
This involves generating the SwiftCoreConfig cmake files to allow
importing the just-built runtimes into the overlays and supplemental
libraries, setting up the flags appropriately for the given SwiftCore
build configuration.

This also separates out the development and runtime components to allow
installing just the runtimes without the headers.

Component List:
 - SwiftCore_runtime

  The runtime libraries that are required for running code.

 - SwiftCore_development

  The interface with the runtime libraries that are required for
  building code against the runtimes.

 - SwiftCore_cmake

  Files for interfacing CMake projects with the built runtimes.
  This includes the target list and flags needed to use the targets
  built by the specific configuration used to build the runtime
  libraries.

  These files are used for mapping flags, definitions, and locations
  into the overlay libraries and supplemental libraries.

This adds install commands for the object libraries contributing to
libswiftCore so that they are represented in SwiftCoreTargets.cmake.
Object libraries do not contribute anything to the files actually
installed.
@etcwilde etcwilde force-pushed the ewilde/stdlib-rebuild-install-story branch from 37512a1 to 7870db6 Compare February 22, 2025 18:33
@etcwilde
Copy link
Contributor Author

Windows bot caught something. Neat. install(FILES ...) doesn't have an EXPORT option.

@etcwilde
Copy link
Contributor Author

@swift-ci please smoke test

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