CrossBuild is a program used to build your software from the command line without using CrossStudio. You can, for example, use CrossBuild for nightly (automated) builds, production builds, and batch builds.

Building with a CrossStudio project file

You can specify a CrossStudio project file:


crossbuild [options…] project-file

You must specify a configuration to build using -config. For instance:

crossbuild -config "V5T Thumb LE Release" arm.hzp 

The above example uses the configuration V5T Thumb LE Release to build all projects in the solution contained in arm.hzp.

To build a specific project that is in a solution, you can specify it using the -project option. For example:

crossbuild -config "V5T Thumb LE Release" -project "libm" libc.hzp 

This example will use the configuration V5T Thumb LE Release to build the project libm that is contained in libc.hzp.

If your project file imports other project files (using the <import…> mechanism), when denoting projects you must specify the solution names as a comma-separated list in parentheses after the project name:

crossbuild -config "V5T Thumb LE Release" -project "libc(C Library)" arm.hzp 

libc(C Library) specifies the libc project in the C Library solution that has been imported by the project file arm.hzp.

To build a specific solution that has been imported from other project files, you can use the -solution option. This option takes the solution names as a comma-separated list. For example:

crossbuild -config "ARM Debug" -solution "ARM Targets,EB55" arm.hzp 

In this example, ARM Targets,EB55 specifies the EB55 solution imported by the ARM Targets solution, which was itself imported by the project file arm.hzp.

You can do a batch build using the -batch option:

crossbuild -config "ARM Debug" -batch libc.hzp 

This will build the projects in libc.hzp that are marked for batch build in the configuration ARM Debug.

By default, a make-style build will be done—i.e., the dates of input files are checked against the dates of output files, and the build is avoided if the output is up to date. You can force a complete build by using the -rebuild option. Alternatively, to remove all output files, use the -clean option.

To see the commands being used in the build, use the -echo option. To also see why commands are being executed, use the -verbose option. You can see what commands will be executed, without executing them, by using the -show option.

Building without a CrossStudio project file

To use CrossBuild without a CrossStudio project, specify the name of an installed project template, the name of the project, and the files to build. For example:

crossbuild -config … -template LM3S_EXE -project myproject -file main.c 

Or, instead of a template, you can specify a project type:

crossbuild -config … -type "Library" -project myproject -file main.c 

You can specify project properties with the -property option:

crossbuild … -property Target=LM3S811 
Option Description
-batch batch build
-clean remove all output and intermediate files
-config 'name' (batch) build in 'name' configuration
-D 'name'='value' set global macro $('name') to 'value'
-echo show command lines as they are executed
-export-build show the command lines and dependencies
-file 'name' add file 'name' to template-created project
-help show help text
-keepgoing keep building when errors occur
-nostderr redirect output from stderr to stdout
-nounity disable unity building
-packagesdir 'name' set $(PackagesDir) to 'name'
-project 'name' (batch) build 'name' project
-property 'name'='value' set project property 'name' to 'value'
-rebuild always do the build steps
-sconfig 'name' solution properties are set in 'name' configuration
-show show the build steps but don't execute them
-solution 'name' (batch) build 'name' solution
-sproperty 'name'='value' set solution property 'name' to 'value'
-studiodir 'name' set $(StudioDir) to 'name'
-template 'name' create the project from the template 'name'
-templatesfile 'path' get project template files from 'path'
-threadnum 'n' use 'n' threads for build
-time show time taken
-type 'type' create the project from the project 'type'
-verbose show build information