lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

I can now confirm that srlua-102 compiles and runs as designed on
Windows using this additional Makefile and with no change to the

The file below successfully runs with mingw32-make on the cmd-shell
and also with plain 'make -f Makefile.mingw' in the Cygwin-terminal.
I can now create my binaries for Windows as desired. Tested with the
versions that I noted down on the Wiki-page: at the

Next steps could be:
(1) Adding a Windows-resources file (for the icon and some metadata
with windres);
(2) compile statically to avoid the need to copy all the DLLs.
(3) Generating an NSIS-installer configuration to pack my app in an installer.

(->1) has been done by some srlua-forks on Github.
(->2) I am going to investigate with low priority
(->3) Should be pretty straightforward. Have done it before. (if 3 is
done, 2 becomes less important).

I say, it's really great what you can do with Lua. It's so incredibly versatile.

## Makefile.mingw
# Makefile for srlua for mingw32, to be run in Windows-cmd shell.
# Contributed to srlua by Stefan Schroeder under the same license
# conditions that srlua is published under.

# Change this setting to meet your configuration:
LUA_TOPDIR= d:/Lua/5.1
# Depending on your Lua-distro, the dll might also be located
# elsewhere:
# Everything below this line should be ok.

CC=mingw32-gcc -std=c99 -Wall -O2

all: check bin test

ifneq ("$(wildcard $(LUA_DLL))","")
    @echo "Lua-DLL was found. You are good to go."
    $(error Lua-DLL was NOT found. Cannot continue. Please fix LUA_DLL")

    $(CC) -static-libgcc  -c srglue.c -o glue.o
    $(CXX) -o glue.exe glue.o  -s
    $(CC) -static-libgcc -I. -I$(LUA_INCDIR) -c srlua.c -o srlua.o
    $(CXX) -o srlua.exe  srlua.o -s $(LUA_DLL)

# The 'test' target patches the PATH temporarily, so that the DLL
# is in the PATH.
    ./glue.exe ./srlua.exe test.lua out.exe
    cmd /c "SET PATH=%PATH%;$(LUA_LIBDIR)&out.exe 123 abc"

.PHONY: all bin test