Tangent128 / luasdl2

A pure C binding of SDL 2.0 for Lua 5.1, Lua 5.2, and LuaJIT.
ISC License
383 stars 73 forks source link

Add windows/powershell install instructions #86

Open ShortRoundDev opened 4 years ago

ShortRoundDev commented 4 years ago

Running luarocks install lua-sdl2 on windows with powershell runs into several problems:

  1. trying to pass the directories manually for SDL2_image (as well as other SDL2 addon libraries) yields an error because luarocks appears to not allow lowercase letters when passing in variables. Doing so yield Invalid assignment as an error.

  2. Placing the lua development headers and binaries in c:\external then runs into the problem of requiring cl.exe to be present in the path of the user - which it is not by default

  3. Adding the directory for cl.exe to the path of the user then results in the inability to find c runtime headers such as stdio.h since cl.exe requires all include directories to be manually specified and has no default directory. Since the rock doesn't specify any include path or environment variable to set for the c runtime, they cannot be found

Currently, as far as I can tell, building through luarocks on windows/Visual C++ is broken. It would be nice to have:

  1. instructions for building on windows specifically
  2. allow a directory to be specified in the luarocks install command for wincrt headers so cl.exe can build correctly
  3. fix the variable names in the rock to remove lowercase letters from the SDL2 directories
  4. provide binary distributions directly for the most common OS/architectures to avoid having to build the binaries yourself, which would make program distribution easier (don't have to distribute your own binaries, and don't have to instruct users to install luarocks and overcome all these obstacles themselves)
ByPikod commented 1 year ago

I am trying to set luasdl2 up in windows and I had tons of different errors in few hours. I don't even remember the first error I got. I am trying to install this thing for almost 4 hour. My brain about to explode. Please add better instructions.

PeriodicFemaleAmoeba-size_restricted

clitic commented 1 year ago

@ByPikod I had also a great trouble when I was building lua-sdl2 on windows using msvc. After failing to build lua-sdl2 I decided to switch to meson build and created lua-batteries. It includes latest version of lua-sdl2. Also sdl2 and it's dependent libraries are all statically linked to lua-sdl2 module. For now msvc builds works fine but I am working to support mingw.

https://user-images.githubusercontent.com/71246790/204086287-804d9a72-316b-4a18-b55d-3252eade62f6.mp4

ByPikod commented 1 year ago

@clitic thank you so much. You are a life saver. I am going to try your solution. I'll let u know if it works. youre-a-wonderful-human-youre-a-great-person