Dawn as a standalone library + compiling issues

77 views
Skip to first unread message

Erin Melucci

unread,
Oct 7, 2022, 5:27:14 AM10/7/22
to Dawn Graphics
Hello,

we using Dawn as a library for rendering and have been using it as a cmake subprojects. We wanted to package it as a standalone library to decouple it from our source code.
Are you aware of any caveats when using dawn as a shared library on Windows?

Also, we would like to compile it with VS2022, but when invoking ninja after generating the build files with gn, compiling fails inside of abseil because it can't find STL headers. Is this a known issue?

Cheers,
Erin

Corentin Wallez

unread,
Oct 10, 2022, 8:36:45 AM10/10/22
to Erin Melucci, Dawn Graphics
Hey Erin,

Using Dawn as a shared library should mostly work on Windows, as long as you only use the "webgpu.h" C interface. Usage of DawnNative.h/FooBackend.h could be more difficult because of the need to pass C++ allocations around (which requires using the same CRT etc). Likewise it means that you should compile the C++ header as part of your application and not as part of the Dawn shared library. I don't know if someone has successfully done that before but it "should" work.

I'm not sure what the issue could be with VS 2022 and the STL headers. In general GN is very tailored to Chromium and using it for consumption in other projects can be difficult (it comes with its own toolchain definition files and any support past what Chromium needs is best effort). Why aren't you using CMake to do the compilation of the shared library?

Any fixes to these paths welcome of course, and also you should know that we have been discussing with multiple people the idea of setting up a Github repo with actions that try to automatically make builds of Dawn for use in various places, so you don't have to figure out all the setup and can consume DLLs directly. (but that's not started at all).

Cheers,

Corentin

--
You received this message because you are subscribed to the Google Groups "Dawn Graphics" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dawn-graphic...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dawn-graphics/2c3eea00-1fe1-41b4-bf3a-aec82a324321n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages