Jack-Ji / jok

A minimal 2d/3d game framework for @ziglang.
MIT License
181 stars 5 forks source link

Example does not work on Windows 11 #18

Closed grjzwaan closed 2 months ago

grjzwaan commented 2 months ago

I followed the instruction and got the following error on zig build

Could not auto-detect SDL2 sdk configuration. Please provide C:\Users\<username>\AppData\Local\zig\p\1220dc7b8b63eab7a4184fde897e51f8f1301d8615a0bbb0c9f8f0b693fa38055c4e\.build_config\sdl.json with the following contents filled out:
{
  "x86_64-windows-gnu": {
    "include": "<path to sdk>/include",
    "libs": "<path to sdk>/lib",
    "bin": "<path to sdk>/bin"
  }
}

This temporary folder contains the sdl.zig dependency.

Any idea how I can influence the place where the install/build script is looking for this JSON? It is properly configured in the project folder.

Jack-Ji commented 2 months ago

I'm afraid there's currently no way to customize path to sdl.json. You need to create a seperate .build_config/sdl.json file in jok directory in order to run examples. Normally, you can just copy the sdl.json from your project, everything should just work.

Jack-Ji commented 2 months ago

I might add support for grabbing path to sdl.json from environment variable, not 100% sure yet.

grjzwaan commented 2 months ago

Thanks, if I add it to both folders (for sdl and jok) then it builds.

I just started working in Zig, but if I read the code correctly a path to SDL is constructed in joke.createGame. Perhaps passing this as an optional argument would work on Windows and still work on Linux. I'll try to see if I can make that work locally.

Jack-Ji commented 2 months ago

I thought about this way, didn't work for some reason (on linux). Also, it would require modifying examples' build option after first downloaded or updated jok dependency, which is undesirable IMO. Hence the environment variable mentioned above, looks more approachable to me.

Jack-Ji commented 2 months ago

Support for getting sdl config path from environment variable has been added. Feel free to create new issue if there's still problem.