[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Help needed Building static binaries on Windows
- From: Stefan Schroeder <ondekoza@...>
- Date: Thu, 28 Nov 2019 11:44:04 +0100
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:
https://lua-users.org/wiki/BuildingLuaInWindowsForNewbies at the
Next steps could be:
(1) Adding a Windows-resources file (for the icon and some metadata
(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 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:
# Depending on your Lua-distro, the dll might also be located
# 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