gfx-rs/wgpu-native

Prebuilt releases header files location

Sahnvour opened this issue · 5 comments

For consuming the prebuilt releases from a build system (meson in my case), it would help if the headers were placed in a [include]/webgpu subfolder.

When building with other libraries than can use WebGPU (such as imgui) it seems expected to have WebGPU available in the form of #include <webgpu/webgpu.h> (note the leading directory).
However it is currently needed to manually move the headers in a webgpu subfolder after extracting the archive to achieve that and specify correct include paths in the build system.

I think that makes sense. That makes it generally easier to extract the contents into a larger project. Probably a good idea to also rename the commit-sha file to wgpu-commit-sha to make it unique.

What exact folder structure are you suggesting, ./wgpu/xx.h or ./include/wgpu/xx.h?

@Sahnvour, I'd be happy to write the change to apply your suggestion, but I am not sure what the best folder structure would be.

In my case, I think the ideal structure would be

.
└── wgpu-release.zip/
    └── wgpu/
        ├── include/
        │   └── webgpu/
        │       ├── webgpu.h
        │       └── wgpu.h
        ├── lib/
        │   ├── wgpu.so
        │   └── wgpu.lib
        └── wgpu-commit-sha

Having a root folder helps (I use meson, which has a feature to workaround if it's missing), and a separate include/lib folders make sure we can't include or link something by error while offering the expected standard include paths.

@Korijn what's your thought about this?

I'm fine with this! Looks reasonable to me. I wonder if there are more examples like imgui.