capy-ui / capy

💻Build one codebase and get native UI on Windows, Linux and Web
https://capy-ui.org
Mozilla Public License 2.0
1.6k stars 60 forks source link

AudioGenerator code prevents compiling if target isn't wasm. #70

Closed AdjectiveAllison closed 8 months ago

AdjectiveAllison commented 8 months ago
src/audio.zig:17:18: error: root struct of file 'backend' has no member named 'AudioGenerator'
    peer: backend.AudioGenerator,
          ~~~~~~~^~~~~~~~~~~~~~~
src/backend.zig:1:1: note: struct declared here

The title is my current theory as to why it won't compile. Related to this commit: https://github.com/capy-ui/capy/commit/b927197c9c08111034d9a0226534dbf4b0e7c042

Maybe defining a stub for non-wasm backends would be a good move? Or some conditional to not even import audio on non initialized backends?

AdjectiveAllison commented 8 months ago

Maybe this is related to stage2 regressions https://github.com/ziglang/zig/issues/12325?

@zenith391 mentions it here: https://github.com/capy-ui/capy/issues/58

I'm getting something similar here when doing zig build serve with the capy-template build file:

src/components/TextArea.zig:13:19: error: root struct of file 'backend' has no member named 'TextArea'
    peer: ?backend.TextArea = null,
zenith391 commented 8 months ago

Fixed by 9a4e7574fc2e033e1ee38f510f39fe8b38131a52