build.bat
author Matt Plumtree <matt.plumtree@nokia.com>
Wed, 10 Nov 2010 15:26:31 +0000
branchbug235_bringup_0
changeset 75 82d8da1d79c7
parent 72 fd0a704154b9
permissions -rw-r--r--
Move increment of EGL state reference count to where new threads are discovered for simulator version, to balance releaseState in eglReleaseThread.

@echo off

rem DOS batch file for building host-side libraries

if '%EPOCROOT%'=='' goto PRINTUSAGE

rem Set default values
set SIMULATOR_EXTENSIONS=ON
set TOOLCHAIN_VARIANT=vs2005
set CMAKE_BUILD_TARGET=Release
set VISUAL_STUDIO_SOLUTION=OFF
set BUILD=ON
set CLEANBUILD=OFF
set EPOCROOTX=%EPOCROOT:\=/%

:PARSECOMMANDLINE
IF '%1'=='/h' goto PRINTUSAGE
IF '%1'=='/H' goto PRINTUSAGE
IF '%1'=='/?' goto PRINTUSAGE
IF '%1'=='/nosimext' goto DISABLE_SIMULATOR_EXTENSIONS
IF '%1'=='/NOSIMEXT' goto DISABLE_SIMULATOR_EXTENSIONS
IF '%1'=='/vs' goto SETVISUALSTUDIOVERSION
IF '%1'=='/VS' goto SETVISUALSTUDIOVERSION
IF '%1'=='/solution' goto ENABLESOLUTION
IF '%1'=='/SOLUTION' goto ENABLESOLUTION
IF '%1'=='/debug' goto ENABLEDEBUG
IF '%1'=='/DEBUG' goto ENABLEDEBUG
IF '%1'=='/nobuild' goto DISABLEBUILD
IF '%1'=='/NOBUILD' goto DISABLEBUILD
IF '%1'=='/clean' goto CLEANBUILD
IF '%1'=='/CLEAN' goto CLEANBUILD

if "%VISUAL_STUDIO_SOLUTION%"=="ON" (
	set GENERATOR=Visual Studio 8 2005
	if '%TOOLCHAIN_VARIANT%'=='vs2008' set GENERATOR=Visual Studio 9 2008
) else (
	set GENERATOR=NMake Makefiles
)

rem Print out options
echo.
echo SIMULATOR_EXTENSIONS = %SIMULATOR_EXTENSIONS%
echo TOOLCHAIN_VARIANT    = %TOOLCHAIN_VARIANT%
echo GENERATOR            = %GENERATOR%
echo CMAKE_BUILD_TARGET   = %CMAKE_BUILD_TARGET%
echo BUILD                = %BUILD%
echo CLEANBUILD           = %CLEANBUILD%
echo EPOCROOT (modified)  = %EPOCROOTX%
echo.

rem Execute
echo on
if '%CLEANBUILD%'=='ON' rmdir /s /q build
if '%CLEANBUILD%'=='ON' mkdir build
cd build
cmake -DEPOCROOT=%EPOCROOTX% -DSIMULATOR_EXTENSIONS:Bool=%SIMULATOR_EXTENSIONS% -DTOOLCHAIN_VARIANT:String=%TOOLCHAIN_VARIANT% -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TARGET% -G "%GENERATOR%" ..
@echo off
if "%BUILD%"=="ON" (
if "%GENERATOR%"=="NMake Makefiles" (
	echo on
	nmake
	@echo off
)
)
@echo off
cd ..

goto END

:PRINTUSAGE
echo Usage: build.bat [options]
echo Options:"
echo     [/H,/?]             print this message and exit
echo     [/VS VERSION]       set Visual Studio version
echo                         supported versions = 2005, 2008 (default: 2005)
echo     [/SOLUTION]         just generate VIsual Studio solution files
echo                             (default: generate NMake makefiles and build)
echo     [/DEBUG]            configure for debug build (default: release)
echo     [/NOBUILD]          call cmake but do not call nmake
echo                             note: has no effect if /SOLUTION is specified
echo     [/CLEAN]            perform a clean build by deleting the ./build directory.
echo.
echo Note: EPOCROOT must be defined to be the directory containing the epoc32 tree.
goto END

:DISABLE_SIMULATOR_EXTENSIONS
set SIMULATOR_EXTENSIONS=OFF
shift
goto PARSECOMMANDLINE

:SETVISUALSTUDIOVERSION
set TOOLCHAIN_VARIANT=vs%2
shift
shift
goto PARSECOMMANDLINE

:ENABLESOLUTION
set VISUAL_STUDIO_SOLUTION=ON
shift
goto PARSECOMMANDLINE

:ENABLEDEBUG
set CMAKE_BUILD_TARGET=Debug
shift
goto PARSECOMMANDLINE

:DISABLEBUILD
set BUILD=OFF
shift
goto PARSECOMMANDLINE

:CLEANBUILD
set CLEANBUILD=ON
shift
goto PARSECOMMANDLINE

:END