floooh/sokol-zig

Windows now needs gdi32

Closed this issue · 7 comments

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.

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

#pragma comment (lib, "kernel32")
#pragma comment (lib, "user32")
#pragma comment (lib, "shell32") /* CommandLineToArgvW, DragQueryFileW, DragFinished */
#if defined(SOKOL_D3D11)
#pragma comment (lib, "dxgi")
#pragma comment (lib, "d3d11")
#pragma comment (lib, "dxguid")
#endif
#if defined(SOKOL_GLCORE33)
#pragma comment (lib, "gdi32")
#endif

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

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

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.

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

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

floooh/sokol@bd2066f

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?

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:

  • keep master compatible with the current stable version
  • if the current dev-version becomes incompatible with stable, start a new branch (e.g. 0.8.0)
  • once the current Zig dev-version becomes the new stable version, merge the sokol-zig branch into master
  • ...and repeat...

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