Automating a build of Windows CE starts with answering the question "How do I set up a command line build?"  Of course there are ways to do this that require human intervention, but that doesn't automate very well.  There are ways to write code to use Platform Builder itself, but I only know a couple of engineers who have tried that, and they have struggled.
 
 
The following is a little batch file that will setup a Platform Builder 5.0 build environment and build the project:
 
@ECHO on
set __PROJECTNAME__=MyWorkspace
set __PLATFORMNAME__=MyBSP
set _WINCEROOT=C:\WINCE500
set PBWORKSPACEROOT=%_WINCEROOT%\PBWorkspaces\%__PROJECTNAME__%
REM Added _PROJECTROOT to get wince.bat to set the paths correctly
set _PROJECTROOT=%PBWORKSPACEROOT%\WINCE500\%__PLATFORMNAME__%_ARMV4I
REM Set up some variables to shorten the lines that follow
set PBWORKSPACE=%PBWORKSPACEROOT%\%__PROJECTNAME__%.pbxml
set WINCE_BAT=%_WINCEROOT%\Public\Common\Oak\misc\wince.bat
set PBXMLUTILS="C:\Program Files\Windows CE Platform Builder\5.00\CEPB\BIN\pbxmlutils.exe"
REM You could call %PBXMLUTILS% /listconfigs
REM and parse to find "release" to get the number from the file
REM this will build the first configuration found
set __CONFIG__=0
REM Run Wince.bat to set up the basic environment
call %WINCE_BAT% ARMV4I %__PROJECTNAME__% %__PLATFORMNAME__%
REM Now use PBXMLUtils to get the catalog variables
REM Could this be done differently, yes, but this captures all of the variables for future reference
%PBXMLUTILS% /config %__CONFIG__% /getbuildenv > %_WINCEROOT%\Build%__PROJECTNAME__%.bat
call %_WINCEROOT%\Build%__PROJECTNAME__%.bat
REM Do a clean build of the project
blddemo clean -q
 
With a few minor changes, this can be used for Windows CE 6.0:
 
 
@ECHO on
set __PROJECTNAME__=MyWorkspace
set __PLATFORMNAME__=MyBSP
set CPU=ARMV4I
set _WINCEROOT=C:\WINCE600
set PBWORKSPACEROOT=%_WINCEROOT%\OSDesigns\%__PROJECTNAME__%
REM Added _PROJECTROOT to get wince.bat to set the paths correctly
set _PROJECTROOT=%PBWORKSPACEROOT%\WINCE600\%__PLATFORMNAME__%_%CPU%
REM Set up some variables to shorten the lines that follow
set PBWORKSPACE=%PBWORKSPACEROOT%\%__PROJECTNAME__%.pbxml
set WINCE_BAT=%_WINCEROOT%\Public\Common\Oak\misc\wince.bat
set PBXMLUTILS="C:\Program Files\Microsoft Platform Builder\6.00\cepb\IdeVS\pbxmlutils.exe"
REM You could call %PBXMLUTILS% /listconfigs
REM and parse to find "release" to get the number from the file
REM this will build the first configuration found
set __CONFIG__=0
REM Run Wince.bat to set up the basic environment
call %WINCE_BAT% %CPU% %__PROJECTNAME__% %__PLATFORMNAME__%
REM Now use PBXMLUtils to get the catalog variables
REM Could this be done differently, yes, but this captures all of the variables for future reference
%PBXMLUTILS% /config %__CONFIG__% /getbuildenv > %_WINCEROOT%\Build%__PROJECTNAME__%.bat
call %_WINCEROOT%\Build%__PROJECTNAME__%.bat
REM Do a clean build of the project
blddemo clean -q
 
Copyright © 2008 – Bruce Eitman
All Rights Reserved