-
Notifications
You must be signed in to change notification settings - Fork 64
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
Shaderc-rs & Shaderc-sys split #46
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
1 similar comment
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
I signed it! |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
Version 0.4.0 has been skipped and tag will not be used. History for a prospective split at 0.4.0 into two repos has been obliterated. Internal renaming in shaderc-rs/src/lib.rs ffi -> scs The crates were split as follows: Sys crate files - Build dependencies - build.rs - ffi.rs Rs crate files - lib.rs Top level - contrib agreement - .gitmodules - .gitignore - workspace Cargo.toml - CI scripts - license - readme
1a0e7c2
to
71bfb64
Compare
- `check-passthrough` must be enabled on the sys dependency to even allow setting the old `--no-defaults` behavior - `dont-use-deprecated` feature of the sys package allows suppression of old `--no-defaults` to be set as a default in the rs package - `dont-use-deprecated` must be **disabled** by passing `--no-defaults` to rs package to enable the old `--no-defaults` behavior in sys The old use of --no-default-features applies to shaderc-rs, but now it needs to be passed through to shaderc-sys. This is done by passing an inverted flag to suppress the behavior by default from shaderc-rs. When the suppression is removed with --no-default-features, the old behavior is re-enabled and shaderc-sys looks for a libshaderc_combined.a in the out directory When building shaderc-sys directly, only check for the passthrough flag if it could be enabled. It's a package opt-in deprecated behavior. It definitely needs deprecation.
@antiagainst I'm not sure what's up on the Appveyor results. I have little visibility outside of Arch Linux so far. This PR should read fine as a series of independent commits. Re-implemented the I primarily used this heavily referenced guide to writing sys crates to select what traditions to try to follow. The one area I'm not yet 100% clear on is overriding the static library location using a downstream project's To quickly run through a thorough test of the Linux build paths on Arch linux:
Happy to punch some commits into working on Appveyor but I'll need some information. |
Handling the merge issue. Tests for shaderc-rs fail due to linking. I'm incorporating 367a4dd as well, which won't apply at all. Might punch some more history later to convert the delete to a move if possible. |
If you are here because your windows or macos builds are breaking, I apologize. The changes were not developed on these platforms. You will have to research older versions of the crate to establish whether they were in a "just works" state and if not, research your relevant platform options and make it work. This commit implements several new build behaviors: - Building libshaderc from source is now fallback behavior on Linux - Linux will check "/usr/lib/" for libraries by default - SPIRV and glslang libraries _may_ be picked up correctly if they exist in the same location as libshaderc, but funky combinations could break - Specification of a static library via SHADERC_STATIC, SHADERC_LIB_DIR, or SHADERC_LIB_PATH instead of the hacky --no-default-options - tests will build correctly when using hacky --no-default-options paths (stdc was not being included)
962d2f2
to
7f8b5ac
Compare
Full test sequence fine on my machine, on Linux. There was a regression in build.rs. glslang being included statically broke compiling the tests. I have no idea how I found that when I wrote down the critical hunk in #44 |
…fault-to-system-on-linux No actual conflicts.
Original PR: google#47 To merge master
@antiagainst looks like all three platforms have some level of support based on tests? Time to party yet? 📦 🎉
Feel free to keep pinging me on build issues moving forward. I'm nominating this for merge and not blocked on anything. |
I'm still thinking about necessary ways to pass through the new options to shaderc-sys. The command line settings "just work." I'm going to add in a patch to pass through the build-from-source feature to shaderc-rs since it's just easier than figuring out a nested dependency configuration for most people. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome progress! :) I've a few comments inlined. Thanks for the work again!
I didn't have a lot of time to review changes in f03ba63 Many of the comments were addressed. I'll punch the revision history after changes are more final. Worth considering how the new structure might affect the docs. I have little experience yet working with Rust docs. |
build-from-source = [] | ||
check-inverted-no-defaults = [] | ||
inverted-no-defaults = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you think about shaderc-rs-use-sys-libs
and use-sys-libs
here then? Given the tight relationship between shaderc-rs and shaderc-sys, it is reasonable to have an option dedicated to shaderc-rs here. (I'm just trying to make the feature more self-documenting. :) )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This crazy inversion thing is only necessary because of how --no-default-features
operates on a crate's config. I would support a rename to shaderc
specific if you keep the backwards compatibility. If you axe the backwards compatibility, these features go away. shaderc-rs-inverted-no-defaults
etc would be more appropriate. The features have no control over reading specific directories, only the old behavior of reading the ../out/
directory.
If you decide to axe no defaults, it's as simple as removing these two features in both crates and axing the block in build.rs that reads them, then removing the documents.
The reason I implemented the --no-default-features
backwards compatibility is because you believed people were using it (possibly in CI?). It's wise to maintain at least one release of deprecation in any case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SG. This will be removed soon, so I won't bother that much anymore. :)
shaderc-sys/Cargo.toml
Outdated
name = "shaderc_sys" | ||
|
||
[features] | ||
check-passthrough = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think another way is just to eliminate the --no-defaults-behavior
support for shaderc-rs entirely. It was not a satisfying solution; and now we have SHADERC_LIB_DIR
now and it is better. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nice, thanks again for doing this! :)
Feel free to do whatever clean up you'd like to and then let me know. I will apply a few cosmetic fixes and then merge this.
…imited and should not be interpreted as a larger coherent change.
…ative to the dependency, not the location of where cargo was invoked. Warn the user if a relative path is relative, not a directory, or fails to resolve (usually file not found becuase of a bad relative path)
f03ba63
to
1f49296
Compare
I added some cleanups after doing some testing and sitting back to leisurely read the code. One feature I actually changed was to try to canonicalize relative paths so that they would work... only to realize that the CWD changes during each recursion cargo makes to a dependency. Specifying a relative path must be done relative to --rerun-after-changed and it's env variable counterpart deserve a look. I think we have to combine both for our case, one to detect lib file changes and the other to detect env changes. They have some funky behavior though. I didn't try them. AFAIK the only outstanding question is to completely axe Tests cargo test
cargo clean
cargo test --features build-from-source
cp ../target/debug/../libshaderc_combined.a ../
cargo clean
cargo test SHADERC_LIB_DIR=../
cargo clean
cargo test --no-default-features
# cp the library into the specified location
# re-run test --no-default-features
cargo clean
mkdir ../libs
cp /usr/lib/libshaderc_combined.a ../libs/
cp /usr/lib/libglslang.a ../libs/
cp /usr/lib/libSPIRV.a ../libs/
cp /usr/lib/libSPIRV-Tools.a ../libs/
cargo test SHADERC_LIB_DIR=../libs/ |
…nion here since this is a combined crate's README that contains quite a bit of relevant build information for the crate in spite of a lot of shaderc-rs specific information. Two readmes might be a bad idea for maintenance.
Looks good! I just did some final touch over documentation. Will merge soon. Good point about |
👍 Changes look good. Thanks for the extensive review, feedback, and refinements vulkano-rs/vulkano#1183 crosslinking |
Merged, thanks! @knappador, it seems I cannot publish shaderc-sys because I don't have the right access. Would you mind add me? Or If you want to do it, please feel free (use the top of the tree). :) |
I believe I invited you already, I will resend when I get to my credentials
…On Sun, Apr 21, 2019, 10:16 PM Lei Zhang ***@***.***> wrote:
Merged, thanks! @knappador <https://github.com/knappador>, it seems I
cannot publish shaderc-sys because I don't have the right access. Would you
mind add me? Or If you want to do it, please feel free (use the top of the
tree). :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#46 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAE4Q4YGOROWGG2IAKKNQWLPRUU2PANCNFSM4HCOEWHQ>
.
|
https://crates.io/me/pending-invites shows I've no pending owner invites. |
Invite sent. If there's no crate, the UI presents no option to manage owners 🙊
Also it means I burned another semver to give you an invite 🙊 0.4.2 I guess 🐱 |
Nice, I've access now and published 0.5.0! \o/ Thanks! Could you yank 0.4.1 now? :) |
Yanked. Going to merge this downstream for CI justice. |
--snip-- #44 has almost all of the discussion leading up to the merge commit notes
fixes #44