Skip to content

Expose a :slang library target from the generated SDK repo#151

Merged
mxpv merged 1 commit into
mxpv:mainfrom
0xbeefd1ed:slang-library-target
Jul 2, 2026
Merged

Expose a :slang library target from the generated SDK repo#151
mxpv merged 1 commit into
mxpv:mainfrom
0xbeefd1ed:slang-library-target

Conversation

@0xbeefd1ed

@0xbeefd1ed 0xbeefd1ed commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

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: Glob 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.

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>

@mxpv mxpv left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks!

@mxpv mxpv merged commit 91b9e9a into mxpv:main Jul 2, 2026
15 checks passed
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