DTRenderer/src/build.bat

73 lines
3.0 KiB
Batchfile
Raw Normal View History

2017-05-02 16:04:12 +00:00
@echo off
REM Build for Visual Studio compiler. Run your copy of vcvarsall.bat to setup command-line compiler.
REM Check if build tool is on path
REM >nul, 2>nul will remove the output text from the where command
where /q cl.exe
if %errorlevel%==1 (
echo MSVC CL not on path, please add it to path to build by command line.
goto end
)
2017-05-16 12:53:28 +00:00
REM Build tags file if you have ctags in path
where /q ctags
if %errorlevel%==0 (
ctags -R
)
2017-05-02 16:04:12 +00:00
2017-05-16 12:53:28 +00:00
set ProjectName=dtrenderer
2017-05-02 16:04:12 +00:00
ctime -begin ..\src\%ProjectName%.ctm
IF NOT EXIST ..\bin mkdir ..\bin
pushd ..\bin
REM ////////////////////////////////////////////////////////////////////////////
REM Compile Switches
REM ////////////////////////////////////////////////////////////////////////////
REM EHa- disable exception handling (currently it's on /EHsc since libraries need)
2017-05-02 16:04:12 +00:00
REM GR- disable c runtime type information (we don't use)
REM MD use dynamic runtime library
REM MT use static runtime library, so build and link it into exe
REM Od disables optimisations
REM Oi enable intrinsics optimisation, let us use CPU intrinsics if there is one
REM instead of generating a call to external library (i.e. CRT).
REM Zi enables debug data, Z7 combines the debug files into one.
REM W4 warning level 4
REM WX treat warnings as errors
REM wd4100 unused argument parameters
REM wd4201 nonstandard extension used: nameless struct/union
REM wd4189 local variable is initialised but not referenced
REM wd4505 unreferenced local function not used will be removed
2017-06-07 15:18:55 +00:00
set CompileFlags=-EHsc -GR- -Oi -MT -Z7 -W4 -wd4100 -wd4201 -wd4189 -wd4505 -Od -FAsc /I..\src\external\
2017-05-08 12:59:44 +00:00
set DLLFlags=/Fm%ProjectName% /Fo%ProjectName% /Fa%ProjectName% /Fe%ProjectName%
2017-05-16 12:53:28 +00:00
set Win32Flags=/FmWin32DTRenderer /FeWin32DTRenderer
2017-05-10 08:48:27 +00:00
REM Clean time necessary for hours <10, which produces H:MM:SS.SS where the
REM first character of time is an empty space. CleanTime will pad a 0 if
REM necessary.
set CleanTime=%time: =0%
set TimeStamp=%date:~10,4%%date:~7,2%%date:~4,2%_%CleanTime:~0,2%%CleanTime:~3,2%%CleanTime:~6,2%
2017-05-02 16:04:12 +00:00
REM Link libraries
set LinkLibraries=user32.lib kernel32.lib gdi32.lib
REM incremental:no, turn incremental builds off
REM opt:ref, try to remove functions from libs that are not referenced at all
set LinkFlags=-incremental:no -opt:ref -subsystem:WINDOWS -machine:x64 -nologo
REM ////////////////////////////////////////////////////////////////////////////
REM Compile
REM ////////////////////////////////////////////////////////////////////////////
2017-05-08 12:59:44 +00:00
del *.pdb >NUL 2>NUL
2017-05-16 12:53:28 +00:00
cl %CompileFlags% %Win32Flags% ..\src\Win32DTRenderer.cpp /link %LinkLibraries% %LinkFlags%
REM cl %CompileFlags% %DLLFlags% ..\src\UnityBuild\UnityBuild.cpp /LD /link ..\src\external\easy\easy_profiler.lib /PDB:%ProjectName%_%TimeStamp%.pdb /export:DTR_Update %LinkFlags%
cl %CompileFlags% %DLLFlags% ..\src\UnityBuild\UnityBuild.cpp /LD /link /PDB:%ProjectName%_%TimeStamp%.pdb /export:DTR_Update %LinkFlags%
2017-05-16 12:53:28 +00:00
2017-05-02 16:04:12 +00:00
popd
set LastError=%ERRORLEVEL%
ctime -end %ProjectName%.ctm %LastError%
:end
exit /b %LastError%