ignore built DLLs + adjust output path #5
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
.*
|
||||
!.gitignore
|
||||
.*
|
||||
build/
|
||||
|
||||
BIN
BlockLua.dll
BIN
BlockLua.dll
Binary file not shown.
13
compile.bat
13
compile.bat
@@ -5,12 +5,13 @@ set buildargs=-Wall -Werror -m32 -shared -Isrc -Iinc/tsfuncs -Iinc/lua -lpsapi -
|
||||
|
||||
echo on
|
||||
|
||||
g++ src/bllua4.cpp %buildargs% -o BlockLua.dll
|
||||
@rem g++ -DBLLUA_UNSAFE src/bllua4.cpp %buildargs% -o BlockLua-Unsafe.dll
|
||||
set outdir=build
|
||||
if not exist %outdir% mkdir %outdir%
|
||||
|
||||
g++ src/bllua4.cpp %buildargs% -o %outdir%\BlockLua.dll
|
||||
@rem g++ -DBLLUA_UNSAFE src/bllua4.cpp %buildargs% -o %outdir%\BlockLua-Unsafe.dll
|
||||
|
||||
@echo off
|
||||
|
||||
rem objdump -d BlockLua.dll > BlockLua.dll.dump.txt
|
||||
rem objdump -d BlockLua-Unsafe.dll > BlockLua-Unsafe.dll.dump.txt
|
||||
|
||||
pause
|
||||
rem objdump -d %outdir%\BlockLua.dll > %outdir%\BlockLua.dll.dump.txt
|
||||
rem objdump -d %outdir%\BlockLua-Unsafe.dll > %outdir%\BlockLua-Unsafe.dll.dump.txt
|
||||
|
||||
29
compile.sh
Normal file
29
compile.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# BlockLua build script for MSYS2/MinGW32
|
||||
#
|
||||
# Usage:
|
||||
# 1. Open the MSYS2 MinGW32 shell.
|
||||
# 2. Install the required compiler with:
|
||||
# pacman -S mingw-w64-i686-gcc
|
||||
# 3. Run this script:
|
||||
# ./compile.sh
|
||||
#
|
||||
# If your MSYS2 installation is not on C:, adjust the g++ path below as needed.
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
buildargs="-Wall -Werror -m32 -shared -Isrc -Iinc/tsfuncs -Iinc/lua -lpsapi -L. -llua5.1 -static-libgcc -static-libstdc++"
|
||||
|
||||
outdir="build"
|
||||
mkdir -p "$outdir"
|
||||
|
||||
set -x
|
||||
/mingw32/bin/g++ src/bllua4.cpp $buildargs -o "$outdir"/BlockLua.dll && /mingw32/bin/g++ -DBLLUA_UNSAFE src/bllua4.cpp $buildargs -o "$outdir"/BlockLua-Unsafe.dll
|
||||
set +x
|
||||
|
||||
# objdump -d "$outdir"/BlockLua.dll > "$outdir"/BlockLua.dll.dump.txt
|
||||
# objdump -d "$outdir"/BlockLua-Unsafe.dll > "$outdir"/BlockLua-Unsafe.dll.dump.txt
|
||||
@@ -7,7 +7,11 @@ ts = _bllua_ts
|
||||
|
||||
-- Provide limited OS functions
|
||||
os = os or {}
|
||||
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
function os.time() return math.floor(tonumber(_bllua_ts.call('getSimTime'))/1000) end
|
||||
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
function os.clock() return tonumber(_bllua_ts.call('getSimTime'))/1000 end
|
||||
|
||||
-- Virtual file class, emulating a file object as returned by io.open
|
||||
@@ -106,9 +110,10 @@ local function io_open_absolute(fn, mode)
|
||||
end
|
||||
|
||||
io = io or {}
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
function io.open(fn, mode, errn)
|
||||
errn = errn or 1
|
||||
|
||||
|
||||
-- try to open the file with relative path, otherwise use absolute path
|
||||
local curfn = debug.getfilename(errn + 1) or _bllua_ts.getvar('Con::File')
|
||||
if curfn == '' then curfn = nil end
|
||||
@@ -126,13 +131,19 @@ function io.open(fn, mode, errn)
|
||||
return fi, err, fn
|
||||
end
|
||||
end
|
||||
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
function io.lines(fn)
|
||||
local fi, err, fn2 = io.open(fn, nil, 2)
|
||||
local fi, err, fn2 = io.open(fn, 'r', 2)
|
||||
if not fi then error('Error opening file \''..fn2..'\': '..err, 2) end
|
||||
return fi:lines()
|
||||
end
|
||||
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
function io.type(f)
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
if type(f)=='table' and f._is_file then
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
return f._is_open and 'file' or 'closed file'
|
||||
else
|
||||
return _bllua_io_type(f)
|
||||
|
||||
Reference in New Issue
Block a user