{{ message }}
Rewrite bundle_static to be much more efficient.#8386
Merged
Conversation
steven-johnson
approved these changes
Aug 12, 2024
LebedevRI
pushed a commit
to LebedevRI/Halide
that referenced
this pull request
Aug 13, 2024
The `bundle_static` function now detects the private static dependencies on the given target (in our case, always Halide) and uses the platform librarian tool to merge static dependencies into a static library. It picks which tool to use by checking, in order: * When targeting Windows, it looks for `lib.exe`. * When targeting macOS, it checks if `libtool` is the Apple libtool. * Whether `ar` is GNU ar and if so, generates an MRI script. * Otherwise, a `FATAL_ERROR` is issued. To mark a static library for bundling, we link privately and use the `$<BUILD_LOCAL_INTERFACE:...>` generator expression. This prevents it from being exported, too. The generator expression that implements this logic is quite complex. It involves meta-programming generator expressions during evaluation and then evaluating them. Even so, this saves a considerable amount of time unpacking LLVM into a temporary directory and adding the objects to the link line (the previous approach).
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The
bundle_staticfunction now detects the private static dependencies on the given target (in our case, always Halide) and uses the platform librarian tool to merge static dependencies into a static library. It picks which tool to use by checking, in order:lib.exe.libtoolis the Apple libtool.aris GNU ar and if so, generates an MRI script.FATAL_ERRORis issued.To mark a static library for bundling, we link privately and use the
$<BUILD_LOCAL_INTERFACE:...>generator expression. This prevents it from being exported, too.With this PR, imported static dependencies besides LLVM (wabt, flatbuffers) can be bundled, too. Previously, they were only bundled when vendored via FetchContent.
The generator expression that implements this logic is quite complex. It involves meta-programming generator expressions during evaluation and then evaluating them. Even so, this saves a considerable amount of time unpacking LLVM into a temporary directory and adding the objects to the link line (the previous approach).