Expose a :slang library target from the generated SDK repo#151
Merged
Conversation
The SDK bundles the slang compiler as a shared library, but consumers that link against it (e.g. shader-slang bindings) currently have to reach into sdk/lib with a hardcoded filename. On macOS that filename embeds the slang version (`libslang-compiler.0.2026.1.dylib`), which means every SDK bump breaks downstream BUILD files -- and downstream repos cannot glob files that live inside the SDK repository. Add a `:slang` target to the generated BUILD, mirroring the existing `:vulkan` loader target: - Windows: a cc_import pairing sdk/Lib/slang.lib with sdk/Bin/slang.dll. - Linux/macOS: the bazelbuild/bazel#4748 cc_library workaround, globbing the shared library. The macOS glob intentionally matches the versioned dylib rather than the `libslang-compiler.dylib` symlink: the library's install name (LC_ID_DYLIB) is `@rpath/libslang-compiler.<version>.dylib`, so the file must be staged under its versioned name for dyld to resolve it at runtime. Since the glob runs inside the generated repo, consumers can now just depend on `@vulkan_sdk_<version>//:slang` regardless of which slang version the SDK bundles. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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 SDK bundles the slang compiler as a shared library, but consumers that link against it (e.g. shader-slang bindings) currently have to reach into sdk/lib with a hardcoded filename. On macOS that filename embeds the slang version (
libslang-compiler.0.2026.1.dylib), which means every SDK bump breaks downstream BUILD files -- and downstream repos cannot glob files that live inside the SDK repository.Add a
:slangtarget to the generated BUILD, mirroring the existing:vulkanloader target:libslang-compiler.dylibsymlink: the library's install name (LC_ID_DYLIB) is@rpath/libslang-compiler.<version>.dylib, so the file must be staged under its versioned name for dyld to resolve it at runtime.Since the glob runs inside the generated repo, consumers can now just depend on
@vulkan_sdk_<version>//:slangregardless of which slang version the SDK bundles.