1 @rem Script to build LuaJIT with the Xbox One SDK.
\r
2 @rem Donated to the public domain.
\r
4 @rem Open a "Visual Studio .NET Command Prompt" (64 bit host compiler)
\r
5 @rem Then cd to this directory and run this script.
\r
7 @if not defined INCLUDE goto :FAIL
\r
8 @if not defined DurangoXDK goto :FAIL
\r
11 @echo ---- Host compiler ----
\r
12 @set LJCOMPILE=cl /nologo /c /MD /O2 /W3 /D_CRT_SECURE_NO_DEPRECATE /DLUAJIT_ENABLE_GC64
\r
13 @set LJLINK=link /nologo
\r
14 @set LJMT=mt /nologo
\r
15 @set DASMDIR=..\dynasm
\r
16 @set DASM=%DASMDIR%\dynasm.lua
\r
17 @set ALL_LIB=lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c
\r
19 %LJCOMPILE% host\minilua.c
\r
20 @if errorlevel 1 goto :BAD
\r
21 %LJLINK% /out:minilua.exe minilua.obj
\r
22 @if errorlevel 1 goto :BAD
\r
23 if exist minilua.exe.manifest^
\r
24 %LJMT% -manifest minilua.exe.manifest -outputresource:minilua.exe
\r
26 @rem Error out for 64 bit host compiler
\r
28 @if not errorlevel 8 goto :FAIL
\r
30 @set DASMFLAGS=-D WIN -D FFI -D P64
\r
31 minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h vm_x64.dasc
\r
32 @if errorlevel 1 goto :BAD
\r
34 %LJCOMPILE% /I "." /I %DASMDIR% /D_DURANGO host\buildvm*.c
\r
35 @if errorlevel 1 goto :BAD
\r
36 %LJLINK% /out:buildvm.exe buildvm*.obj
\r
37 @if errorlevel 1 goto :BAD
\r
38 if exist buildvm.exe.manifest^
\r
39 %LJMT% -manifest buildvm.exe.manifest -outputresource:buildvm.exe
\r
41 buildvm -m peobj -o lj_vm.obj
\r
42 @if errorlevel 1 goto :BAD
\r
43 buildvm -m bcdef -o lj_bcdef.h %ALL_LIB%
\r
44 @if errorlevel 1 goto :BAD
\r
45 buildvm -m ffdef -o lj_ffdef.h %ALL_LIB%
\r
46 @if errorlevel 1 goto :BAD
\r
47 buildvm -m libdef -o lj_libdef.h %ALL_LIB%
\r
48 @if errorlevel 1 goto :BAD
\r
49 buildvm -m recdef -o lj_recdef.h %ALL_LIB%
\r
50 @if errorlevel 1 goto :BAD
\r
51 buildvm -m vmdef -o jit\vmdef.lua %ALL_LIB%
\r
52 @if errorlevel 1 goto :BAD
\r
53 buildvm -m folddef -o lj_folddef.h lj_opt_fold.c
\r
54 @if errorlevel 1 goto :BAD
\r
56 @echo ---- Cross compiler ----
\r
59 @call "%DurangoXDK%\xdk\DurangoVars.cmd" XDK
\r
63 @set LJCOMPILE="cl" /nologo /c /W3 /GF /Gm- /GR- /GS- /Gy /openmp- /D_CRT_SECURE_NO_DEPRECATE /D_LIB /D_UNICODE /D_DURANGO
\r
64 @set LJLIB="lib" /nologo
\r
68 @set LJCOMPILE=%LJCOMPILE% /Zi /MDd /Od
\r
69 @set LJLINK=%LJLINK% /debug
\r
71 @set LJCOMPILE=%LJCOMPILE% /MD /O2 /DNDEBUG
\r
74 @if "%1"=="amalg" goto :AMALG
\r
75 %LJCOMPILE% /DLUA_BUILD_AS_DLL lj_*.c lib_*.c
\r
76 @if errorlevel 1 goto :BAD
\r
77 %LJLIB% /OUT:luajit.lib lj_*.obj lib_*.obj
\r
78 @if errorlevel 1 goto :BAD
\r
81 %LJCOMPILE% /DLUA_BUILD_AS_DLL ljamalg.c
\r
82 @if errorlevel 1 goto :BAD
\r
83 %LJLIB% /OUT:luajit.lib ljamalg.obj lj_vm.obj
\r
84 @if errorlevel 1 goto :BAD
\r
87 @del *.obj *.manifest minilua.exe buildvm.exe
\r
89 @echo === Successfully built LuaJIT for Xbox One ===
\r
94 @echo *******************************************************
\r
95 @echo *** Build FAILED -- Please check the error messages ***
\r
96 @echo *******************************************************
\r
99 @echo To run this script you must open a "Visual Studio .NET Command Prompt"
\r
100 @echo (64 bit host compiler). The Xbox One SDK must be installed, too.
\r