floooh / sokol-zig

Zig bindings for the sokol headers (https://github.com/floooh/sokol)
zlib License
355 stars 49 forks source link

Windows now needs gdi32 #12

Closed Srekel closed 3 years ago

Srekel commented 3 years ago

I'm not sure if there's a smarter way to do this, but in order to get head sokol, bindings newly generated, to build, I needed to add this to my project:

    } else if (lib.target.isWindows()) {
        lib.linkSystemLibrary("gdi32");
    }

Because of the icon support in sokol_app it seems.

floooh commented 3 years ago

Hmm strange, normally this should be taken care of via pragma-comment-lib:

https://github.com/floooh/sokol-zig/blob/5f56bd406d1cdc76964bff577e25f0ae1f03e605/src/sokol/c/sokol_app.h#L1491-L1501

(I'm actually not sure if the requirement has changed with the icon stuff).

...I'll test on my Win10 machine...

floooh commented 3 years ago

Ok, I can reproduce when generating new bindings from the current sokol-master (I guess that's what you did?).

I'll move the #pragma comment (lib,"gdi32") out of the SOKOL_GLCORE33 ifdef, then it should work if you recreate the bindings. I'll not update the sokol-zig repository yet though (because even though it's not quite uptodate, it works as is).

I think I'll update the sokol-zig repo once Zig 0.8.0 is officially released, because then I'll also merge the current 0.8.0 branch into master anyway.

floooh commented 3 years ago

Btw the reason why I didn't notice this earlier is because fips automatically links with a whole lot of Windows system libs. Not a good decision in hindsight:

https://github.com/floooh/fips/blob/904b17631a32d27020a0b53d1e782cfcb96cc63e/cmake-toolchains/windows.cmake#L40-L41

floooh commented 3 years ago

Ok, should work now if you recreate the zig bindings using the latest sokol_app.h with this commit:

https://github.com/floooh/sokol/commit/bd2066fcc105cf6afb951b1ad04f40a0a45de2ef

Srekel commented 3 years ago

Cool, thanks :)

A sidenote/suggestion,

I think I'll update the sokol-zig repo once Zig 0.8.0 is officially released, because then I'll also merge the current 0.8.0 branch into master anyway.

Zig is still in that state where 99% of people working (aka playing :D ) with it is on master. At least that's what they recommend. So a suggestion would be to keep sokol-zig master's up to date with master.

Perhaps better to have a tag (or branch) for each stable build matching a stable zig build?

floooh commented 3 years ago

Hmm, I'm not sure. As far as I have seen, the recommended ways to install zig via package manager (ignoring the recently discovered problems when installing via brew on Mac) is that the latest stable version is installed by default (e.g. currently 0.7.1).

My plan is basically this:

Srekel commented 3 years ago

Ok! :) That's fine, it's not a big difference for me either way, just a suggestion.