polyspace.project.BuildConfiguration Class
R2026bNamespace: polyspace.project
(Python) External build configurations that can be associated with multiple projects
Since R2026a
Description
The properties of the polyspace.project.BuildConfiguration class contain
build-related configuration options that are saved separately from a Polyspace® Platform project in an external configuration file. External configuration files
can be saved in the native format (.pscfg) or in a human-readable TOML format (.toml.pscfg). Saving
your build configurations in external files and referencing those files from one or more
projects enables you to create a modular project structure that improves sharing and version
control workflows.
To work with external build configurations, use this class, which contains the build
configuration, together with the polyspace.project.BuildConfigurationRef class, which contains the name of the
external build configuration and the path to the file where it is saved. The properties of
this class correspond to the build options listed in Polyspace Test
options, Polyspace Bug Finder
options (Polyspace Bug Finder), and Polyspace Code Prover
options (Polyspace Code Prover).
To create and manage build configurations that are owned by a specific project, use the
polyspace.project.OwnedBuildConfiguration class.
Creation
Description
externalConfig = myBuildConfigurationRefObj.get() returns the
polyspace.project.BuildConfiguration object referenced by the
polyspace.project.BuildConfigurationRef object
myBuildConfigurationRefObj. For more information on managing external
configurations referenced by the project, see polyspace.project.BuildConfigurationRef.
Properties
Relative or absolute path to the .pscfg or
.toml.pscfg configuration file where the external build
configuration is saved. This file is referenced by the project and managed using the
polyspace.project.BuildConfigurationRef class. Relative paths are considered
relative to the location of the .psprjx project file. This property
is read-only.
Example: "configs/myBuildConfig.pscfg"
Optional description of the build configuration. Use this property to provide information about the build configuration.
Example: "My build configuration"
Specify that your compiler implements right shifts on signed integers as arithmetic shifts.
See also Shift right
on signed integers as arithmetic shift
(-logical-signed-right-shift) (Polyspace Bug Finder).
Example: buildConf.ArithmeticSignedIntegerRightShift=False
Specify the name of the target board Polyspace Test™ uses to run the test executable.
See also Target
board name (Testing).
Example: buildConf.Board="myBoard"
Specify C standard version followed in code, as a
buildConf.CVersion value.
See also C
standard version (-c-version).
Example: buildConf.CVersion=buildConf.CVersion.C_17
Specify C++ standard version followed in code, as a
buildConf.CppVersion value.
See also C++
standard version (-cpp-version)
Example: buildConf.CppVersion=buildConf.CppVersion.CPP_17
Emulate your compiler behavior by replacing macros with their definitions in
preprocessed code. Specify the macro definition as
macroName=macroDefinition. To ignore a macro, set it equal to
blank (macroName=). To replace a macro by 1, specify only
macroName.
To modify this property, use these methods:
append(— Add a macro definition.macroDefinition)pop(— Remove the macro definition with indexmacroDefinitionIdx)macroDefinitionIdx. If you do not specify an index, the last item in the list is removed.clear()— Remove all macro definitions.
See also Preprocessor definitions (-D).
Example: buildConf.Defines.append("uint32=int")
Example: buildConf.Defines.append("NDEBUG")
Example: buildConf.Defines.pop(0)
This property behaves like a Python® sequence. The Python API for Polyspace supports most standard operations on Python sequences. See Supported Operations on Sequences.
Enable or disable the compilation of code on your host machine while retaining the word sizes of target processor on which the code is intended to run.
See also Enable
portable word sizes.
Example: buildConf.EnablePortableWordSizes=True
Specify paths of headers and precompiled libraries for tests that you import from an external framework such as GoogleTest.
Specify path of folders where Polyspace Test looks for headers files included in external tests.
To modify this property, use these methods:
add(— Add an include path.folderPath)pop(— Remove the include path with indexfolderPathIdx)folderPathIdx. If you do not specify an index, the last item in the list is removed.clear()— Remove all macro definitions.
See also Include paths for external tests.
Example: buildConf.ExternalTestsBuildOptions.IncludePaths.add("/usr/lib/import")
Example: buildConf.ExternalTestsBuildOptions.IncludePaths.pop(0)
Specify the name of the precompile objects, static libraries, or dynamic libraries that Polyspace Test links with your source files and test code to build test executables for external tests.
To modify this property, use these methods:
append(— Add a value to this property.libraryName)pop(— Remove the value with indexlibraryNameIdx)libraryNameIdx. If you do not specify an index, the last item in the list is removed.clear()— Remove all values associated with this property.
See also Libraries for external tests.
Example: buildConf.ExternalTestsBuildOptions.Libraries.append("libgtest.a")
Example: buildConf.ExternalTestsBuildOptions.Libraries.pop(0)
This property behaves like a Python sequence. The Python API for Polyspace supports most standard operations on Python sequences. See Supported Operations on Sequences.
Specify the path of the folders where Polyspace Test looks for
precompiled objects, static libraries, or dynamic libraries that you
specify with
buildConf.ExternalTestsBuildOptions.Libraries.
To modify this property, use these methods:
append(— Add a value to this property.folderPath)pop(— Remove the value with indexfolderPathIdx)folderPathIdx. If you do not specify an index, the last item in the list is removed.clear()— Remove all values associated with this property.
See also Library paths for external tests.
Example: buildConf.ExternalTestsBuildOptions.LibraryPaths.append("/usr/local/googletest/build/lib/")
Example: buildConf.ExternalTestsBuildOptions.LibraryPaths.pop(0)
This property behaves like a Python sequence. The Python API for Polyspace supports most standard operations on Python sequences. See Supported Operations on Sequences.
Specify additional C compilation flags that your compiler needs to build your C code project correctly. Use this option for flags that you cannot specify through other options.
See also Extra C
flags.
Example: buildConf.ExtraCFlags="-ffast-math"
Specify additional C++ compilation flags that your compiler needs to build your C++ code project correctly. Use this option for flags that you cannot specify through other options.
See also Extra
C++ flags.
Example: buildConf.ExtraCppFlags="-fno-rtti"
Specify additional linker flags that your compiler needs to build your C or C++ code project correctly. Use this option for flags that you cannot specify through other options.
See also Extra
flags for linking.
Example: buildConf.ExtraLinkFlags="-pthread"
Specify build options that you want to associate with a specific file without applying those options to other files in your project.
Use add( to associate file
filePath)filePath with a
polyspace.project.FileBuildOptions object or
addChecked( to add
the file only if filePath)filePath has already been declared in
the project. To remove the polyspace.project.FileBuildOptions
object associated with filePath, use
pop(. To remove all
filePath)polyspace.project.FileBuildOptions objects, use
clear().
To change the properties of an existing
polyspace.project.FileBuildOptions object, use square
brackets to select the corresponding source file. For example,
buildConf.FileOverrides[".filePath"]
The polyspace.project.FileBuildOptions object stores these
file-specific options:
CVersionCppVersionDefinesExtraFlagsImplicitCompilerDefinesImplicitCompilerIncludePathsIncludePathsLanguagePreIncludesUndefines
The Defines, Undefines,
ImplicitCompilerDefines, and PreIncludes
properties behave like Python sequences. The Python API for Polyspace supports most standard operations on Python sequences. See Supported Operations on Sequences.
See also -options-for-sources (Polyspace Bug Finder).
Example: buildConf.FileOverrides.add("filePath")
Example: buildConf.FileOverrides["filePath"].Language=polyspace.project.FileLanguage.CPP
Example: buildConf.FileOverrides["filePath"].CppVersion=buildConf.CppVersion.CPP_17
Example: buildConf.FileOverrides.pop("filePath")
Specify the path of folders where Polyspace Test looks for files that are included by your source and test code. You can specify the absolute path or the path relative to the current folder.
To modify this property, use these methods:
add(— Add a folder path.folderPath)pop(— Remove the folder path with indexfolderPathIdx)folderPathIdx. If you do not specify an index, the last folder path in the list is removed.clear()— Remove all folder paths associated with this property.
See also Include
paths (-I).
Example: buildConf.IncludePaths.add("/usr/local/polyspace/pstunit")
Example: buildConf.IncludePaths.pop(0)
Specify how your compiler rounds down the results of a negative integer division
if your compiler follows the C90 Standard. By default, the quotient is rounded
toward zero, or the smallest integer greater than or equal to the algebraic
quotient. For example, -5/3 = -1. Specify
Floor to round the quotient to the largest integer less than
or equal to the algebraic quotient. For example, -5/3 =
-2.
See also Round down
results of negative integer division (-div-round-down) (Polyspace Bug Finder).
Example: buildConf.IntegerDivisionRounding=buildConf.IntegerDivisionRounding.Floor
Specify the language of your source files. Polyspace Test uses the language conventions of the language that you specify. Some options are available only if you select C as the language, and some options are available only if you select C++ as the language.
Select C_CPP if your project contains both C and C++ files. In
this case, Polyspace interprets .c files as C code and other file
extensions as C++ code.
See also Source code language
(-lang).
Example: buildConf.Language=buildConf.Language.C_CPP
Specify the name of the precompile objects, static libraries, or dynamic libraries that Polyspace Test links with your source files and test code to build test executables.
To modify this property, use these methods:
append(— Add a value to this property.libraryName)pop(— Remove the value with indexlibraryNameIdx)libraryNameIdx. If you do not specify an index, the last value in the list is removed.clear()— Remove all values associated with this property.
See also Libraries.
Example: buildConf.Libraries.append("mylib.so")
Example: buildConf.Libraries.pop(0)
This property behaves like a Python sequence. The Python API for Polyspace supports most standard operations on Python sequences. See Supported Operations on Sequences.
Specify the path of the folders where Polyspace Test looks for precompiled
objects, static libraries, or dynamic libraries that you specify with
buildConf.Libraries.
To modify this property, use these methods:
append(— Add a folder path.folderPath)pop(— Remove the folder path with indexfolderPathIdx)folderPathIdx. If you do not specify an index, the last folder path in the list is removed.clear()— Remove all folder paths associated with this property.
See also Library
paths.
Example: buildConf.LibraryPaths.append("/usr/local/build/lib/")
Example: buildConf.LibraryPaths.pop(0)
This property behaves like a Python sequence. The Python API for Polyspace supports most standard operations on Python sequences. See Supported Operations on Sequences.
Specify the default packing alignment, in bytes, for structures, unions, and class members.
Example: buildConf.PackAlignmentValue=buildConf.PackAlignmentValue.SIZE_4_B
Specify files to be included by every source file. Specifying this property does not modify the original source files. For example, set this property to define types that are not defined in your code.
To modify this property, use these methods:
append(— Add a file path.filePath)pop(— Remove the file path with indexfilePathIdx)filePathIdx. If you do not specify an index, the last file path in the list is removed.clear()— Remove all file paths associated with this property.
See also Forced
includes (-include).
Example: buildConf.PreIncludes.append("/usr/lib/types/mytypes.h")
Example: buildConf.PreIncludes.pop(0)
This property behaves like a Python sequence. The Python API for Polyspace supports most standard operations on Python sequences. See Supported Operations on Sequences.
Select or manage the processor for the current build configuration, returned as a
polyspace.project.Processor object. To view a list of available
processors for a project proj, type
proj.Processors.
Note that if you set the Board property to the name of a
previously registered hardware board (that is, a value other than
"None" or "Host Computer"), the
Processor property is set to the processor associated with
the board. For an example of setting a hardware board, see Add Target and Build Tests on Target.
See also Processor.
Example: buildConf.Processor=proj.Processors[2]
Size of special function registers (sfr) data types, specified in bits as
typename=sizeInBits.
To modify this property, use these methods:
append(— Add a value to this property.typename=sizeInBits)pop(— Remove the value with indextypenameIdx)typenameIdx. If you do not specify an index, the last value in the list is removed.clear()— Remove all values associated with this property.
See also Sfr type support
(-sfr-types) (Polyspace Bug Finder)
Example: buildConf.SfrTypes.append("sfr32=32")
Example: buildConf.SfrTypes.pop(0)
This property behaves like a Python sequence. The Python API for Polyspace supports most standard operations on Python sequences. See Supported Operations on Sequences.
Name of compiler that Polyspace uses to build your source code for static analysis
(Bug Finder or Code Prover analysis). For a list of available compilers, see
Compilation
toolchain (Static Analysis) (Polyspace Bug Finder).
The default value is "Same as testing toolchain". With this
setting, the compiler and target values for static analysis are automatically
determined from the testing toolchain that you select. For more information, see
Selecting Common Toolchain for Static Analysis and Testing (Polyspace Bug Finder).
When you set this property, the property
StaticAnalysisTargetName might change as follows:
If you set a built-in compiler (such as
"gnu9.x"or"visual17.x") or reset to the default value,"Same as testing toolchain", any previous value of theStaticAnalysisTargetNameproperty is cleared.In this case, the
Processorproperty determines the target characteristics used for static analysis.If you change from one cross-compiler to another (such as, from
"diab"to"renesas") and theStaticAnalysisTargetNameproperty has a value that is not supported for the new compiler, it is automatically set to a supported target.If you set an invalid compiler name, a
ValueErroris raised.
For more information on static analysis compilers and targets, see Compilation
toolchain for static analysis (-compiler, -compiler -target) (Polyspace Bug Finder) and
Processor
(-custom-target) (Polyspace Bug Finder).
Example: buildConf.StaticAnalysisCompilerName="Same as testing
toolchain"
Example: buildConf.StaticAnalysisCompilerName="gnu9.x"
Example: buildConf.StaticAnalysisCompilerName="renesas"
Name of processor target whose fundamental data type sizes Polyspace uses to build
your source code for static analysis (Bug Finder and Code Prover). For a list of
available targets, see Target processor type
(-target) (Polyspace Bug Finder).
This property is set to None unless the static analysis
compiler StaticAnalysisCompilerName is a cross-compiler (for
example, for built-in compilers such as "gnu9.x" or when it is
reset to the default "Same as testing toolchain"). In this case,
the Processor property determines the target characteristics used
for static analysis.
When you set this property and a cross-compiler is specified for the property
StaticAnalysisCompilerName, it might change as follows:
If you set a target that is supported by the current cross-compiler in
StaticAnalysisCompilerName, the compiler is unchanged.If you set a target that is not supported by the current cross-compiler, the
StaticAnalysisCompilerNameproperty is automatically updated to the first available compiler that supports that target.If you set this property to
Nonewhile a cross-compiler is selected, theStaticAnalysisCompilerNameproperty is reset to"Same as testing toolchain".If you set an invalid target name, a
ValueErroris raised.
For more information on static analysis compilers and targets, see Compilation
toolchain for static analysis (-compiler, -compiler -target) (Polyspace Bug Finder) and
Processor
(-custom-target) (Polyspace Bug Finder).
Example: buildConf.StaticAnalysisTargetName="rh850"
Example: buildConf.StaticAnalysisTargetName=None
Toolchain configuration for dynamic testing, returned as a polyspace.project.ProjectToolchain object. This object stores the
toolchain name, version, and toolchain-specific configuration variables. By default,
Polyspace automatically detects an installed toolchain.
To change the toolchain, assign a toolchain name string to this property. If the specified name is different from the current toolchain, all toolchain settings are reset to their defaults.
See also Compilation toolchain (Testing).
Example: buildConf.Toolchain="GNU gcc/g++ | CMake/Ninja (64-bit
Linux)"
Emulate your compiler behavior by declaring macros as undefined in preprocessed code.
To modify this property, use these methods:
append(— Add a macro to this property.macroName)pop(— Remove the macro with indexmacroNameIdx)macroNameIdx. If you do not specify an index, the last macro in the list is removed.clear()— Remove all macros associated with this property.
This property has no effect on macros that you define using a
#define preprocessor directive.
See also Disabled preprocessor definitions
(-U).
Example: buildConf.Undefines.append("_WIN32")
Example: buildConf.Undefines.pop(0)
This property behaves like a Python sequence. The Python API for Polyspace supports most standard operations on Python sequences. See Supported Operations on Sequences.
Methods
save() | Save changes to the referenced native-format configuration file
( Example:
|
saveCopy() |
In R2026b: Save a copy of
the external build configuration file with a new name or in a new location,
specified by the Input Arguments
Examples:
|
close() | Close the referenced external build configuration and unload it from memory. The object, methods, and properties become stale after you unload the external configuration. Example:
|
Version History
Introduced in R2026aStarting in R2026b, Polyspace products support saving external configuration files in a new human-readable
TOML format (.toml.pscfg).
Use the optional FileFormat argument of the saveCopy
method to specify whether to use the TOML full, TOML concise, or native file format when
saving a copy of a configuration. Alternatively, include the appropriate file extension when
specifying the filename.
See Also
polyspace.test.run | polyspace.test.build | polyspace.project.Project | polyspace.project.BuildConfigurationRef | polyspace.project.OwnedBuildConfiguration | polyspace.project.StaticAnalysisConfiguration | polyspace.project.TestConfiguration | polyspace.test.TestResults
Topics
- Get Started with Python API for Polyspace
- Create Easily Shareable Projects for Version Control
- Share and Reuse Configuration Variants
- Create TOML Configuration Files from Templates
- Modularize Project by Using External Configurations, Test References, and External Stub Files
- Modularize Existing Project by Using Polyspace Python API
- Create Project Dynamically by Using Polyspace Python API
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)