cwoffenden / hello-webgpu

Cross-platform C++ example for WebGPU and Dawn
272 stars 36 forks source link

[Question] Can you share the process of building dawn? #16

Closed trsh closed 1 year ago

trsh commented 1 year ago

I fallowed the instructions in https://dawn.googlesource.com/dawn/+/HEAD/docs/building.md and it went fine, I think, but I am not getting the libs and includes that you have here in project.

trsh commented 1 year ago

Ahh its already there

cwoffenden commented 1 year ago

Hi! I documented the steps for how I built the libs here:

https://github.com/cwoffenden/hello-webgpu/blob/main/lib/README.md

This is for Windows (Mac and Linux were much simpler).

I then took the headers from Dawn's include folder plus generated headers from the build folder then gen/include.

cwoffenden commented 1 year ago

The latest Dawn has changes which need the main.cpp from this branch currently:

https://github.com/cwoffenden/hello-webgpu/tree/dawn-9ab81268f

I haven't got round to merging this yet.

trsh commented 1 year ago

@cwoffenden thanks!

trsh commented 1 year ago

Also some issues with emcc

emcc: error: setting `DISABLE_EXCEPTION_CATCHING` is not meaningful unless linking as C++ [-Wlinkflags] [-Werror]

and then

C:\Tools\emsdk\upstream\emscripten\tools\unsafe_optimizations.js:25
        if (elem.type) {
                 ^

TypeError: Cannot read property 'type' of null
    at visitNodes (C:\Tools\emsdk\upstream\emscripten\tools\unsafe_optimizations.js:25:18)
    at visitNodes (C:\Tools\emsdk\upstream\emscripten\tools\unsafe_optimizations.js:31:33)
    at visitNodes (C:\Tools\emsdk\upstream\emscripten\tools\unsafe_optimizations.js:26:37)
    at visitNodes (C:\Tools\emsdk\upstream\emscripten\tools\unsafe_optimizations.js:26:37)
    at optPassRemoveRedundantOperatorNews (C:\Tools\emsdk\upstream\emscripten\tools\unsafe_optimizations.js:84:3)
    at runOnJsText (C:\Tools\emsdk\upstream\emscripten\tools\unsafe_optimizations.js:213:3)
    at runOnFile (C:\Tools\emsdk\upstream\emscripten\tools\unsafe_optimizations.js:232:8)
    at Object.<anonymous> (C:\Tools\emsdk\upstream\emscripten\tools\unsafe_optimizations.js:319:3)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
emcc: error: 'C:/Tools/emsdk/node/14.18.2_64bit/bin/node.exe C:\Tools\emsdk\upstream\emscripten\tools\unsafe_optimizations.js C:\Users\janis\AppData\Local\Temp\tmpu1ugl7lb.cc.js.module_export_name_substitution.js -o C:\Users\janis\AppData\Local\Temp\tmpu1ugl7lb.cc.js.module_export_name_substitution.js' failed (returned 1)
trsh commented 1 year ago
emcc --version
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.24 (68a9f990429e0bcfb63b1cde68bad792554350a5)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
trsh commented 1 year ago

I just removed DISABLE_EXCEPTION_CATCHING and and set MINIMAL_RUNTIME=1. And its working. But not sure its right thing todo :)