Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Install dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake libgtest-dev g++ clang-format-19
sudo apt-get install -y build-essential cmake libgtest-dev g++ clang-format-20 clang-tidy-20
pip install cmake-format

- name: Install dependencies (macOS)
Expand All @@ -43,14 +43,8 @@ jobs:
run: |
cmake --workflow release-test

- name: Clang-tidy
id: clang-tidy
if: matrix.os == 'ubuntu-latest'
run: |
cmake --workflow test

- name: Check formatting
id: check-format
if: always() && matrix.os == 'ubuntu-latest'
run: |
cmake --workflow check-format
cmake --workflow format-check
115 changes: 57 additions & 58 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ target_include_directories(

target_link_libraries(COLA PRIVATE tinyxml2)

set(COLA_CMAKE_CXX_CLANG_TIDY
""
CACHE STRING "variable will be passed to CMAKE_CXX_CLANG_TIDY of COLA target"
)

# Public headers for proper target installation
set(COLA_PUBLIC_HEADERS "COLA.hh" "COLA/EventData.hh" "COLA/LorentzVector.hh")

Expand All @@ -51,59 +46,63 @@ set_target_properties(
PROPERTIES PUBLIC_HEADER "${COLA_PUBLIC_HEADERS}"
VERSION "${COLA_VERSION}"
SOVERSION "${COLA_VERSION_MAJOR}"
CXX_CLANG_TIDY "${COLA_CMAKE_CXX_CLANG_TIDY}"
)

include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

install(
TARGETS COLA
EXPORT COLAExport
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
INCLUDES
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

configure_package_config_file(
"${PROJECT_SOURCE_DIR}/data/COLAConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/COLAConfig.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/COLA
)

write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/COLAConfigVersion.cmake COMPATIBILITY AnyNewerVersion
)

install(EXPORT COLAExport DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/COLA)

# install(
# DIRECTORY ${PROJECT_SOURCE_DIR}/COLA
# DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
# FILES_MATCHING
# PATTERN "*.hh"
# )

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/COLAConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/COLAConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/COLA
)

install(FILES "${PROJECT_SOURCE_DIR}/data/config.sh"
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}
)

install(
DIRECTORY cmake/
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/COLA/cmake
FILES_MATCHING
PATTERN "*.cmake"
)

enable_testing()
if (BUILD_TESTING)
add_subdirectory(tests)
# Check for COLA_FETCH_MODE to prevent install instructions from generating
if (NOT DEFINED ENV{COLA_FETCH_MODE})

include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

install(
TARGETS COLA
EXPORT COLAExport
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
INCLUDES
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

configure_package_config_file(
"${PROJECT_SOURCE_DIR}/data/COLAConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/COLAConfig.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/COLA
)

write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/COLAConfigVersion.cmake COMPATIBILITY AnyNewerVersion
)

install(EXPORT COLAExport DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/COLA)

# install(
# DIRECTORY ${PROJECT_SOURCE_DIR}/COLA
# DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
# FILES_MATCHING
# PATTERN "*.hh"
# )

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/COLAConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/COLAConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/COLA
)

install(FILES "${PROJECT_SOURCE_DIR}/data/config.sh"
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}
)

install(
DIRECTORY cmake/
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/COLA/cmake
FILES_MATCHING
PATTERN "*.cmake"
)

enable_testing()
if (BUILD_TESTING)
add_subdirectory(tests)
endif ()

include(cmake/COLAQualityTools.cmake)
setup_cola_quality_tools(EXCLUDE_PATTERNS ".*/tinyxml2/.*")
endif ()

include(cmake/COLAQualityTools.cmake)
setup_cola_quality_tools(EXCLUDE_PATTERNS ".*/tinyxml2/.*")
93 changes: 53 additions & 40 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,12 @@
"BUILD_TESTING": "ON"
}
},
{
"name": "tidy",
"displayName": "Clang-tidy",
"inherits": "default",
"cacheVariables": {
"BUILD_TESTING": "ON",
"COLA_CMAKE_CXX_CLANG_TIDY": "clang-tidy"
}
},
{
"name": "tidy-fix",
"displayName": "Clang-tidy fix",
{
"name": "default-test",
"displayName": "Default with Tests",
"inherits": "default",
"cacheVariables": {
"BUILD_TESTING": "ON",
"COLA_CMAKE_CXX_CLANG_TIDY": "clang-tidy;--fix"
"BUILD_TESTING": "ON"
}
}
],
Expand All @@ -81,64 +71,87 @@
"displayName": "Release Test Build",
"configurePreset": "release-test"
},
{
"name": "default-test",
"displayName": "Default with Tests",
"configurePreset": "default-test"
},
{
"name": "tidy",
"displayName": "Tidy Build",
"configurePreset": "tidy"
"name": "clang-tidy-check",
"displayName": "Check clang-tidy",
"configurePreset": "default-test",
"targets": ["clang-tidy-check"]
},
{
"name": "tidy-fix",
"displayName": "Tidy fix Build",
"configurePreset": "tidy-fix"
"displayName": "Check and fix clang-tidy",
"configurePreset": "default-test",
"targets": ["clang-tidy-fix"]
},
{
"name": "clang-format-check",
"displayName": "Check clang-format",
"configurePreset": "tidy",
"configurePreset": "default",
"targets": ["clang-format-check"]
},
{
"name": "clang-format-fix",
"displayName": "Fix clang-format",
"configurePreset": "tidy",
"configurePreset": "default",
"targets": ["clang-format-fix"]
},
{
"name": "cmake-format-check",
"displayName": "Check cmake-format",
"configurePreset": "tidy",
"configurePreset": "default",
"targets": ["cmake-format-check"]
},
{
"name": "cmake-format-fix",
"displayName": "Fix cmake-format",
"configurePreset": "tidy",
"configurePreset": "default",
"targets": ["cmake-format-fix"]
},
{
"name": "check-format",
"name": "format-check",
"displayName": "Check all linters",
"configurePreset": "tidy",
"configurePreset": "default-test",
"targets": [
"clang-format-check",
"cmake-format-check"
"cmake-format-check",
"clang-tidy-check"
]
},
{
"name": "fix-format",
"name": "format-fix",
"displayName": "Fix all linters",
"configurePreset": "tidy",
"configurePreset": "default-test",
"targets": [
"clang-format-fix",
"cmake-format-fix"
"cmake-format-fix",
"clang-tidy-fix"
]
},
{
"name": "default-install",
"displayName": "Install the default configuration",
"configurePreset": "default",
"inherits": "default",
"targets": ["install"]
},
{
"name": "release-install",
"displayName": "Install the release configuration",
"configurePreset": "release",
"inherits": "release",
"targets": ["install"]
}
],
"testPresets": [
{
"name": "default",
"displayName": "Run Debug Tests",
"configurePreset": "tidy",
"configurePreset": "default-test",
"output": {
"outputOnFailure": true
}
Expand Down Expand Up @@ -168,16 +181,16 @@
]
},
{
"name": "test",
"displayName": "Test Workflow (with linter checks)",
"name": "default-test",
"displayName": "Test Workflow",
"steps": [
{
"type": "configure",
"name": "tidy"
"name": "default-test"
},
{
"type": "build",
"name": "tidy"
"name": "default-test"
},
{
"type": "test",
Expand All @@ -186,30 +199,30 @@
]
},
{
"name": "check-format",
"name": "format-check",
"displayName": "Check All Linters Workflow",
"steps": [
{
"type": "configure",
"name": "tidy"
"name": "default-test"
},
{
"type": "build",
"name": "check-format"
"name": "format-check"
}
]
},
{
"name": "fix-format",
"name": "format-fix",
"displayName": "Fix All Linters Workflow",
"steps": [
{
"type": "configure",
"name": "tidy"
"name": "default-test"
},
{
"type": "build",
"name": "fix-format"
"name": "format-fix"
}
]
},
Expand Down
3 changes: 2 additions & 1 deletion COLA/LorentzVector.hh
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
#ifndef COLA_LORENTZVECTOR_HH
#define COLA_LORENTZVECTOR_HH

#include <sys/types.h>

#include <array>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <stdexcept>
#include <type_traits>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ Generated documentation will be located in the ```docs/compiled/``` folder.

## COLA Modules

Currently there is only a [minimal module + program example](https://github.com/apBUSampK/COLA-min-example) with some guidelines on module writing.
Currently there is a [minimal module + program example](https://github.com/apBUSampK/COLA-min-example) with some guidelines on module writing, as well as [AAMCC-COLA](https://github.com/Spectator-matter-group-INR-RAS/AAMCC-COLA), a COLA implementation of AAMCC-MST model, along with relevant modules.
6 changes: 3 additions & 3 deletions cmake/COLAQualityTools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ function (setup_cola_quality_tools)
set(EXCLUDE_PATTERNS ${DEFAULT_EXCLUDE_PATTERNS} ${QUALITY_EXCLUDE_PATTERNS})

find_program(
CLANG_FORMAT_EXE NAMES clang-format-21 clang-format-20 clang-format-19 clang-format
CLANG_FORMAT_EXE NAMES clang-format clang-format-20
)
find_program(CLANG_TIDY_EXE NAMES clang-tidy-21 clang-tidy-20 clang-tidy-19 clang-tidy)
find_program(CLANG_TIDY_EXE NAMES clang-tidy clang-tidy-20)
find_program(CMAKE_FORMAT_EXE NAMES cmake-format)

file(
Expand Down Expand Up @@ -55,7 +55,7 @@ function (setup_cola_quality_tools)

add_custom_target(
clang-tidy-fix
COMMAND ${CLANG_TIDY_EXE} -p ${CMAKE_BINARY_DIR} -fix ${CPP_SOURCES}
COMMAND ${CLANG_TIDY_EXE} -p ${CMAKE_BINARY_DIR} --fix ${CPP_SOURCES}
COMMENT "Run clang-tidy with fixes"
)
message(STATUS "clang-tidy: ${CLANG_TIDY_EXE}")
Expand Down
1 change: 1 addition & 0 deletions data/COLAConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ include(@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/cmake/COLA/COLAExport.cmak
include(@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_DATAROOTDIR@/COLA/cmake/COLAQualityTools.cmake)

set_and_check(COLA_DIR @CMAKE_INSTALL_PREFIX@)
set_and_check(COLA_EVENT_DATA @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/EventData.hh)
Loading
Loading