@@ -0,0 +1,42 | |||||
|
1 | # - try to find scan-build tool | |||
|
2 | # | |||
|
3 | # Cache Variables: | |||
|
4 | # CLANGANALYZER_ROOT_DIR | |||
|
5 | # CLANGANALYZER_EXECUTABLE | |||
|
6 | # | |||
|
7 | # Non-cache variables you might use in your CMakeLists.txt: | |||
|
8 | # CLANGANALYZER_FOUND | |||
|
9 | # | |||
|
10 | # Requires these CMake modules: | |||
|
11 | # FindPackageHandleStandardArgs (known included with CMake >=2.6.2) | |||
|
12 | ||||
|
13 | file(TO_CMAKE_PATH "${CLANGANALYZER_ROOT_DIR}" CLANGANALYZER_ROOT_DIR) | |||
|
14 | set(CLANGANALYZER_ROOT_DIR | |||
|
15 | "${CLANGANALYZER_ROOT_DIR}" | |||
|
16 | CACHE | |||
|
17 | PATH | |||
|
18 | "Path to search for scan-build") | |||
|
19 | ||||
|
20 | if(CLANGANALYZER_EXECUTABLE AND NOT EXISTS "${CLANGANALYZER_EXECUTABLE}") | |||
|
21 | set(CLANGANALYZER_EXECUTABLE "notfound" CACHE PATH FORCE "") | |||
|
22 | endif() | |||
|
23 | ||||
|
24 | # If we have a custom path, look there first. | |||
|
25 | if(CLANGANALYZER_ROOT_DIR) | |||
|
26 | find_program(CLANGANALYZER_EXECUTABLE | |||
|
27 | NAMES | |||
|
28 | scan-build | |||
|
29 | PATHS | |||
|
30 | "${CLANGANALYZER_ROOT_DIR}" | |||
|
31 | PATH_SUFFIXES | |||
|
32 | bin | |||
|
33 | NO_DEFAULT_PATH) | |||
|
34 | endif() | |||
|
35 | ||||
|
36 | find_program(CLANGANALYZER_EXECUTABLE NAMES scan-build) | |||
|
37 | ||||
|
38 | IF(NOT("${CLANGANALYZER_EXECUTABLE}" STREQUAL "")) | |||
|
39 | set(CLANGANALYZER_FOUND TRUE) | |||
|
40 | endif() | |||
|
41 | ||||
|
42 | mark_as_advanced(CLANGANALYZER_EXECUTABLE) |
@@ -0,0 +1,20 | |||||
|
1 | ||||
|
2 | QT_PATH=".../Qt/5.8/gcc_64/lib/cmake/" | |||
|
3 | ||||
|
4 | export CC=/usr/libexec/ccc-analyzer | |||
|
5 | export CXX=/usr/libexec/c++-analyzer | |||
|
6 | export CCC_CC=clang | |||
|
7 | export CCC_CXX=clang++ | |||
|
8 | export LD=clang++ | |||
|
9 | export CCC_ANALYZER_VERBOSE=1 | |||
|
10 | ||||
|
11 | LD_LIBRARY_PATH=/usr/local/lib64 | |||
|
12 | export LD_LIBRARY_PATH | |||
|
13 | ||||
|
14 | rm -rf build_clang-analyzer | |||
|
15 | mkdir build_clang-analyzer | |||
|
16 | cd build_clang-analyzer | |||
|
17 | ||||
|
18 | scan-build cmake -DCMAKE_PREFIX_PATH=$QT_PATH -DCMAKE_CXX_COMPILER=clazy -DENABLE_ANALYSIS=false -DENABLE_CPPCHECK=false -DENABLE_FORMATTING=false -DENABLE_CHECKSTYLE=false -BUILD_DOCUMENTATION=false -BUILD_TESTS=false -DCMAKE_BUILD_TYPE=Debug ../../SCIQLOP-Initialisation/ | |||
|
19 | ||||
|
20 | scan-build -o clang-analyzer-output make -j2 |
@@ -0,0 +1,52 | |||||
|
1 | # | |||
|
2 | # sciqlop_code_analysis.cmake | |||
|
3 | ||||
|
4 | # Launch code source analysis with cppcheck. Can be activated with the | |||
|
5 | # ENABLE_CPPCHECK option. | |||
|
6 | # | |||
|
7 | # The following CACHE variables are available: | |||
|
8 | # * CPPCHECK_EXTRA_ARGS: extra arguments for cppcheck; | |||
|
9 | # * CPPCHECK_OUTPUT: path to the xml report of cppcheck. | |||
|
10 | # | |||
|
11 | # The following variables are used (must be set by the cmake file calling this | |||
|
12 | # one): | |||
|
13 | # * ANALYSIS_INPUT_DIRS: directories to analyze; | |||
|
14 | # * ANALYSIS_EXCLUDE_DIRS: directories to exclude from the analysis. | |||
|
15 | # | |||
|
16 | ||||
|
17 | # | |||
|
18 | # Analyze the source code with cppcheck | |||
|
19 | # | |||
|
20 | OPTION (ENABLE_CPPCHECK "Analyze the source code with cppcheck" ON) | |||
|
21 | IF (ENABLE_CPPCHECK) | |||
|
22 | ||||
|
23 | # Make sure cppcheck has been found, otherwise the source code can't be | |||
|
24 | # analyzed | |||
|
25 | IF (CPPCHECK_FOUND) | |||
|
26 | SET (CPPCHECK_EXTRA_ARGS --inline-suppr --xml --xml-version=2 --enable="warning,style" --force -v | |||
|
27 | CACHE STRING "Extra arguments for cppcheck") | |||
|
28 | MARK_AS_ADVANCED (CPPCHECK_EXTRA_ARGS) | |||
|
29 | ||||
|
30 | SET (CPPCHECK_OUTPUT "${CMAKE_BINARY_DIR}/cppcheck-report.xml" | |||
|
31 | CACHE STRING "Output file for the cppcheck report") | |||
|
32 | MARK_AS_ADVANCED (CPPCHECK_OUTPUT) | |||
|
33 | ||||
|
34 | SET (CPPCHECK_EXCLUDE_DIRS) | |||
|
35 | FOREACH (dir ${ANALYSIS_EXCLUDE_DIRS}) | |||
|
36 | LIST (APPEND CPPCHECK_EXCLUDE_DIRS "-i${dir}") | |||
|
37 | ENDFOREACH () | |||
|
38 | ||||
|
39 | # Add the analyze target to launch cppcheck | |||
|
40 | ADD_CUSTOM_TARGET (cppcheck | |||
|
41 | COMMAND | |||
|
42 | ${CPPCHECK_EXECUTABLE} | |||
|
43 | ${CPPCHECK_EXTRA_ARGS} | |||
|
44 | ${ANALYSIS_INPUT_DIRS} | |||
|
45 | ${CPPCHECK_EXCLUDE_DIRS} | |||
|
46 | 2> ${CPPCHECK_OUTPUT} | |||
|
47 | ) | |||
|
48 | ||||
|
49 | ELSE (CPPCHECK_FOUND) | |||
|
50 | MESSAGE (STATUS "The source code won't be analyzed - Cppcheck not found") | |||
|
51 | ENDIF (CPPCHECK_FOUND) | |||
|
52 | ENDIF (ENABLE_CPPCHECK) |
@@ -1,2 +1,3 | |||||
1 | build/ |
|
1 | build/ | |
2 | CMakeLists.txt.user No newline at end of file |
|
2 | CMakeLists.txt.user | |
|
3 | /.project |
1 | NO CONTENT: file renamed from cmake/CMakeModules/Findcppcheck.cmake to analyzer/cmake/Findcppcheck.cmake |
|
NO CONTENT: file renamed from cmake/CMakeModules/Findcppcheck.cmake to analyzer/cmake/Findcppcheck.cmake |
1 | NO CONTENT: file renamed from cmake/CMakeModules/Findcppcheck.cpp to analyzer/cmake/Findcppcheck.cpp |
|
NO CONTENT: file renamed from cmake/CMakeModules/Findcppcheck.cpp to analyzer/cmake/Findcppcheck.cpp |
@@ -2,8 +2,11 | |||||
2 | # compiler.cmake : configure the compilation flags |
|
2 | # compiler.cmake : configure the compilation flags | |
3 | # |
|
3 | # | |
4 |
|
4 | |||
|
5 | message("Compiler id: ${CMAKE_CXX_COMPILER_ID}") | |||
5 | IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |
|
6 | IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | |
6 | INCLUDE("cmake/compiler/compiler_gnu.cmake") |
|
7 | INCLUDE("cmake/compiler/compiler_gnu.cmake") | |
|
8 | ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") | |||
|
9 | INCLUDE("cmake/compiler/compiler_gnu.cmake") | |||
7 | ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") |
|
10 | ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") | |
8 | INCLUDE("cmake/compiler/compiler_msvc.cmake") |
|
11 | INCLUDE("cmake/compiler/compiler_msvc.cmake") | |
9 | ELSE() |
|
12 | ELSE() |
@@ -18,9 +18,11 FIND_PACKAGE(Qt5Gui REQUIRED) | |||||
18 | FIND_PACKAGE(Doxygen) |
|
18 | FIND_PACKAGE(Doxygen) | |
19 |
|
19 | |||
20 | # |
|
20 | # | |
21 | # Cppcheck tool |
|
21 | # Analyzer tools | |
22 | # |
|
22 | # | |
|
23 | LIST( APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/analyzer/cmake") | |||
23 | FIND_PACKAGE(cppcheck) |
|
24 | FIND_PACKAGE(cppcheck) | |
|
25 | FIND_PACKAGE(ClangAnalyzer) | |||
24 |
|
26 | |||
25 | # |
|
27 | # | |
26 | # Formatting tools |
|
28 | # Formatting tools |
@@ -36,3 +36,4 INCLUDE ("cmake/sciqlop_doxygen.cmake") | |||||
36 | # Source code analysis |
|
36 | # Source code analysis | |
37 | # |
|
37 | # | |
38 | INCLUDE ("cmake/sciqlop_code_analysis.cmake") |
|
38 | INCLUDE ("cmake/sciqlop_code_analysis.cmake") | |
|
39 | INCLUDE ("cmake/sciqlop_code_cppcheck.cmake") |
@@ -1,12 +1,12 | |||||
1 | # |
|
1 | # | |
2 | # sciqlop_code_analysis.cmake |
|
2 | # sciqlop_code_analysis.cmake | |
3 |
|
3 | |||
4 |
# Launch code source analysis with |
|
4 | # Launch code source analysis with CLANGANALYZER. Can be activated with the | |
5 |
# |
|
5 | # ENABLE_ANALYSIS option. | |
6 | # |
|
6 | # | |
7 | # The following CACHE variables are available: |
|
7 | # The following CACHE variables are available: | |
8 |
# * C |
|
8 | # * CLANGANALYZER_EXTRA_ARGS: extra arguments for CLANGANALYZER; | |
9 |
# * C |
|
9 | # * CLANGANALYZER_OUTPUT: path to the xml report of CLANGANALYZER. | |
10 | # |
|
10 | # | |
11 | # The following variables are used (must be set by the cmake file calling this |
|
11 | # The following variables are used (must be set by the cmake file calling this | |
12 | # one): |
|
12 | # one): | |
@@ -15,38 +15,30 | |||||
15 | # |
|
15 | # | |
16 |
|
16 | |||
17 | # |
|
17 | # | |
18 |
# Analyze the source code with |
|
18 | # Analyze the source code with CLANGANALYZER | |
19 | # |
|
19 | # | |
20 |
OPTION ( |
|
20 | OPTION (ENABLE_ANALYSIS "Analyze the source code with clang_analyze" ON) | |
21 | IF (ANALYZE_CODE) |
|
21 | IF (ENABLE_ANALYSIS) | |
22 |
|
22 | |||
23 |
# Make sure |
|
23 | # Make sure CLANGANALYZER has been found, otherwise the source code can't be | |
24 | # analyzed |
|
24 | # analyzed | |
25 |
IF (C |
|
25 | IF (CLANGANALYZER_FOUND) | |
26 | SET (CPPCHECK_EXTRA_ARGS --inline-suppr --xml --xml-version=2 --enable="warning,style" --force -v |
|
|||
27 | CACHE STRING "Extra arguments for cppcheck") |
|
|||
28 | MARK_AS_ADVANCED (CPPCHECK_EXTRA_ARGS) |
|
|||
29 |
|
26 | |||
30 | SET (CPPCHECK_OUTPUT "${CMAKE_BINARY_DIR}/cppcheck-report.xml" |
|
27 | SET (CLANGANALYZER_OUTPUT "${CMAKE_BINARY_DIR}/clang-analyzer-ouput" | |
31 |
CACHE STRING "Output file for the |
|
28 | CACHE STRING "Output file for the CLANGANALYZER report") | |
32 |
MARK_AS_ADVANCED (C |
|
29 | MARK_AS_ADVANCED (CLANGANALYZER_OUTPUT) | |
33 |
|
30 | |||
34 | SET (CPPCHECK_EXCLUDE_DIRS) |
|
31 | SET (CLANGANALYZER_EXTRA_ARGS -o ${CLANGANALYZER_OUTPUT} | |
35 | FOREACH (dir ${ANALYSIS_EXCLUDE_DIRS}) |
|
32 | CACHE STRING "Extra arguments for CLANGANALYZER") | |
36 | LIST (APPEND CPPCHECK_EXCLUDE_DIRS "-i${dir}") |
|
33 | MARK_AS_ADVANCED (CLANGANALYZER_EXTRA_ARGS) | |
37 | ENDFOREACH () |
|
|||
38 |
|
34 | |||
39 |
# Add the analyze target to launch |
|
35 | # Add the analyze target to launch CLANGANALYZER | |
40 | ADD_CUSTOM_TARGET (analyze |
|
36 | ADD_CUSTOM_TARGET (analyze | |
41 | COMMAND |
|
37 | COMMAND | |
42 | ${CPPCHECK_EXECUTABLE} |
|
38 | sh ${CMAKE_CURRENT_SOURCE_DIR}/analyzer/launch-clang-analyzer-linux.sh | |
43 | ${CPPCHECK_EXTRA_ARGS} |
|
|||
44 | ${ANALYSIS_INPUT_DIRS} |
|
|||
45 | ${CPPCHECK_EXCLUDE_DIRS} |
|
|||
46 | 2> ${CPPCHECK_OUTPUT} |
|
|||
47 | ) |
|
39 | ) | |
48 |
|
40 | |||
49 |
ELSE (C |
|
41 | ELSE (CLANGANALYZER_FOUND) | |
50 |
MESSAGE (STATUS "The source code won't be analyzed - C |
|
42 | MESSAGE (STATUS "The source code won't be analyzed - CLANGANALYZER not found") | |
51 |
ENDIF (C |
|
43 | ENDIF (CLANGANALYZER_FOUND) | |
52 |
ENDIF ( |
|
44 | ENDIF (ENABLE_ANALYSIS) |
@@ -23,7 +23,7 | |||||
23 | #include <QApplication> |
|
23 | #include <QApplication> | |
24 | #include <QProcessEnvironment> |
|
24 | #include <QProcessEnvironment> | |
25 | #include <QThread> |
|
25 | #include <QThread> | |
26 | #include <omp.h> |
|
26 | //#include <omp.h> | |
27 | #include <qglobal.h> |
|
27 | #include <qglobal.h> | |
28 |
|
28 | |||
29 | int main(int argc, char *argv[]) |
|
29 | int main(int argc, char *argv[]) |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now