Main Content

polyspace.project.OwnedBuildConfiguration Class

Namespace: polyspace.project

(Python) Build configurations attached to specific project

Since R2024a

Description

The properties of the polyspace.project.OwnedBuildConfiguration class contain the build-related configuration options attached to a specific Polyspace® Platform project. These properties 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 modular projects, where project components like configurations and graphical tests are saved in separate files, consider using external configurations. An external configuration is a build, static analysis, or testing and profiling configuration that is saved in a separate .pscfg file that is referenced by the project. To work with external build configurations in the Polyspace Python® API see polyspace.project.BuildConfigurationRef and polyspace.project.BuildConfiguration. For more information about project structure, see Modularize Project by Using External Configurations, Test References, and External Stub Files.

Creation

Description

Create Build Configuration

buildConfig = proj.BuildConfigurations.create(configName) creates a new polyspace.project.OwnedBuildConfiguration object with the Name property set to configName and all other properties set to their default values. The resulting buildConfig object is attached to the polyspace.project.Project object proj.

Load Build Configuration

buildConfig = proj.BuildConfigurations[configName] loads the existing polyspace.project.OwnedBuildConfiguration object with the Name property set to configName from the polyspace.project.Project object proj.

Create Copy of Build Configuration

buildConfig = proj.BuildConfigurations.createFrom(existingConfigObj) creates a new polyspace.project.OwnedBuildConfiguration object by copying an existing owned build configuration existingConfigObj and attaches this copied object to the polyspace.project.Project object proj. To assign a unique name to buildConfig, Polyspace uses the Name property of existingConfigObj and appends the next available numeric suffix.

buildConfig = proj.BuildConfigurations.createFrom(existingConfigObj, configName) creates a new polyspace.project.OwnedBuildConfiguration object by copying an existing owned build configuration existingConfigObj and attaches this copied object to the polyspace.project.Project object proj. Use the configName argument to set the Name property of the resulting object.

buildConfig = proj.BuildConfigurations.createFrom(existingConfigFile) creates a new polyspace.project.OwnedBuildConfiguration object by copying the build configuration defined in the file existingConfigFile, and attaches this object to the polyspace.project.Project object proj.

buildConfig = proj.BuildConfigurations.createFrom(existingConfigFile, configName) creates a new polyspace.project.OwnedBuildConfiguration object by copying the build configuration defined in the file existingConfigFile and attaches this object to the polyspace.project.Project object proj. Use the configName argument to set the Name property of the resulting object.

Convert Build Configuration

buildConfig = proj.BuildConfigurations.moveAsOwned(existingConfigRefObj) converts the build configuration that the project proj references through existingConfigRefObj to a polyspace.project.OwnedBuildConfiguration object and removes existingConfigRefObj from the project.

Input Arguments

expand all

Name of the build configuration, specified as a string. This argument sets the Name property of the object.

Example: "My Build Configuration"

Existing owned build configuration to make a copy of, specified as a polyspace.project.OwnedBuildConfiguration object.

Example: proj.BuildConfigurations[2]

Absolute or relative path to an existing .pscfg file, specified as a string. Relative paths are considered relative to the location of the .psprjx project file.

Example: "myBuildConfig.pscfg"

The existing referenced build configuration that you want to convert to a polyspace.project.OwnedBuildConfiguration object, specified as a polyspace.project.BuildConfigurationRef object.

Example: proj.BuildConfigurationRefs[0]

Properties

expand all

Name of the build configuration, specified as a string.

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(macroDefinition) — Add a macro definition.

  • pop(macroDefinitionIdx) — Remove the macro definition with index 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)

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(folderPath) — Add an include path.

  • pop(folderPathIdx) — Remove the include path with index 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(libraryName) — Add a value to this property.

  • pop(libraryNameIdx) — Remove the value with index 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)

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(folderPath) — Add a value to this property.

  • pop(folderPathIdx) — Remove the value with index 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)

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(filePath) to associate file filePath with a polyspace.project.FileBuildOptions object or addChecked(filePath) to add the file only if filePath has already been declared in the project. To remove the polyspace.project.FileBuildOptions object associated with filePath, use pop(filePath). To remove all 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:

  • CVersion

  • CppVersion

  • Defines

  • ExtraFlags

  • ImplicitCompilerDefines

  • ImplicitCompilerIncludePaths

  • IncludePaths

  • Language

  • PreIncludes

  • Undefines

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(folderPath) — Add a folder path.

  • pop(folderPathIdx) — Remove the folder path with index 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(libraryName) — Add a value to this property.

  • pop(libraryNameIdx) — Remove the value with index 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)

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(folderPath) — Add a folder path.

  • pop(folderPathIdx) — Remove the folder path with index 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)

Specify the default packing alignment, in bytes, for structures, unions, and class members.

See also Pack alignment value (-pack-alignment-value).

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(filePath) — Add a file path.

  • pop(filePathIdx) — Remove the file path with index 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)

Select or manage the processor for the current build configuration. 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.

You can view or modify these processor properties. Depending on the processor you select, you can modify only some properties.

See also Processor.

Example: buildConf.Processor=proj.Processors[2]

Processor properties

Maximum alignment of integer types.

Example: buildConf.Processor.Alignment=16

Size of char data type in bits.

Example: buildConf.Processor.CharBitsSize=8

Size of double data type in bits.

Example: buildConf.Processor.DoubleBitsSize=16

Byte ordering for custom processors. The byte ordering determines how multibyte data types are arranged in memory.

Example: buildConf.Processor.Endianess=buildConf.Processor.Endianess.Big

Underlying type for enum:

  • DEFINED_BY_COMPILER — Polyspace uses signed int as the underlying type of enums for all compilers except gnu, clang, and tasking.

    For the gnu and clang compilers, Polyspace uses the first type that can hold all of the enumerator values from this list: unsigned int, signed int, unsigned long, signed long, unsigned long long, and signed long long.

    For the tasking compiler, Polyspace uses the first type that can hold all of the enumerator values from this list: char, unsigned char, short, unsigned short, int, and unsigned int.

  • AUTO_SIGNED_FIRST — Polyspace uses the first type that can hold all of the enumerator values from this list: signed char, unsigned char, signed short, unsigned short, signed int, unsigned int, signed long, unsigned long, signed long long, and unsigned long long.

  • AUTO_UNSIGNED_FIRST — Polyspace uses the first type that can hold all of the enumerator values from this list:

    • For positive enumerator values: unsigned char, unsigned short, unsigned int, unsigned long, and unsigned long long.

    • For negative enumerator values: signed char, signed short, signed int, signed long, and signed long long.

Example: buildConf.Processor.EnumTypeDefinition=buildConf.Processor.EnumTypeDefinition.AUTO_SIGNED_FIRST

Size of float data type in bits.

Example: buildConf.Processor.FloatBitsSize=16

Size of int data type in bits.

Example: buildConf.Processor.IntBitsSize=8

Support for long long data type.

Example: buildConf.Processor.IsLongLongSupported=True

Size of long data type in bits.

Example: buildConf.Processor.LongBitsSize=32

Size of long double data type in bits.

Example: buildConf.Processor.LongDoubleBitsSize=32

Size of long long data type in bits.

Example: buildConf.Processor.LongLongBitsSize=64

Size of pointer in bits.

Example: buildConf.Processor.PointerBitsSize=8

Underlying type of ptrdiff_t data type.

Example: buildConf.Processor.PtrDiffT=buildConf.Processor.PtrDiffT.INT

Size of short data type in bits.

Example: buildConf.Processor.ShortBitsSize=8

Specify whether plain char types are signed or not.

Example: buildConf.Processor.SignedChar=True

Underlying type of size_t data type.

Example: buildConf.Processor.SizeT=buildConf.Processor.SizeT.UNSIGNED_INT

Minimum value of alignment for struct and union data types

Example: buildConf.Processor.StructureMinAlignment=8

Underlying type of wchar_t data type.

Example: buildConf.Processor.WCharT=buildConf.Processor.WCharT.UNSIGNED_INT

Number of bits that the processor can process at one time.

Example: buildConf.Processor.WordSize=64

Size of special function registers (sfr) data types, specified in bits as typename=sizeInBits.

To modify this property, use these methods:

  • append(typename=sizeInBits) — Add a value to this property.

  • pop(typenameIdx) — Remove the value with index 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)

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).

Example: buildConf.StaticAnalysisCompilerName="gnu9.x"

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).

Example: buildConf.StaticAnalysisTargetName="x86_64"

Compiler that Polyspace uses to build your source code and tests for dynamic testing. By default. Polyspace automatically detects an installed toolchain. If you specify a different compilation toolchain, check that the compiler is installed on your system.

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(macroName) — Add a macro to this property.

  • pop(macroNameIdx) — Remove the macro with index 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)

Methods

expand all

Version History

Introduced in R2024a

expand all