8.1.1. Project Setup Basics¶
8.1.1.1. Background¶
You have a project with C/C++ source and want to analyze the code with respect to software erosion. In the following, the basic steps are explained.
8.1.1.2. What needs to be done?¶
Install the Axivion Suite and its Java dependency according to Installation. Optionally install a custom Python interpreter to use instead of the included one.
Before setting up the code analysis, make sure that the native build is working in the workspace/computer that will be used for code analysis in order to have all dependencies for the build ready.
Create the project overview sheet:
Which VCS do you use?
Which build system do you use?
Which native compiler do you use?
Where are the compiler’s standard headers located?
Where is the 3rd party code?
You have to decide where to store the configuration files. It is best practise to create a folder
axivioninside the project’s VCS directory and collect the individual configuration files in this folder. The folder should be added to the VCS.If you already have a setup for a similar project, try to copy the configuration files and change them.
Depending on your build system, find out how to replace the calls to the native compiler and linker with calls to
cafeCC.Run the tool
axivion_configand click on the button “Use Wizard”. Follow the Wizard. You will be able to edit the configuration at the end of the process to configure more specific behavior that is not supported by the Wizard. If you have multiple build results see Multi-Target Projects how to proceed.Adopt the start script
start_analysis.batresp.start_analysis.shfor the CI build that can be used to start an analysis run. An initial version of the start script will have been created by the project Wizard.Start the CI via the start script interactively and redirect stdout and stderr into a log file, e.g.
start_analysis >build.log 2>&1
Then check the
build.logfor errors and warnings. First, eliminate the catastrophic errors fromcafeCC(are the compiler include paths correctly set up?). Then, try to remove all error messages. Typical sources for error messages are missing defines for compiler specifica. If in doubt how to proceed, contact axivion.support@qt.io. When all compiler errors are resolved, code analysis can be run successfully.When analyzing a project which compiles fine with the native compiler, but the Axivion Suite displays a lot of errors in the compiler’s system header files. Please check the compiler configuration.
If your project uses a compiler variant of GCC, Clang, IAR, GHS or TI, please use the automated setup tools (
gccsetup,clangsetup,iarsetup,ghssetup, andticgtsetuprespectively) as also recommended during the project Wizard run.For other compilers, a collection of compiler profiles is available in the Axivion Suite installation folder
profiles. Please refer to theREADME.txtfiles inside those folders.If your project uses a proprietary project file (like
.sln,.vcxproj,.uvprojx,.ewp,.gpj, or.cbp), please use the supplied build tools (build_sln,build_vcxproj,build_uvprojx,build_ewp,build_gpj, andbuild_cbprespectively).Configure the analyses (select the right stylecheck rules, architecture setup, dead code etc).
Make a test run and start a dashboard locally. Check the results from the analyses.
Review the analysis configuration: Do you need to exclude 3rd party code, generated code, compiler headers? Further configuration for libraries required (e.g., Qt)?
After the analysis is running fine locally, commit the configuration files to the VCS.
Add the analysis job to your CI server. Check out the code and let the analysis run in CI server. Are the results as expected?
Add the resulting project to your web UI server and notify users about the availability of the results.