The Build Template Configuration tab enables you to customize the setup of your C++ project output made by the I_Projectbuilder Project Builder sub-editor. These templates consist of simple Groovy printouts for the basic CMake structure and some C++ code for your project.

This article guides you on how to export the default templates of the Project Builder and how to edit them, or even add your own, to extend the Project Builder's output to better suit your needs. For more detailed information on handling the content of the templates and their output, we recommend you research the topics of CMake and Groovy StreamingTemplateEngine through external resources.

How to Configure the Build Templates

Begin by navigating to the Build Template Configuration tab in the Project Builder sub-editor.

At the top of this tab there is a check box indicating whether to use your exported templates for your C++ project rather than the default templates, named Use external templates. Activate this check box.

Beneath the checkbox, fill out the Templates local folder field with the path to where you want your templates to be created, and then click Export templates to local folder.

Open the specified [Templates local folder] in your file explorer, and you'll find a collection of TPL files. These are your templates, which you can now open and edit in a text editor of your choice. See the Default output Structure and default variables chapter at the end of this article for referencing each template's output file in your C++ project, and the availability of the default variables.

notice

It is important that you do not change the file names of the default templates, and make sure they remain in the path specified in the Templates local folder, as this is where the Project Builder will read them from.

In the table labeled List of templates to be used for generation and their corresponding result location, you find a list of which templates are to be included for your project when the Build C++ Project button is used later on, what file each will create upon building, and where in your C++ project structure it will end up.

If you wish to create additional templates, simply use the file explorer to navigate to your template folder and create a new TPL file, use the Load templates from folder button to update your list, and then decide its output file type and location in the Result Location column.

As you can see from the default value of the provided templates, in the Result Location column you can use a set of variables to dynamically set up the result location of your template's output. These refer to the different folders set in the C++ Project Setup tab, and are as follows:

From Define the different parts of the C++ project
${INTEGR_PROJECT} - The Integration project.
${APPLIC_PROJECT} - The Application projects. With this variable, one result will be created for each existing application project.
${EXECUTABLE} - The Executable. With this variable, one result will be created for each existing Executable.

From Application Project predefined folders
${SOURCE}
${INCLUDE}
${CONFIG}

Beyond using these directory variables, any path you type in will be created in your C++ project.

At the bottom of the Build Template Configuration tab, there is a table to specify your custom variables to be used freely in the templates. Click I_Add Add Value to create a new key-value pair, and give it a name and a value. After it has been created, you can insert it wherever you see fit in the templates and it will be added to the output when building your C++ project using the external templates.

Default Output Structure and Default Variables

Below you'll see the structure of a typical output of the Project Builder, with the default template file name added to their corresponding result file, as well as the Result Location variables added to their corresponding folder. This might be helpful as a reference when extending the default structure.

IntegrationProject [1..1] ${INTEGR_PROJECT}

Etc ${INTEGR_PROJECT}/${CONFIG}

Someipd

Someipd-posix.json [AdcProjBuilderSomeipPosixConfigTemplate.tpl]

CMakeLists.txt [AdcProjBuilderIntegrProjMainCmakeListTemplate.tpl]

LocalPaths.cmake [AdcProjBuilderIntegrProjLocalPathsCmakeTemplate.tpl]

ApplicationProject[1..*] ${APPLIC_PROJECT}

Etc ${APPLIC_PROJECT}/${CONFIG}

Include ${APPLIC_PROJECT}/${INCLUDE}

Src ${APPLIC_PROJECT}/${SOURCE}

Executable[1..*] ${EXECUTABLE}

CMakeLists.txt [AdcProjBuilderApplicProjExecTargetCmakeTemplate.tpl]

Main.cpp [MainCppTemplate.tpl]

CMakeLists.txt [AdcProjBuilderApplicProjMainCmakeListTemplate.tpl]

Below is a list of the default variables the Project Builder sub-editor already offers through its standard interface:

notice

Due to their dynamic nature, some of the default variables can only be used in templates, which output file is pointing to specific sections of the resulting Project Builder structure.

For example, the ExecutableName variable needs to be placed in a template that produces a file inside of the result location ${EXECUTABLE}. See Allowed usage column for reference.

Variables created by the user in the Define additional template input variables table does not have any restriction and can be used in any template regardless of its output location.

Variable Name

Variable Type

Description

Allowed Usage

CmakeMinimumRequiredVersion

String

The minimum version of CMake required to run this project correctly

No restriction

ProjectName

String

Name of the project

No restriction

ProjectDescription

String

A description for your project

No restriction

MachineShortName

String

Short name of the machine the application is set to run on

No restriction

AdpSrcGenRoot

String

To the src-gen folder, where generation results from the model are placed

No restriction

PlfSdkRoot

String

To the platform SDK, the install folder resulting from building the BSW package (headers, libs, and model dependent source code (needs a model to generate code))

No restriction

DeployPackageRoot

String

To where deployment package will end up

No restriction

ToolChainFilePath

String

To where architecture, compiler and various options are defined

No restriction

ListOfExecutableNames

List

List of Executables included in an Application Project

No restriction

CompanyName

String

Name of the company

No restriction

ListOfApplicationProjectsHandledInIntegrationProject

List<String>

List of Application Projects included in an Integration Project

Integration Project

PlfRuntimeRoot

String

Path to the platform runtime, the install folder resulting from building the SIP (model-independent daemons)

Integration Project

InstallExecutionManager

boolean

True/false value indicating whether Execution Manager shall be installed or not

Integration Project

CStandard

String

The version of C to be used in this project

Integration Project

CppStandard

String

The version of C++ to be used in this project

Integration Project

SomeipDaemonExecutableName

String

Name of the Some/IP Daemon Executable

Integration Project

ExecutableName

String

Name of the Executable

Executable

ListOfAmsrComponentsForExecutableFindPackage

List<String>

List of MICROSAR Adaptive components specified in the table for Executable properties

Executable

ListOfAmsrComponentsForExecutableTarget

List<String>

List of MICROSAR Adaptive components specified in the table for Executable properties

Executable