-
Administrator authored
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.
Administrator authoredAdd 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.
InstallKFParticle.cmake 4.27 KiB
set(KFPARTICLE_LIBNAME "${CMAKE_SHARED_LIBRARY_PREFIX}KFParticle${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(KFPARTICLE_SRC_URL "https://github.com/cbmsw/KFParticle.git")
set(KFPARTICLE_DESTDIR "${CMAKE_BINARY_DIR}/external/KFPARTICLE-prefix")
set(KFPARTICLE_TAG "9b11e3e9da4e0896af80701210d19f7ca69c39d4")
# GIT_TAG is a hash for KFParticle tag cbm/v1.1-1
if (CMAKE_SYSTEM_NAME MATCHES Darwin AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES arm64)
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_applem1.patch"
)
else()
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)
File(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/external/KFPARTICLE-prefix)
Message("KFParticle source directory was changed so build directory was deleted")
EndIf()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/include)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/include)
endif()
ExternalProject_Add(KFPARTICLE
DEPENDS ${KF_DEPENDS_ON}
BUILD_IN_SOURCE 0
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/KFParticle
BUILD_BYPRODUCTS ${KFPARTICLE_LIBRARY}
LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1
CMAKE_ARGS -G ${CMAKE_GENERATOR}
-DCMAKE_BUILD_TYPE=RELWITHDEBINFO
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}
-DVc_INCLUDE_DIR=${Vc_INCLUDE_DIR}
-DVc_LIBRARIES=${Vc_LIBRARY}
-DFIXTARGET=TRUE
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
-DCMAKE_MACOSX_RPATH=TRUE
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install
)
add_library(KFParticle SHARED IMPORTED GLOBAL)
set_target_properties(KFParticle PROPERTIES
IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}KFParticle${CMAKE_SHARED_LIBRARY_SUFFIX}
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/include)
target_link_libraries(KFParticle INTERFACE Vc::Vc)
add_dependencies(KFParticle KFPARTICLE)
Install(FILES ${CMAKE_BINARY_DIR}/lib/${KFPARTICLE_LIBNAME}
${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}KFParticle.rootmap
${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}KFParticle_rdict.pcm
DESTINATION lib
)
Install(FILES ${CMAKE_BINARY_DIR}/include/KFParticleBase.h
${CMAKE_BINARY_DIR}/include/KFParticle.h
${CMAKE_BINARY_DIR}/include/KFVertex.h
DESTINATION include/KFParticle
)
Install(FILES ${CMAKE_BINARY_DIR}/include/KFMCParticle.h
${CMAKE_BINARY_DIR}/include/KFPartEfficiencies.h
DESTINATION include/KFParticlePerformance
)
Install(FILES ${CMAKE_BINARY_DIR}/include/KFParticleTest.h
DESTINATION include/KFParticleTest
)
Install(FILES ${CMAKE_BINARY_DIR}/include/KFPVertex.h
${CMAKE_BINARY_DIR}/include/KFMCCounter.h
DESTINATION include
)