2009-12-08 18:46:35 +00:00
|
|
|
|
@rem Script to build LuaJIT with MSVC.
|
2012-01-23 21:42:30 +00:00
|
|
|
|
@rem Copyright (C) 2005-2012 Mike Pall. See Copyright Notice in luajit.h
|
2009-12-08 18:46:35 +00:00
|
|
|
|
@rem
|
2010-01-17 19:33:13 +00:00
|
|
|
|
@rem Either open a "Visual Studio .NET Command Prompt"
|
|
|
|
|
@rem (Note that the Express Edition does not contain an x64 compiler)
|
|
|
|
|
@rem -or-
|
|
|
|
|
@rem Open a "Windows SDK Command Shell" and set the compiler environment:
|
|
|
|
|
@rem setenv /release /x86
|
|
|
|
|
@rem -or-
|
|
|
|
|
@rem setenv /release /x64
|
|
|
|
|
@rem
|
|
|
|
|
@rem Then cd to this directory and run this script.
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
|
|
|
|
@if not defined INCLUDE goto :FAIL
|
|
|
|
|
|
|
|
|
|
@setlocal
|
|
|
|
|
@set LJCOMPILE=cl /nologo /c /MD /O2 /W3 /D_CRT_SECURE_NO_DEPRECATE
|
|
|
|
|
@set LJLINK=link /nologo
|
|
|
|
|
@set LJMT=mt /nologo
|
2010-03-15 17:50:59 +00:00
|
|
|
|
@set LJLIB=lib /nologo
|
2009-12-08 18:46:35 +00:00
|
|
|
|
@set DASMDIR=..\dynasm
|
|
|
|
|
@set DASM=lua %DASMDIR%\dynasm.lua
|
2010-12-04 23:43:47 +00:00
|
|
|
|
@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
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
|
|
|
|
if not exist buildvm_x86.h^
|
|
|
|
|
%DASM% -LN -o buildvm_x86.h buildvm_x86.dasc
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@if errorlevel 1 goto :BAD
|
2010-01-17 19:33:13 +00:00
|
|
|
|
if not exist buildvm_x64win.h^
|
|
|
|
|
%DASM% -LN -D X64 -D X64WIN -o buildvm_x64win.h buildvm_x86.dasc
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@if errorlevel 1 goto :BAD
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
|
|
|
|
%LJCOMPILE% /I "." /I %DASMDIR% buildvm*.c
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@if errorlevel 1 goto :BAD
|
2009-12-08 18:46:35 +00:00
|
|
|
|
%LJLINK% /out:buildvm.exe buildvm*.obj
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@if errorlevel 1 goto :BAD
|
2009-12-08 18:46:35 +00:00
|
|
|
|
if exist buildvm.exe.manifest^
|
|
|
|
|
%LJMT% -manifest buildvm.exe.manifest -outputresource:buildvm.exe
|
|
|
|
|
|
|
|
|
|
buildvm -m peobj -o lj_vm.obj
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@if errorlevel 1 goto :BAD
|
2010-02-13 03:51:56 +00:00
|
|
|
|
buildvm -m bcdef -o lj_bcdef.h %ALL_LIB%
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@if errorlevel 1 goto :BAD
|
2009-12-08 18:46:35 +00:00
|
|
|
|
buildvm -m ffdef -o lj_ffdef.h %ALL_LIB%
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@if errorlevel 1 goto :BAD
|
2009-12-08 18:46:35 +00:00
|
|
|
|
buildvm -m libdef -o lj_libdef.h %ALL_LIB%
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@if errorlevel 1 goto :BAD
|
2009-12-08 18:46:35 +00:00
|
|
|
|
buildvm -m recdef -o lj_recdef.h %ALL_LIB%
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@if errorlevel 1 goto :BAD
|
2012-06-08 18:54:47 +00:00
|
|
|
|
buildvm -m vmdef -o jit\vmdef.lua %ALL_LIB%
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@if errorlevel 1 goto :BAD
|
2009-12-08 18:46:35 +00:00
|
|
|
|
buildvm -m folddef -o lj_folddef.h lj_opt_fold.c
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@if errorlevel 1 goto :BAD
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@if "%1" neq "debug" goto :NODEBUG
|
|
|
|
|
@shift
|
2011-11-17 16:34:23 +00:00
|
|
|
|
@set LJCOMPILE=%LJCOMPILE% /Zi
|
|
|
|
|
@set LJLINK=%LJLINK% /debug
|
2011-06-29 17:26:31 +00:00
|
|
|
|
:NODEBUG
|
2009-12-08 18:46:35 +00:00
|
|
|
|
@if "%1"=="amalg" goto :AMALGDLL
|
2010-03-15 17:50:59 +00:00
|
|
|
|
@if "%1"=="static" goto :STATIC
|
2009-12-08 18:46:35 +00:00
|
|
|
|
%LJCOMPILE% /DLUA_BUILD_AS_DLL lj_*.c lib_*.c
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@if errorlevel 1 goto :BAD
|
2009-12-08 18:46:35 +00:00
|
|
|
|
%LJLINK% /DLL /out:lua51.dll lj_*.obj lib_*.obj
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@if errorlevel 1 goto :BAD
|
2009-12-08 18:46:35 +00:00
|
|
|
|
@goto :MTDLL
|
2010-03-15 17:50:59 +00:00
|
|
|
|
:STATIC
|
|
|
|
|
%LJCOMPILE% /DLUA_BUILD_AS_DLL lj_*.c lib_*.c
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@if errorlevel 1 goto :BAD
|
2010-03-15 17:50:59 +00:00
|
|
|
|
%LJLIB% /OUT:lua51.lib lj_*.obj lib_*.obj
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@if errorlevel 1 goto :BAD
|
2010-03-15 17:50:59 +00:00
|
|
|
|
@goto :MTDLL
|
2009-12-08 18:46:35 +00:00
|
|
|
|
:AMALGDLL
|
|
|
|
|
%LJCOMPILE% /DLUA_BUILD_AS_DLL ljamalg.c
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@if errorlevel 1 goto :BAD
|
2009-12-08 18:46:35 +00:00
|
|
|
|
%LJLINK% /DLL /out:lua51.dll ljamalg.obj lj_vm.obj
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@if errorlevel 1 goto :BAD
|
2009-12-08 18:46:35 +00:00
|
|
|
|
:MTDLL
|
|
|
|
|
if exist lua51.dll.manifest^
|
|
|
|
|
%LJMT% -manifest lua51.dll.manifest -outputresource:lua51.dll;2
|
|
|
|
|
|
|
|
|
|
%LJCOMPILE% luajit.c
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@if errorlevel 1 goto :BAD
|
2009-12-08 18:46:35 +00:00
|
|
|
|
%LJLINK% /out:luajit.exe luajit.obj lua51.lib
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@if errorlevel 1 goto :BAD
|
2009-12-08 18:46:35 +00:00
|
|
|
|
if exist luajit.exe.manifest^
|
|
|
|
|
%LJMT% -manifest luajit.exe.manifest -outputresource:luajit.exe
|
|
|
|
|
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@del *.obj *.manifest buildvm.exe
|
|
|
|
|
@echo.
|
|
|
|
|
@echo === Successfully built LuaJIT ===
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
2011-06-29 17:26:31 +00:00
|
|
|
|
@goto :END
|
|
|
|
|
:BAD
|
|
|
|
|
@echo.
|
|
|
|
|
@echo *******************************************************
|
|
|
|
|
@echo *** Build FAILED -- Please check the error messages ***
|
|
|
|
|
@echo *******************************************************
|
2009-12-08 18:46:35 +00:00
|
|
|
|
@goto :END
|
|
|
|
|
:FAIL
|
|
|
|
|
@echo You must open a "Visual Studio .NET Command Prompt" to run this script
|
|
|
|
|
:END
|