Main Content

Information Gathered from Build Systems for Polyspace Analysis and Testing

R2026b

If you use a build command such as make or cmake for building your source code or you are able to generate a JSON compilation database using your build system, you can create a Polyspace® Platform project by tracing the build command or compilation database. You can keep the project in sync with the latest sources and build information by retracing the build command as needed.

Information Extracted from Build Command When Creating or Updating Polyspace Platform Project

Creating or updating a Polyspace Platform project from your build command extracts the following information from your build command into the project:

  • Adds required source files to your project.

    If your build command builds tests authored using the Polyspace Test™ xUnit API or a supported external testing framework, the test files are automatically separated from the source files in the generated project. For an example, see Create Polyspace Platform Projects from Builds That Use Makefiles.

    Note that when you create a Polyspace Platform project from a build command, internal files such as pstest.c, which contains definitions of xUnit API macros, are not explicitly added to the project. These files are automatically added later when you build the project.

  • Sets the project language and language standard. For more information, see Source code language (-lang).

  • Adds include paths and macro definitions that are part of your application build command. See:

    If your build command compiles different files with different options, the file-specific options are added to the project and taken into account for static analysis. When you build a project for testing, these options are however concatenated into a global list of options which is used to build all files.

    To see the options associated with a file:

    1. Open your project configuration.

    2. Select Target & Compiler > File Specific Options.

    3. Select the file that you want from the drop-down list of files.

  • Sets additional flags that are part of the build command. See:

  • Sets libraries and library paths. See Libraries and Library paths.

  • Adds include paths and macro definitions that are implicitly defined by your compiler.

  • Sets the compiler for static analysis with Polyspace Bug Finder™ or Polyspace Code Prover™. For more information, see Compilation toolchain for static analysis (-compiler) (Polyspace Bug Finder).

  • Sets the compiler for dynamic testing with Polyspace Test. The toolchain is selected using this priority order:

    1. Host toolchain — If the compiler matches a host toolchain (for instance, GCC or Microsoft Visual C++® on the current machine), that toolchain is selected.

    2. Registered toolchain — If the compiler matches a custom toolchain that you registered, that toolchain is selected.

    3. Template toolchain — If the compiler matches a template toolchain (for instance, a cross-compiler such as Green Hills®, IAR, or Diab), that template toolchain is selected. When a template toolchain is selected, the Target board name (Testing) is set to None and the toolchain configuration variables are automatically populated with the compiler and linker paths from the build command.

    See Compilation toolchain (Testing).

  • Sets processor information such as sizes of types, underlying types of size_t, and so on. For more information, see Processor.

Information Retained When Updating Polyspace Platform Project

You can update a project created from a build command to stay in sync with your latest sources and build information. During an update:

  • Source and test files, include paths, and build configuration options that are created from the build command are updated.

    • All previous options in the build configuration are removed and populated using the current build command. In particular, if you created a project from a build command and later modified some options, your modifications are lost during the project update. You can retain your modifications by duplicating the build configuration, and following an update, copying back the modifications from the duplicated configuration variant. For more information on configuration variants, see Configure Project for Testing in Polyspace Platform User Interface.

    • Except the build configuration options, any information you entered explicitly is retained in the project. In particular, any source file, test file, or project include path you added explicitly is retained.

  • All existing file and folder exclusions are removed. See Exclude patterns.

When retracing your build command, make sure to perform a full build or your system instead of an incremental build. Tracing an incremental build causes your project to lose any source, test, or build configuration option that are not included in the incremental build.

See Also

See Also

Topics