Skip to content
Snippets Groups Projects
Commit 8b3e0619 authored by Administrator's avatar Administrator
Browse files

Create the compile command database for clang-tidy

Add the sytem compiler include paths needed for our static standalone
clang-tidy binary to the list of include paths.
The paths are only added to the compilation units in the generated file
compile_commands.json which is used as input for clang-tidy. Without the
paths clang-tidy can't find the standard C and C++ header files.

The geometries, parameters and input data are not needed when running
clang-tidy, so don't waste time downloading them.
The still downloaded projects include header files which are used by CbmRoot
classes. If these header files are not found by clang-tidy the check of some
compilation units fail.

Use VC in scalar mode, otherwise system and hardware related header files are
needed which couldn't be found.
Fix an issue with an missing header file in KFParticle when using the scalar
VC version.
parent 4d8adfaf
No related branches found
No related tags found
1 merge request!1333Add the possibility to use clang-tidy with CbmRoot
......@@ -231,6 +231,7 @@ If(BUILD_UNITTESTS)
Include(external/InstallGtest.cmake)
endif()
### Subdirectories to be compiled #####
### Externals included and build from several sources
......@@ -238,6 +239,21 @@ endif()
# following targets
add_subdirectory (external)
option(BUILD_FOR_TIDY "Create compile commands database needed by clang-tidy" OFF)
# Add the default compiler include paths needed for our static standalone clang-tidy
# binary. The paths are only added to the compilation units in the generated file
# compile_commands.json which is used as input for clang-tidy. Without the
# paths clang-tidy can't find the standard C and C++ header files.
# Also add special compile options to use the scalar version of VC.
# Otherwise hardware and compiler dependent header files may not be found.
# Since we want to check our code and not some system headers this is
# acceptable.
if(BUILD_FOR_TIDY)
ADD_DEFINITIONS(-DVc_IMPL=Scalar)
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES
${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}
)
endif()
### Base directories
add_subdirectory (core)
......
......@@ -72,14 +72,17 @@ if(DOWNLOAD_EXTERNALS)
Include(InstallAnalysisTree.cmake)
Include(InstallAnalysisTreeQA.cmake)
Include(InstallParameter.cmake)
Include(InstallInput.cmake)
Include(InstallGeometry.cmake)
Include(InstallYamlCpp.cmake)
Include(InstallBBA.cmake)
if(NOT BUILD_FOR_TIDY)
Include(InstallParameter.cmake)
Include(InstallInput.cmake)
Include(InstallGeometry.cmake)
endif()
else()
# Define targets which are needed by CbmRoot but are not available
# whithout the external packages
......
......@@ -14,12 +14,22 @@ if (CMAKE_SYSTEM_NAME MATCHES Darwin AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES arm64
PATCH_COMMAND "patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/KFParticle_applem1.patch"
)
else()
download_project_if_needed(PROJECT kfparticle_source
GIT_REPOSITORY ${KFPARTICLE_SRC_URL}
GIT_TAG ${KFPARTICLE_TAG}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/KFParticle
TEST_FILE CMakeLists.txt
)
if(BUILD_FOR_TIDY)
download_project_if_needed(PROJECT kfparticle_source
GIT_REPOSITORY ${KFPARTICLE_SRC_URL}
GIT_TAG ${KFPARTICLE_TAG}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/KFParticle
TEST_FILE CMakeLists.txt
PATCH_COMMAND "patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/KFParticle_clang_tidy.patch"
)
else()
download_project_if_needed(PROJECT kfparticle_source
GIT_REPOSITORY ${KFPARTICLE_SRC_URL}
GIT_TAG ${KFPARTICLE_TAG}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/KFParticle
TEST_FILE CMakeLists.txt
)
endif()
endif()
If(ProjectUpdated)
......
diff --git a/KFParticle/KFPSimdAllocator.h b/KFParticle/KFPSimdAllocator.h
index 20a13c4..704423f 100644
--- a/KFParticle/KFPSimdAllocator.h
+++ b/KFParticle/KFPSimdAllocator.h
@@ -24,6 +24,8 @@
#include <Vc/Vc>
+#include <mm_malloc.h>
+
/** @class KFPSimdAllocator
** @brief Allocator which is needed to allocate memory in std::vector aligned by the size of SIMD vectors.
** @author M.Zyzak, I.Kisel
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment