##// END OF EJS Templates
Merge pull request 130 from SCIQLOP-Initialisation feature/ClangAnalyserIntegration...
perrinel -
r16:51ad7e303234 merge
parent child
Show More
@@ -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 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
1 NO CONTENT: file renamed from cmake/CMakeModules/Findcppcheck.cpp to analyzer/cmake/Findcppcheck.cpp
@@ -1,11 +1,14
1 1 #
2 2 # compiler.cmake : configure the compilation flags
3 3 #
4 4
5 message("Compiler id: ${CMAKE_CXX_COMPILER_ID}")
5 6 IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
6 7 INCLUDE("cmake/compiler/compiler_gnu.cmake")
8 ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
9 INCLUDE("cmake/compiler/compiler_gnu.cmake")
7 10 ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
8 11 INCLUDE("cmake/compiler/compiler_msvc.cmake")
9 12 ELSE()
10 13 MESSAGE(FATAL_ERROR "Compiler not supported")
11 14 ENDIF()
@@ -1,30 +1,32
1 1 #
2 2 # findslibs.cmake
3 3 #
4 4
5 5 #
6 6 # Qt
7 7 #
8 8 # Find Qt here so that a message is displayed in the console when executing
9 9 # cmake, but each application must call SCIQLOP_FIND_QT() to load the Qt modules that
10 10 # it needs.
11 11 FIND_PACKAGE(Qt5Core REQUIRED)
12 12 FIND_PACKAGE(Qt5Test REQUIRED)
13 13 FIND_PACKAGE(Qt5Gui REQUIRED)
14 14
15 15 #
16 16 # doxygen tools
17 17 #
18 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 24 FIND_PACKAGE(cppcheck)
25 FIND_PACKAGE(ClangAnalyzer)
24 26
25 27 #
26 28 # Formatting tools
27 29 #
28 30 LIST( APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/formatting/cmake")
29 31 FIND_PACKAGE(vera++)
30 32 FIND_PACKAGE(ClangFormat)
@@ -1,38 +1,39
1 1 #
2 2 # Sciqlop_modules.cmake
3 3 #
4 4 # Set ouptut directories
5 5 #
6 6 SET (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE})
7 7 SET (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE})
8 8
9 9
10 10 #
11 11 # Compile the core
12 12 #
13 13 ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/sqpcore")
14 14
15 15 #
16 16 # Compile the gui
17 17 #
18 18 #ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/sqpgui")
19 19
20 20 #
21 21 # Compile the app
22 22 #
23 23 ADD_SUBDIRECTORY("${CMAKE_SOURCE_DIR}/sqpapp")
24 24
25 25 #
26 26 # Code formatting
27 27 #
28 28 INCLUDE ("cmake/sciqlop_formatting.cmake")
29 29
30 30 #
31 31 # Documentation generation
32 32 #
33 33 INCLUDE ("cmake/sciqlop_doxygen.cmake")
34 34
35 35 #
36 36 # Source code analysis
37 37 #
38 38 INCLUDE ("cmake/sciqlop_code_analysis.cmake")
39 INCLUDE ("cmake/sciqlop_code_cppcheck.cmake")
@@ -1,52 +1,44
1 1 #
2 2 # sciqlop_code_analysis.cmake
3 3
4 # Launch code source analysis with cppcheck. Can be activated with the
5 # ANALYZE_CODE option.
4 # Launch code source analysis with CLANGANALYZER. Can be activated with the
5 # ENABLE_ANALYSIS option.
6 6 #
7 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.
8 # * CLANGANALYZER_EXTRA_ARGS: extra arguments for CLANGANALYZER;
9 # * CLANGANALYZER_OUTPUT: path to the xml report of CLANGANALYZER.
10 10 #
11 11 # The following variables are used (must be set by the cmake file calling this
12 12 # one):
13 13 # * ANALYSIS_INPUT_DIRS: directories to analyze;
14 14 # * ANALYSIS_EXCLUDE_DIRS: directories to exclude from the analysis.
15 15 #
16 16
17 17 #
18 # Analyze the source code with cppcheck
18 # Analyze the source code with CLANGANALYZER
19 19 #
20 OPTION (ANALYZE_CODE "Analyze the source code with cppcheck" ON)
21 IF (ANALYZE_CODE)
20 OPTION (ENABLE_ANALYSIS "Analyze the source code with clang_analyze" ON)
21 IF (ENABLE_ANALYSIS)
22 22
23 # Make sure cppcheck has been found, otherwise the source code can't be
23 # Make sure CLANGANALYZER has been found, otherwise the source code can't be
24 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)
25 IF (CLANGANALYZER_FOUND)
29 26
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)
27 SET (CLANGANALYZER_OUTPUT "${CMAKE_BINARY_DIR}/clang-analyzer-ouput"
28 CACHE STRING "Output file for the CLANGANALYZER report")
29 MARK_AS_ADVANCED (CLANGANALYZER_OUTPUT)
33 30
34 SET (CPPCHECK_EXCLUDE_DIRS)
35 FOREACH (dir ${ANALYSIS_EXCLUDE_DIRS})
36 LIST (APPEND CPPCHECK_EXCLUDE_DIRS "-i${dir}")
37 ENDFOREACH ()
31 SET (CLANGANALYZER_EXTRA_ARGS -o ${CLANGANALYZER_OUTPUT}
32 CACHE STRING "Extra arguments for CLANGANALYZER")
33 MARK_AS_ADVANCED (CLANGANALYZER_EXTRA_ARGS)
38 34
39 # Add the analyze target to launch cppcheck
35 # Add the analyze target to launch CLANGANALYZER
40 36 ADD_CUSTOM_TARGET (analyze
41 37 COMMAND
42 ${CPPCHECK_EXECUTABLE}
43 ${CPPCHECK_EXTRA_ARGS}
44 ${ANALYSIS_INPUT_DIRS}
45 ${CPPCHECK_EXCLUDE_DIRS}
46 2> ${CPPCHECK_OUTPUT}
38 sh ${CMAKE_CURRENT_SOURCE_DIR}/analyzer/launch-clang-analyzer-linux.sh
47 39 )
48 40
49 ELSE (CPPCHECK_FOUND)
50 MESSAGE (STATUS "The source code won't be analyzed - Cppcheck not found")
51 ENDIF (CPPCHECK_FOUND)
52 ENDIF (ANALYZE_CODE)
41 ELSE (CLANGANALYZER_FOUND)
42 MESSAGE (STATUS "The source code won't be analyzed - CLANGANALYZER not found")
43 ENDIF (CLANGANALYZER_FOUND)
44 ENDIF (ENABLE_ANALYSIS)
@@ -1,39 +1,39
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the QLop Software
3 3 -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 2 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 22 #include "mainwindow.h"
23 23 #include <QApplication>
24 24 #include <QProcessEnvironment>
25 25 #include <QThread>
26 #include <omp.h>
26 //#include <omp.h>
27 27 #include <qglobal.h>
28 28
29 29 int main(int argc, char *argv[])
30 30 {
31 31 QApplication a(argc, argv);
32 32 QApplication::setOrganizationName("LPP");
33 33 QApplication::setOrganizationDomain("lpp.fr");
34 34 QApplication::setApplicationName("SciQLop");
35 35 MainWindow w;
36 36 w.show();
37 37
38 38 return a.exec();
39 39 }
@@ -1,104 +1,104
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the QLop Software
3 3 -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 2 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 22 #include "mainwindow.h"
23 23 #include "ui_mainwindow.h"
24 24 #include <QAction>
25 25 #include <QDate>
26 26 #include <QDateTime>
27 27 #include <QDir>
28 28 #include <QFileDialog>
29 #include <omp.h>
29 //#include <omp.h>
30 30 //#include <network/filedownloader.h>
31 31 //#include <qlopdatabase.h>
32 32 //#include <qlopsettings.h>
33 33 //#include <qlopgui.h>
34 34 //#include <spacedata.h>
35 35 //#include "qlopcore.h"
36 36 //#include "qlopcodecmanager.h"
37 37 //#include "cdfcodec.h"
38 38 //#include "amdatxtcodec.h"
39 39 //#include <qlopplotmanager.h>
40 40
41 41
42 42 MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
43 43 {
44 44 ui->setupUi(this);
45 45 /* QLopGUI::registerMenuBar(menuBar());
46 46 this->setWindowIcon(QIcon(":/sciqlopLOGO.svg"));
47 47 this->m_progressWidget = new QWidget();
48 48 this->m_progressLayout = new QVBoxLayout(this->m_progressWidget);
49 49 this->m_progressWidget->setLayout(this->m_progressLayout);
50 50 this->m_progressWidget->setWindowModality(Qt::WindowModal);
51 51 m_progressThreadIds = (int*) malloc(OMP_THREADS*sizeof(int));
52 52 for(int i=0;i<OMP_THREADS;i++)
53 53 {
54 54 this->m_progress.append(new QProgressBar(this->m_progressWidget));
55 55 this->m_progress.last()->setMinimum(0);
56 56 this->m_progress.last()->setMaximum(100);
57 57 this->m_progressLayout->addWidget(this->m_progress.last());
58 58 this->m_progressWidget->hide();
59 59 this->m_progressThreadIds[i] = -1;
60 60 }
61 61 this->m_progressWidget->setWindowTitle("Loading File");
62 62 const QList<QLopService*>ServicesToLoad=QList<QLopService*>()
63 63 << QLopCore::self()
64 64 << QLopPlotManager::self()
65 65 << QLopCodecManager::self()
66 66 << FileDownloader::self()
67 67 << QLopDataBase::self()
68 68 << SpaceData::self();
69 69
70 70 CDFCodec::registerToManager();
71 71 AMDATXTCodec::registerToManager();
72 72
73 73
74 74 for(int i=0;i<ServicesToLoad.count();i++)
75 75 {
76 76 qDebug()<<ServicesToLoad.at(i)->serviceName();
77 77 ServicesToLoad.at(i)->initialize(); //must be called before getGUI
78 78 QDockWidget* wdgt=ServicesToLoad.at(i)->getGUI();
79 79 if(wdgt)
80 80 {
81 81 wdgt->setAllowedAreas(Qt::AllDockWidgetAreas);
82 82 this->addDockWidget(Qt::TopDockWidgetArea,wdgt);
83 83 }
84 84 PythonQt::self()->getMainModule().addObject(ServicesToLoad.at(i)->serviceName(),(QObject*)ServicesToLoad.at(i));
85 85 }*/
86 86 }
87 87
88 88 MainWindow::~MainWindow()
89 89 {
90 90 delete ui;
91 91 }
92 92
93 93
94 94 void MainWindow::changeEvent(QEvent *e)
95 95 {
96 96 QMainWindow::changeEvent(e);
97 97 switch (e->type()) {
98 98 case QEvent::LanguageChange:
99 99 ui->retranslateUi(this);
100 100 break;
101 101 default:
102 102 break;
103 103 }
104 104 }
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now