Skip to content

Generate CMake distribution in CD - #251

Closed
eliemichel wants to merge 11 commits into
gfx-rs:trunkfrom
eliemichel:feature-cmake-distribution
Closed

Generate CMake distribution in CD#251
eliemichel wants to merge 11 commits into
gfx-rs:trunkfrom
eliemichel:feature-cmake-distribution

Conversation

@eliemichel

Copy link
Copy Markdown
Contributor

Hello,

I am trying to make the integration of the precompiled binaries in a CMake-based project as easy and portable as possible for my WebGPU C++ guide and I came up with a solution that satisfies me:

  • Easy to integrate, with a webgpu CMake target to link like any library and that manages the pre-compiled binaries
  • Define a WEBGPU_BACKEND_WGPU to distinguish this distribution for the Dawn-based alternative that I also provide
  • Follow modern idioms of CMake
  • Works with emscripten

Currently I point my readers to my WebGPU-distribution repository but I think this is something that would be worth making available directly in the release of wgpu-native.

This PR adds to the CD process the generation of a distribution of WebGPU that can be simply copied in a CMake project and integrated with add_subdirectory(webgpu). More info to be found in distribution/REAMD.md.

This is something that I am going to also discuss with Dawn so that ideally we end up with a common way of packaging binaries for CMake. I'll be happy to discuss the details and adapt to as many use cases as possible!

@almarklein almarklein left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks! This sounds like it would be useful, but (being mostly a Python dev) I cannot judge whether this approach is good practice or something like that.

Comment thread .github/workflows/cd.yml Outdated
Comment thread distribution/README.md Outdated
Co-authored-by: Almar Klein <almar@almarklein.org>

@almarklein almarklein left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

missed a spot :)

Comment thread .github/workflows/cd.yml Outdated
Comment thread .github/workflows/cd.yml Outdated
eliemichel and others added 2 commits April 13, 2023 22:33
Co-authored-by: Almar Klein <almar@almarklein.org>
Co-authored-by: Almar Klein <almar@almarklein.org>
@eliemichel

Copy link
Copy Markdown
Contributor Author

Oh thanks my bad!

@almarklein

Copy link
Copy Markdown
Collaborator

This is open for a while even though this is about finished. I think this needs a round of review from someone with more experience (than me) in build systems. cc @rajveermalviya

@waywardmonkeys

Copy link
Copy Markdown
Contributor

Is there something I can do to help push this along?

@waywardmonkeys

Copy link
Copy Markdown
Contributor

@rajveermalviya Any chance I can help get this wrapped up for the next release?

@rajveermalviya

rajveermalviya commented Jan 21, 2024

Copy link
Copy Markdown
Collaborator

(Apologies for missing this)

Tbh instead of this, I would prefer a setup where user can clone the repo (or github's download zip) to a directory and then import that directory via add_subdirectory.

Then the CMakeLists.txt at the root in this repo could the have an option like DOWNLOAD_PREBUILT_BINARIES, where default would be false. So, the binaries would be built from source by default & if that option is enabled then the binaries would be downloaded from Github Releases. Such a setup would also allow us to mirror cargo optional features that are currently disabled in the release packages.

But not really sure how emscripten would fit in that.

@eliemichel

Copy link
Copy Markdown
Contributor Author

I agree actually, not my topmost priority at the moment but I'll work on this eventually!

@waywardmonkeys

Copy link
Copy Markdown
Contributor

wasmtime does something similar as well. I have it on my list to try to get to this sooner rather than later.

@waywardmonkeys

Copy link
Copy Markdown
Contributor

I have a working prototype of this locally now. I'll need #359 to land and then I can start on a series of PRs that get us to (what I hope is) a good place.

@cwfitzgerald

Copy link
Copy Markdown
Member

We definitely still want this, but we dropped the ball on reviews. I'm going to close this, we definitely want integration with cmake somehow.

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.

5 participants