msvcbuild.bat (3721B)
1 @rem Script to build LuaJIT with MSVC. 2 @rem Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h 3 @rem 4 @rem Either open a "Visual Studio .NET Command Prompt" 5 @rem (Note that the Express Edition does not contain an x64 compiler) 6 @rem -or- 7 @rem Open a "Windows SDK Command Shell" and set the compiler environment: 8 @rem setenv /release /x86 9 @rem -or- 10 @rem setenv /release /x64 11 @rem 12 @rem Then cd to this directory and run this script. 13 14 @if not defined INCLUDE goto :FAIL 15 16 @setlocal 17 @set LJCOMPILE=cl /nologo /c /O2 /W3 /D_CRT_SECURE_NO_DEPRECATE 18 @set LJLINK=link /nologo 19 @set LJMT=mt /nologo 20 @set LJLIB=lib /nologo /nodefaultlib 21 @set DASMDIR=..\dynasm 22 @set DASM=%DASMDIR%\dynasm.lua 23 @set LJDLLNAME=lua51.dll 24 @set LJLIBNAME=lua51.lib 25 @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 26 27 %LJCOMPILE% host\minilua.c 28 @if errorlevel 1 goto :BAD 29 %LJLINK% /out:minilua.exe minilua.obj 30 @if errorlevel 1 goto :BAD 31 if exist minilua.exe.manifest^ 32 %LJMT% -manifest minilua.exe.manifest -outputresource:minilua.exe 33 34 @set DASMFLAGS=-D WIN -D JIT -D FFI -D P64 35 @set LJARCH=x64 36 @minilua 37 @if errorlevel 8 goto :X64 38 @set DASMFLAGS=-D WIN -D JIT -D FFI 39 @set LJARCH=x86 40 @set LJCOMPILE=%LJCOMPILE% /arch:SSE2 41 :X64 42 minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h vm_x86.dasc 43 @if errorlevel 1 goto :BAD 44 45 %LJCOMPILE% /I "." /I %DASMDIR% host\buildvm*.c 46 @if errorlevel 1 goto :BAD 47 %LJLINK% /out:buildvm.exe buildvm*.obj 48 @if errorlevel 1 goto :BAD 49 if exist buildvm.exe.manifest^ 50 %LJMT% -manifest buildvm.exe.manifest -outputresource:buildvm.exe 51 52 buildvm -m peobj -o lj_vm.obj 53 @if errorlevel 1 goto :BAD 54 buildvm -m bcdef -o lj_bcdef.h %ALL_LIB% 55 @if errorlevel 1 goto :BAD 56 buildvm -m ffdef -o lj_ffdef.h %ALL_LIB% 57 @if errorlevel 1 goto :BAD 58 buildvm -m libdef -o lj_libdef.h %ALL_LIB% 59 @if errorlevel 1 goto :BAD 60 buildvm -m recdef -o lj_recdef.h %ALL_LIB% 61 @if errorlevel 1 goto :BAD 62 buildvm -m vmdef -o jit\vmdef.lua %ALL_LIB% 63 @if errorlevel 1 goto :BAD 64 buildvm -m folddef -o lj_folddef.h lj_opt_fold.c 65 @if errorlevel 1 goto :BAD 66 67 @if "%1" neq "debug" goto :NODEBUG 68 @shift 69 @set LJCOMPILE=%LJCOMPILE% /Zi 70 @set LJLINK=%LJLINK% /debug 71 :NODEBUG 72 @if "%1"=="amalg" goto :AMALGDLL 73 @if "%1"=="static" goto :STATIC 74 %LJCOMPILE% /MD /DLUA_BUILD_AS_DLL lj_*.c lib_*.c 75 @if errorlevel 1 goto :BAD 76 %LJLINK% /DLL /out:%LJDLLNAME% lj_*.obj lib_*.obj 77 @if errorlevel 1 goto :BAD 78 @goto :MTDLL 79 :STATIC 80 %LJCOMPILE% lj_*.c lib_*.c 81 @if errorlevel 1 goto :BAD 82 %LJLIB% /OUT:%LJLIBNAME% lj_*.obj lib_*.obj 83 @if errorlevel 1 goto :BAD 84 @goto :MTDLL 85 :AMALGDLL 86 %LJCOMPILE% /MD /DLUA_BUILD_AS_DLL ljamalg.c 87 @if errorlevel 1 goto :BAD 88 %LJLINK% /DLL /out:%LJDLLNAME% ljamalg.obj lj_vm.obj 89 @if errorlevel 1 goto :BAD 90 :MTDLL 91 if exist %LJDLLNAME%.manifest^ 92 %LJMT% -manifest %LJDLLNAME%.manifest -outputresource:%LJDLLNAME%;2 93 94 %LJCOMPILE% luajit.c 95 @if errorlevel 1 goto :BAD 96 %LJLINK% /out:luajit.exe luajit.obj %LJLIBNAME% 97 @if errorlevel 1 goto :BAD 98 if exist luajit.exe.manifest^ 99 %LJMT% -manifest luajit.exe.manifest -outputresource:luajit.exe 100 101 @del *.obj *.manifest minilua.exe buildvm.exe 102 @del host\buildvm_arch.h 103 @del lj_bcdef.h lj_ffdef.h lj_libdef.h lj_recdef.h lj_folddef.h 104 @echo. 105 @echo === Successfully built LuaJIT for Windows/%LJARCH% === 106 107 @goto :END 108 :BAD 109 @echo. 110 @echo ******************************************************* 111 @echo *** Build FAILED -- Please check the error messages *** 112 @echo ******************************************************* 113 @goto :END 114 :FAIL 115 @echo You must open a "Visual Studio .NET Command Prompt" to run this script 116 :END