Create Polyspace project from your build system at the MATLAB command line
polyspaceConfigure traces your build
system and creates a Polyspace® project with information gathered from your build system. You can run
an analysis on a Polyspace project only in the user interface of the Polyspace desktop products.buildCommand
polyspaceConfigure
traces your build system and uses -option
value buildCommand-option value to modify the
default operation of polyspaceConfigure. Specify the modifiers
before buildCommand, otherwise they are considered as options in
the build command itself.
Note
Before you run Polyspace from MATLAB®, you must link your Polyspace and MATLAB installations. See Integrate Polyspace with MATLAB and Simulink.
This example shows how to create a Polyspace project if you use the command make
to build your source code. The
example creates a Polyspace project that can be opened only in the user interface of the
Polyspace desktop products.targetName
buildOptions
Create a Polyspace project specifying a unique project
name. Use the -B or -W option
with makefileNamemake so that the all
prerequisite targets in the makefile are remade.
polyspaceConfigure -prog myProject ... make -B targetName buildOptions
Open the Polyspace project in the Project Browser.
polyspaceBugFinder('myProject.psprj')This example shows how to create different Polyspace projects from the same trace of your build system. You can specify which source files to include for each project. The example creates a Polyspace project that can be opened only in the user interface of the Polyspace desktop products.
Trace your build system without creating a Polyspace project by specifying the option -no-project. To
ensure that all the prerequisite targets in your makefile are remade, use the
appropriate make build command option, for instance
-B.
polyspaceConfigure -no-project make -B;
polyspace-configure stores the cache information and the
build trace in default locations inside the current folder. To store the cache
information and build trace in a different location, specify the options
-cache-path and -build-trace.
Generate Polyspace projects by using the build trace information from the previous
step. Specify a project name and use the -include-sources or
-exclude-sources option to select which files to include for
each project.
polyspaceConfigure -no-build -prog myProject ... -include-sources "glob_pattern";
glob_pattern is a glob pattern that corresponds to
folders or files you filter in or out of your project. To ensure the shell does
not expand the glob patterns you pass to polysapce-configure,
enclose them in double quotes.For more information on the supported syntax for
glob patterns, see polyspace-configure Source Files Selection Syntax.
If you specified the options -build-trace and
-cache-path in the previous step, specify them again.
Delete the trace file and cache folder.
rmdir('polyspace_configure_cache', 's'); delete polyspace_configure_built_trace;
-build-trace and
-cache-path, use the paths and file names from those
options.This example shows how to run Polyspace analysis if you use a build command such as make
to build your source code. In
this example, you use targetName
buildOptionspolyspaceConfigure to trace your build
system but do not create a Polyspace project. Instead you create an options file that you can use to run
Polyspace analysis from the command-line.
Create a Polyspace options file specifying the -output-options-file command.
Use the -B or -W option
with makefileNamemake so that all
prerequisite targets in the makefile are remade.
polyspaceConfigure -output-options-file ... myOptions make -B targetName buildOptions
Use the options file that you created to run a Polyspace analysis at the command line:
polyspaceBugFinder -options-file myOptions
buildCommand — Command for building source codeBuild command specified exactly as you use to build your source code.
Example: make -B, make -W makefileName
-option value — Options for changing default operation of polyspaceConfigure-, followed
by argument | multiple space-separated option-argument pairsBasic Options
| Option | Argument | Description |
|---|---|---|
-prog | Project name | Project name that appears in the Polyspace user interface. The default is
If you do not use the
option Example:
|
-author | Author name | Name of project author. Example:
|
-output-project | Path | Project file name and location for saving project. The default
is the file Example:
|
-output-options-file | File name | Option to create a Polyspace analysis options file. Use this file for command-line analysis using one of these commands:
|
-allow-build-error | None | Option to create a Polyspace project even if an error occurs in the build process. If an error occurs, the build trace log shows the following message: polyspace-configure (polyspaceConfigure) ERROR: build command command_name fail [status=status_value] command_name
is the build command name that you use and
status_value is the non-zero exit
status or error level that indicates which error occurred in your
build process.This option is ignored when you use
|
-allow-overwrite | None | Option to overwrite a project with the same name, if it exists. By default, |
| None | Option to suppress or display additional messages from running
If you specify more than one of these options, the most verbose option is applied. These options are
ignored if they are used in combination with
|
-help | None | Option to display the full list of |
-debug | None | Option to store debug information for use by MathWorks® technical support. This option has been
superseded by the option
|
-easy-debug | Path | Option to store debug information for use by MathWorks technical support. After a
|
Options to Create Multiple Modules
These options are not compatible with -compilation-database.
| Option | Argument | Description |
|---|---|---|
-module | None | Option to create a separate options file for each binary created in build system. You can only create separate options files for different binaries. You cannot create multiple modules in a Polyspace project (for running in the Polyspace user interface). Use this option only for build systems that use GNU® and Visual C++® compilers. See also Modularize Polyspace Analysis by Using Build Command. |
-output-options-path | Path name | Location where generated options files are saved. Use this option
together with the option The options files are named after the binaries created in the build system. |
Advanced Options
| Option | Argument | Description |
|---|---|---|
-compilation-database | Path and file name | Location and name of JSON compilation database (JSON CDB) file.
You generate this file from your build system, for instance by using
the flag You do not specify a build command when you use this option. The build systems and compilers support the generation of a JSON CDB:
This option is not compatible with
The cache control options,
|
-compiler-config | Path and file name | Location and name of compiler configuration file. The file must be in a specific format. For guidance,
see the existing configuration files in Example:
|
-no-project | None | Option to trace your build system without creating a Polyspace project and save the build trace information. Use this option to save your build trace
information for a later run of This option is
not compatible with
|
-no-build | None | Option to create a Polyspace project using previously saved build trace information. To use this option, you must have the build
trace information saved from an earlier run of
If you use
this option, you do not need to specify the
This
option is ignored when you use
|
-no-sources | None | Option to create a Polyspace options file that does not contain the source file specifications. Use this option when you intend to specify the source files by other means. For instance, you can use this option when:
|
-extra-project-options | Options to use for subsequent Polyspace analysis. For instance,
"-stubbed-pointers-are-unsafe". | Options that are used for subsequent Polyspace analysis. Once a Polyspace project is created, you can change some of the default
options in the project. Alternatively, you can pass these options
when tracing your build command. The flag
Specify multiple options in a space
separated list, for instance
Suppose you
have to set the option
For the list of options available, see:
If you are creating an options file instead of a Polyspace project from your build command, do not use this flag. |
-tmp-path | Path | Location of folder where temporary files are stored. |
-build-trace | Path and file name | Location and name of file where build information is stored.
The default is
Example:
|
| Glob pattern | Option to specify which source files
A source file is
included if the file path matches the glob
pattern
that you pass to A
source file is excluded if the file path matches the glob
pattern
that you pass to |
| None | Option to print the list of source files that
Use this option to
troubleshoot the glob patterns that you pass to
|
-compiler-cache-path | Folder path | Specify a folder path where
By default, Polyspace looks for and stores compiler caches under these folder paths:
|
-no-compiler-cache | None | Use this option if you do not want Polyspace to cache your compiler configuration information or to use an existing cache for your compiler configuration. By default, the first time you run
|
-reset-compiler-cache-entry | None | Use this option to query the compiler for the current configuration and to refresh the entry in the cache file that corresponds to this configuration. Other compiler configuration entries in the cache are not updated. |
-clear-compiler-cache | None | Use this option to delete all compiler configurations stored in the cache file. If you also specify a build command or
|
-import-macro-definitions |
| Use this option to specify how
You can specify:
|
-options-for-sources-delimiter | A single character | Specify an option separator to use when multiple analysis
options are associated with one source file using the
See also |
Cache Control Options
These options are primarily useful for debugging. Use the options if
polyspace-configure (polyspaceConfigure) fails and MathWorks Technical Support asks you to use the option and provide the cached files.
Starting R2020a, the option -easy-debug provides an easier way to provide
debug information. See Contact Technical Support About Issues with Running Polyspace.
These options are ignored when you use -compilation-database.
| Option | Argument | Description |
|---|---|---|
| None | Option to perform one of the following:
Typically, you cache temporary files created by your build command to debug issues in tracing the command. |
-cache-path | Path | Location of folder where cache information is stored. When tracing a Visual Studio build
( path is too long Example:
|
| None | Option to preserve or clean up cache information after
If |