AnsweredAssumed Answered

Building projects from the command line

Question asked by LPCware Support on Mar 31, 2016

LPCXpresso IDE supports options to control building projects from the command line, enabling a build process to be automated. To perform a command line build, the following steps will need to be followed:

 

  • Open a command prompt window
  • Set up paths so that the compiler etc. can be found by the tools. The following directories must be added to the path:
    • (install)\lpcxpresso\bin
    • (install)\lpcxpresso\tools\bin
    • on Windows only (install)\lpcxpresso\msys\bin
  • Launch the lpcxpresso product with the following options. Additional options are listed at the end of this FAQ
    • On Windows only, the command line name of the product is lpcxpressoc
    • On Mac or Linux, the command line name of the product is lpcxpresso

lpcxpresso(c) -nosplash
        -application org.eclipse.cdt.managedbuilder.core.headlessbuild
        -data \path\to\workspace
        -import {[uri:/]/path\to\project}
        -build {project_name[/build_config] | all}
        -cleanBuild {project_name[/build_config] | all}

Examples


To clean and build all projects that currently exist in the workspace C:\workspace\product, use the following command:

 

lpcxpressoc -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -build all -data c:\workspace\product

 

Note: This will build every build configuration (e.g. Debug and Release).

 

To following command will clean and build the Release configuration of my_project:

 

lpcxpressoc -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -cleanBuild my_project/Release -data c:\workspace\product

 

Notes:

  • The '-application' switch instructs LPCXpresso to run the headless builder rather than starting the workbench. The other switches can be used individually or together. This means you can checkout a project using a script of your own, '-import' it into a workspace, and '-build' it using the headless builder
  • Use the '-data' switch to specify the workspace to use, which can be an empty temporary directory
  • -import {[uri:/]\path\to\project}
    • import a project from another location into the workspace before building. Path can be local file system, or a URI
    • can be specified multiple times, to import multiple projects
  • -build {project_name[/build_config] | all}
    • build the project
    • select which build configuration to use by by specifying /build_config immediately after the project_name (i.e. no spaces)
  • -cleanBuild {project_name_reg_ex[/build_configreg_ex] | all}
    • clean and build the project
    • project_name_reg_ex is a regular expression that matches the projects you wish to build. ".*" is a regular expression that matches every project name
    • config_reg_ex is a regular expression for the build configurations you wish to build. If you wanted to build both Debug and Release, you would use "(Debug|Release)"
  • The output from the build process will appear on the console, and can be redirected

Options


The following options are also supported.

Note: options are case sensitive

* Import projects :                       -import     {[uri:/]/path/to/project}
* Import all projects in the tree :       -importAll  {[uri:/]/path/to/projectTreeURI}
* Build projects / the workspace :        -build      {project_name_reg_ex/config_name_reg_ex | all}
* Clean build projects / the workspace :  -cleanBuild {project_name_reg_ex/config_name_reg_ex | all}
* Add Include path to build :             -I          {include_path}
* Add Include file to build :             -include    {include_file}
* Add preprocessor define to build :      -D          {prepoc_define}
* Replace environment variable in build : -E          {var=value}
* Append environment variable to build :  -Ea         {var=value}
* Prepend environment variable to build : -Ep         {var=value}
* Remove environment variable in build :  -Er         {var}
* Replace a tool option value :           -T          {toolid} {optionid=value}
* Append to a tool option value :         -Ta         {toolid} {optionid=value}
* Prepend to a tool option value :        -Tp         {toolid} {optionid=value}
* Remove a tool option :                  -Tr         {toolid} {optionid=value}

* Suppress Java popup on build error :    --launcher.suppressErrors

Outcomes