-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.bat
83 lines (74 loc) · 2.35 KB
/
build.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
@echo off
IF NOT "%VSCMD_ARG_TGT_ARCH%"=="x64" (
ECHO This script must be executed with Miscrosoft Visual Studio C++ ^(x64^) environment loaded
EXIT /B 1
)
SETLOCAL ENABLEDELAYEDEXPANSION
SET RL_GTAV=0
SET RL_STANDALONE=0
SET RL_NODEBUG=0
:argparse
IF "%1"=="gtav" SET RL_GTAV=1
IF "%1"=="standalone" SET RL_STANDALONE=1
IF "%1"=="nodebug" SET RL_NODEBUG=1
IF "%1"=="" GOTO argdone
SHIFT
GOTO argparse
:argdone
SET RL_LUAJIT_SOURCE_DIR=.\src\thirdparty\LuaJIT\src
IF NOT EXIST "!RL_LUAJIT_SOURCE_DIR!\lua51.lib" (
PUSHD !RL_LUAJIT_SOURCE_DIR!
CALL .\msvcbuild.bat
IF !ERRORLEVEL! NEQ 0 (
ECHO Failed to compile LuaJIT
EXIT /B 1
)
POPD
)
SET RL_OUT_BIN=RedLua.asi
SET RL_LIBS=user32.lib shell32.lib Wininet.lib lua51.lib
SET RL_SOURCES=src\*.cpp src\thirdparty\*.cpp src\menus\*.cpp
SET RL_LDFLAGS=/DLL /INCREMENTAL /LIBPATH:"!RL_LUAJIT_SOURCE_DIR!"
SET RL_CFLAGS=/DELPP_NO_DEFAULT_LOG_FILE /DELPP_DISABLE_LOG_FILE_FROM_ARG ^
/DELPP_THREAD_SAFE /DWIN32_LEAN_AND_MEAN /D_CRT_SECURE_NO_WARNINGS /FC /W2 ^
/Isrc\ /EHsc /MP /DLL
IF !RL_NODEBUG! EQU 0 (
SET RL_CFLAGS=!RL_CFLAGS! /Zi /DEBUG /MTd
) ELSE (
SET RL_CFLAGS=!RL_CFLAGS! /MT
)
IF !RL_GTAV! EQU 1 (
SET RL_OUT_PATH="D:\Games\Grand Theft Auto V"
SET RL_SCRIPTHOOK_VARIANT=V
SET RL_CFLAGS=!RL_CFLAGS! /DREDLUA_GTAV
) ELSE (
SET RL_OUT_PATH="D:\SteamLibrary\steamapps\common\Red Dead Redemption 2"
SET RL_CFLAGS=!RL_CFLAGS! /DREDLUA_RDR3
SET RL_SCRIPTHOOK_VARIANT=RDR2
)
SET RL_SCRIPTHOOK_SDK_DIR=.\src\thirdparty\ScriptHook!RL_SCRIPTHOOK_VARIANT!
IF !RL_STANDALONE! EQU 1 (
SET RL_OUT_PATH=".\objs\output!RL_SCRIPTHOOK_VARIANT!"
SET RL_CFLAGS=!RL_CFLAGS! /DREDLUA_STANDALONE
SET RL_CFLAGS=!RL_CFLAGS! /Fd!RL_OUT_PATH!\
SET RL_SOURCES=!RL_SOURCES! src\emu\native.cpp
SET RL_OUT_BIN=RedLua.dll
) ELSE (
SET RL_LIBS=!RL_LIBS! ScriptHook!RL_SCRIPTHOOK_VARIANT!.lib
SET RL_LDFLAGS=!RL_LDFLAGS! /LIBPATH:"!RL_SCRIPTHOOK_SDK_DIR!\lib"
)
MKDIR ".\objs\!RL_SCRIPTHOOK_VARIANT!" 2> NUL
SET RL_CFLAGS=!RL_CFLAGS! /Foobjs\!RL_SCRIPTHOOK_VARIANT!\
IF NOT EXIST !RL_OUT_PATH! (
SET RL_OUT_PATH=".\objs\output!RL_SCRIPTHOOK_VARIANT!"
MKDIR !RL_OUT_PATH! 2> NUL
)
IF !RL_STANDALONE! NEQ 1 IF NOT EXIST "!RL_OUT_PATH!\lua51.dll" (
COPY !RL_LUAJIT_SOURCE_DIR!\lua51.dll !RL_OUT_PATH! 2> NUL
)
CL !RL_CFLAGS! /Fe!RL_OUT_PATH!\!RL_OUT_BIN! !RL_SOURCES! /link !RL_LDFLAGS! !RL_LIBS!
IF !ERRORLEVEL! NEQ 0 (
ENDLOCAL
EXIT /B 1
)
ENDLOCAL