eliemichel / LearnWebGPU-Code

The accompanying code of the Learn WebGPU C++ programming guide
https://eliemichel.github.io/LearnWebGPU
MIT License
114 stars 30 forks source link

Project cannot compile on branch step052 #1

Closed lucasebana closed 1 year ago

lucasebana commented 1 year ago

Hello! I'm running Ubuntu 22.04, I tried to build the project on branch step052, using the command in the readme, but I get the following error :

cmake . -B build -- Using X11 for window creation -- Configuring done CMake Error in webgpu/CMakeLists.txt: IMPORTED_LOCATION not set for imported target "webgpu". CMake Error in webgpu/CMakeLists.txt: IMPORTED_LOCATION not set for imported target "webgpu". -- Generating done CMake Generate step failed. Build files cannot be regenerated correctly.

eliemichel commented 1 year ago

Hi Lucas,

Did you close this issue because it ended up working? Otherwise I just updated the branch could you check again?

FTR this repository holds the hopefully most up to date content of the webgpu/ dist: https://github.com/eliemichel/WebGPU-binaries

lucasebana commented 1 year ago

Hello, Oh I'm sorry I closed the issue mistakenly. The first error is gone but now there's an issue with the second command :

$ cmake --build build
...
[ 95%] Building CXX object CMakeFiles/App.dir/main.cpp.o
/home/lucas/misc/prog/webgpu/LearnWebGPU-Code/main.cpp: In function ‘int main(int, char**)’:
/home/lucas/misc/prog/webgpu/LearnWebGPU-Code/main.cpp:235:40: error: lvalue required as unary ‘&’ operand
  235 |         layoutDesc.bindGroupLayouts = &(WGPUBindGroupLayout)bindGroupLayout;
      |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
eliemichel commented 1 year ago

Can you try either

layoutDesc.bindGroupLayouts = &((WGPUBindGroupLayout)bindGroupLayout);

or

layoutDesc.bindGroupLayouts = (WGPUBindGroupLayout*)&bindGroupLayout;

I have mostly tested on Windows so far, sorry that you are the one going through these compiler difference details, shouldn't be a showstoper though! I'll eventually set up some continuous integration like I did here.

lucasebana commented 1 year ago

Okay, it's all working now ! Using this line :

layoutDesc.bindGroupLayouts = (WGPUBindGroupLayout*)&bindGroupLayout;

Thanks for the help!