Analyze C/C++ projects.

Analyze C/C++ projects

Introduction

There are a lot of managed C/C++ build systems like Makefile, CMake, SCon and Visual Studio. To perform the analysis CppDepend needs all the data concerning the compilation and link commands. CppDepend supports out of the box the most known build specifications. For the other cases you can analyze a folder or intercept the build commands using the Build Monitor for windows or bear for linux.
From the terminal you can execute the analysis:
Windows:
>ScanypAnalyzer.exe  C:\work\MyProject.sln --identifier MyProject
Linux/Mac:
>./analyze.sh  /home/myuser/compile_commands.json --identifier MyProject
The --identifier switch is mandatory to define the project key, ScanypAnalyzer will get from the ScanypServer the configuration of this specific key if it's found, else a default configuration will be created in the server and it will be used by the ScanypAnalyzer for the analysis.

Supported entries

  • C Projects: The build specifications of C project could be any kind of project enumerated below. However you have to specify the --kind switch
    Windows:
    >ScanypAnalyzer.exe  C:\work\MySolution.sln --identifier MyProject --kind c
            
    Linux/Mac:
    >./analyze.sh  /home/myuser/compile_commands.json --identifier MyProject
    
  • Visual Studio projects: Scanyp supports Visual Studio projects 2010 up to 2022. The extensions supported are .sln,.vcproj and .vcxproj
    >ScanypAnalyzer.exe  C:\work\MySolution.sln --identifier MyProject
        
  • CMake Json compilation database: A compilation database is a database for compile options. It records which compile options are used to build the files in a project. The compilation database could be generated from CMake or Ninja, and there are many other ways to generate a compilation database as descibed here.
    Windows:
    >ScanypAnalyzer.exe  C:\work\compile_commands.json --identifier MyProject
        
    Linux/Mac:
    >./analyze.sh  /home/myuser/compile_commands.json --identifier MyProject
       
  • XCode Projects:With the xcpretty utility, you can generate 'compile_commands.json'. To do this, run the following command: xcodebuild [flags] | xcpretty -r json-compilation-database
    >./analyze.sh  /home/user/myproject/compile_commands.json --identifier MyProject
            
  • Qt projects : The recommended way to analyze a Qt project is to generate the compilation database from QtCreator.
    Windows:
    >ScanypAnalyzer.exe  C:\work\compile_commands.json --identifier MyProject
        
    Linux/Mac:
    >./analyze.sh  /home/myuser/compile_commands.json --identifier MyProject
       
  • CLion Projects: The recommended way to analyze a CLion project is to generate the compilation database as described here .
    Windows:
    >ScanypAnalyzer.exe  C:\work\compile_commands.json --identifier MyProject
            
    Linux/Mac:
    >./analyze.sh  /home/myuser/compile_commands.json --identifier MyProject
           
  • Eclipse Projects: The recommended way to analyze an Eclipse project, is to generate a compilation database using bear for linux or BuildMonitor for windows. .
    Windows:
    >ScanypAnalyzer.exe  C:\work\MySolution.json --identifier MyProject
                
    Linux/Mac:
    >./analyze.sh  /home/myuser/compile_commands.json --identifier MyProject
               
  • Scon: The recommended way to analyze a SCON project is to generate the compilation database as described here .
    Windows:
    >ScanypAnalyzer.exe  C:\work\MySolution.json --identifier MyProject
                    
    Linux/Mac:
    >./analyze.sh  /home/myuser/compile_commands.json --identifier MyProject
                   
  • Ninja: The recommended way to analyze a CLion project is to generate the compilation database as described here .
    Windows:
    >ScanypAnalyzer.exe  C:\work\MySolution.json --identifier MyProject
                        
    Linux/Mac:
    >./analyze.sh  /home/myuser/compile_commands.json --identifier MyProject
                       
  • Makefile: The recommended way to analyze a Makefile, is to generate a compilation database using bear for linux or BuildMonitor for windows. .
    Windows:
    >ScanypAnalyzer.exe  C:\work\MySolution.json --identifier MyProject
                            
    Linux/Mac:
    >./analyze.sh  /home/myuser/compile_commands.json --identifier MyProject
                           
  • Source folder: If it's not possible to generate a build specification of your project, you can as latest solution parse the source folder. However in this case you need to specify the include paths and the defines from the config.ini file.

    projectkey.IncludePaths= C:\work\Includes1;C:\work\Includes2 projectkey.Defines=Define1;Define2

    Windows:
    >ScanypAnalyzer.exe  C:\work\sourcefolder --identifier MyProject
            
    Linux/Mac:
    >./analyze.sh  /home/myuser/sourcefolder --identifier MyProject
    
  • Other project kinds :The recommended way to analyze a Makefile, is to generate a compilation database like described here, and if it's not possible you can use using bear for linux or BuildMonitor for windows. .
    Windows:
    >ScanypAnalyzer.exe  C:\work\MySolution.json --identifier MyProject
            
    Linux/Mac:
    >./analyze.sh  /home/myuser/compile_commands.json --identifier MyProject
           

Scanyp offers a wide range of features. It is often described as a Swiss Army Knife for developers.

Start Free Trial