内容纲要

虽然 premake 很好用,批处理也可以使

@SET VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 8
@SET VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 8\VC
@SET FrameworkDir=C:\Windows\Microsoft.NET\Framework
@SET FrameworkVersion=v2.0.50727
@SET FrameworkSDKDir=C:\Program Files (x86)\Microsoft Visual Studio 8\SDK\v2.0
@if "%VSINSTALLDIR%"=="" goto error_no_VSINSTALLDIR
@if "%VCINSTALLDIR%"=="" goto error_no_VCINSTALLDIR

@echo Setting environment for using Microsoft Visual Studio 2005 x86 tools.

@rem
@rem Root of Visual Studio IDE installed files.
@rem
@set DevEnvDir=C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE

@set PATH=C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 8\VC\BIN;C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\Tools;C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\Tools\bin;C:\Program Files (x86)\Microsoft Visual Studio 8\VC\PlatformSDK\bin;C:\Program Files (x86)\Microsoft Visual Studio 8\SDK\v2.0\bin;C:\Windows\Microsoft.NET\Framework\v2.0.50727;C:\Program Files (x86)\Microsoft Visual Studio 8\VC\VCPackages;%PATH%
@set INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 8\VC\ATLMFC\INCLUDE;C:\Program Files (x86)\Microsoft Visual Studio 8\VC\INCLUDE;C:\Program Files (x86)\Microsoft Visual Studio 8\VC\PlatformSDK\include;%INCLUDE%
@set LIB=C:\Program Files (x86)\Microsoft Visual Studio 8\VC\ATLMFC\LIB;C:\Program Files (x86)\Microsoft Visual Studio 8\VC\LIB;C:\Program Files (x86)\Microsoft Visual Studio 8\VC\PlatformSDK\lib;C:\Program Files (x86)\Microsoft Visual Studio 8\SDK\v2.0\lib;%LIB%
@set LIBPATH=C:\Windows\Microsoft.NET\Framework\v2.0.50727;C:\Program Files (x86)\Microsoft Visual Studio 8\VC\ATLMFC\LIB

@goto end

:error_no_VSINSTALLDIR
@echo ERROR: VSINSTALLDIR variable is not set. 
@goto end

:error_no_VCINSTALLDIR
@echo ERROR: VCINSTALLDIR variable is not set. 
@goto end

:end



@set MYCOMPILE=cl /nologo /O2 /W3 /c /D_CRT_SECURE_NO_DEPRECATE


cd %~dp0
mkdir "build"
cd src



:build MTd_DLL
del *.obj
%MYCOMPILE% /MTd /DLUA_BUILD_AS_DLL l*.c 
del lua.obj luac.obj
link /DLL /out:"../build/lua51_MTd.dll" l*.obj
%MYCOMPILE% /MTd /DLUA_BUILD_AS_DLL lua.c
link /out:"../build/lua_MTd.exe" /LIBPATH:"../build/" lua.obj lua51_MTd.lib
del lua.obj
%MYCOMPILE% /MTd /DLUA_BUILD_AS_DLL luac.c print.c
link /out:"../build/luac_MTd.exe" /LIBPATH:"../build/" l*.obj print.obj

:build MT_DLL
del *.obj
%MYCOMPILE% /MT /DLUA_BUILD_AS_DLL l*.c 
del lua.obj luac.obj
link /DLL /out:"../build/lua51_MT.dll" l*.obj
%MYCOMPILE% /MT /DLUA_BUILD_AS_DLL lua.c
link /out:"../build/lua_MT.exe" /LIBPATH:"../build/" lua.obj lua51_MT.lib
del lua.obj
%MYCOMPILE% /MT /DLUA_BUILD_AS_DLL luac.c print.c
link /out:"../build/luac_MT.exe" /LIBPATH:"../build/" l*.obj print.obj




:build MTd_LIB
del *.obj
%MYCOMPILE% /MTd l*.c 
del lua.obj luac.obj
link /DLL /out:"../build/lua51d.lib" l*.obj


:build MT_LIB
del *.obj
%MYCOMPILE% /MT l*.c 
del lua.obj luac.obj
link /DLL /out:"../build/lua51.lib" l*.obj


del *.obj *.dll *.exp *.lib
del "../build/*.exp"

cd ..

发表评论

电子邮件地址不会被公开。 必填项已用*标注