Commit ca764f59 authored by GILLES Sebastien's avatar GILLES Sebastien

#1500 Speed up cppcheck, which now uses the json generated by CMake as a...

#1500 Speed up cppcheck, which now uses the json generated by CMake as a base.A -j option has been used in command line, and the costly -f option has been removed.
parent 6e1e4991
......@@ -2,7 +2,10 @@ cppcheck:
stage: analysis
image: registry.gitlab.inria.fr/morefem/analysistools/cppcheck:latest
script:
- python Scripts/CI/CppCheck/run_cpp_check.py
# Cmake must be called to generate the compile_commands.json file; no need to actually compile the code!
- mkdir -p build
- cd build && python ../cmake/Scripts/configure_cmake.py --cache_file=../cmake/PreCache/linux.cmake --mode=debug --cmake_args="-G Ninja"
- cd .. && python Scripts/CI/CppCheck/run_cpp_check.py
dependencies: []
artifacts:
name: "artifact_${CI_PROJECT_ID}_${CI_COMMIT_REF_SLUG}_${OS}-cppcheck-xml"
......
# This script is assumed to be called within continous integration, just after a call to CMake to generate a file
# named 'compile_commands.json'.
import os
import time
import subprocess
if __name__ == "__main__":
morefem_source_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "..", "Sources")
project_root_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "..")
json_file = os.path.join(project_root_dir, "build", "compile_commands.json")
cmd = \
[
"cppcheck",
# "-j",
# "4",
"--std=c++17",
"-j",
"4",
"--enable=all",
"-v",
"-f",
"--language=c++",
"--platform=unix64",
"--xml",
"--xml-version=2",
"--suppress=missingIncludeSystem",
morefem_source_dir,
"-i",
"{}/ThirdParty/Source".format(morefem_source_dir),
"-I{}".format(morefem_source_dir),
"-DF77_NO_UNDER_SCORE",
"-DTRANSMESH"
"--project={}".format(json_file),
]
......
......@@ -136,6 +136,8 @@ else()
set(MOREFEM_MAIN_LIBS MoReFEM_utilities MoReFEM_core MoReFEM_geometry MoReFEM_felt MoReFEM_param MoReFEM_op MoReFEM_param_instances MoReFEM_op_instances MoReFEM_formulation_solver MoReFEM_model)
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
# Option to color the outputs with ninja.
# Adapted from https://medium.com/@alasher/colored-c-compiler-output-with-ninja-clang-gcc-10bfe7f2b949
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment