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
Suggestion: Distribute the raw bindings as a crate and continue to use them as dependency. #6
Comments
I approve your suggestion. More over it, I'm thinking about make skia-raw a prebuilt library which include |
I would like that but have no idea how to build a crate with prebuilt libraries for multiple platforms. Do we need to split them up, in Some progress on my side: I've built something similar to what I would consider a safe Skia API on top of the bindings and ported the canvas drawing example to it. It's a mess, but as soon I do have some time, I will clean it up and try to formulate how I think we can proceed. |
I think we can build on that: https://github.com/pragmatrix/skia-safe which is inspired by the binding code in skia-sys and contains the canvas example. It can be compiled with my "vulkan" binding branch: |
Should we create an organization
Oh it's easy, we can build static link files in CI, and deploy it to github release with names like: let static_link_file_name = format!("skia-{}.{}", platform, ext);
Command::new("wget")
.args(&[&format!("https://github.com/rust-skia/rust-raw/releases/download/{}/", version, &static_link_file_name)])
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.status()
.expect("download prebuilt static file fail");
Command::new("mv")
.arg(&static_link_file_name)
.arg(&format("skia.{}", ext))
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.status()
.unwrap(); |
Yes, I had that on my mind, too, but I need to get my PoC working regarding vulkan, before I am willing to contribute more time to completing the bindings. This might take a while. There is also that: https://doc.rust-lang.org/cargo/reference/build-scripts.html#overriding-build-scripts, not sure if it fits our purpose, but seems reasonable to think about. |
I think this setting is suitable for our situation. And I have created BTW. I'm in the Chinese new year vacation. I will pay more times on our project after the vacation end. |
done |
@Brooooooklyn please make me an "owner" to the |
I am working on the first set of bindings in https://github.com/rust-skia/skia-safe/pull/4. This is far from being complete, and needs a lot of polishing, but I think that I can be there in about one or two weeks. I am now quite confident that we can pull this off based on the C++ bindgen generated bindings, and therefore I think we should produce something that is compilable out of the box soon. To compile the project, rust-skia and skia-safe need to be picked and the cargo dependency paths had to be adjusted to make this work, this is not usable. For that to proceed, we need to clearly define how the repository and crate layout should look like. After thinking a while, and because the unsafe bindings and safe bindings seem to co-evolute together (for example, most new APIs require the addition of new So my refined suggestion is to create and maintain two repositories only:
|
I did an experiment and separated the canvas implementation and the
hello.rs
into a another dependent project and it went along fine, Rust seems to be awesome in this regard, theskia.lib
and theskiabinding.lib
were all included into the resulting rlib, and the linker flags were propagated.The improvements I seek are:
build.rs
for every change seems to be too heavy.INIT_SKIA
switch). Cargo seems to be intelligent enough to build the project only once for dependent projects as long there are no changes affecting it, though I don't know how reliable that is.Note that I am a Rust beginner, and some of the points above may be speculative and based on naive assumptions.
Naming suggestions for the resulting crates and projects:
skia-raw
, for the raw bindings (we just export everything thatbinding.rs
produces).skia-canvas
, for the simplified canvas drawing implementation.skia-safe
, for the safe bindings which should closely resemble the Skia API.The text was updated successfully, but these errors were encountered: