Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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
62 changes: 35 additions & 27 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
# BasedOnStyle: LLVM
AccessModifierOffset: -3
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveAssignments: None
# This would be nice to have but seems to also (mis)align function parameters
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: true
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
# This option is "deprecated and is retained for backwards compatibility."
# AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: true
AfterNamespace: false
Expand All @@ -32,33 +33,20 @@ BraceWrapping:
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 3
ContinuationIndentWidth: 3
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^("|<)T'
Priority: 4
- Regex: '^("|<)ROOT/'
Priority: 5
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 6
IndentCaseLabels: false
IndentWidth: 3
IndentWrappedFunctionNames: false
Expand All @@ -75,12 +63,14 @@ PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60000
PenaltyReturnTypeOnItsOwnLine: 10
PointerAlignment: Right
ReflowComments: true
SortIncludes: false
ReflowComments: true
SortIncludes: Never
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
# You want this : enable it if you have https://reviews.llvm.org/D32525
# SpaceBeforeColon: false
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
Expand All @@ -89,6 +79,24 @@ SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
Standard: c++17
TabWidth: 3
UseTab: Never

# Order alphabetically and by generality the included header files.
IncludeCategories:
- Regex: '^"[^/]+\"'
Priority: 10
- Regex: '^("|<)T'
Priority: 12
- Regex: '^"ROOT/'
Priority: 15
- Regex: '^"cling/'
Priority: 20
- Regex: '^"clang/'
Priority: 30
- Regex: '^"llvm/'
Priority: 40
- Regex: '^<'
Priority: 50

76 changes: 76 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
Checks: >
-*,
bugprone-*,
clang-diagnostic-*,
clang-analyzer-*,
cppcoreguidelines-*,
llvm-*,
misc-*,
modernize-*,
performance-*,
portability-*,
readability-*,
-bugprone-narrowing-conversions,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-unchecked-optional-access,
-misc-const-correctness,
-misc-unused-parameters,
-misc-non-private-member-variables-in-classes,
-misc-no-recursion,
-misc-use-anonymous-namespace,
-modernize-return-braced-init-list,
-modernize-use-trailing-return-type,
-readability-braces-around-statements,
-readability-identifier-length,
-readability-magic-numbers,
-readability-named-parameter,
-readability-function-cognitive-complexity,
-readability-implicit-bool-conversion,
-cppcoreguidelines-avoid-magic-numbers,
-clang-analyzer-cplusplus.NewDeleteLeaks,

CheckOptions:
- key: readability-identifier-naming.ClassCase
value: aNy_CasE
- key: readability-identifier-naming.FunctionCase
value: aNy_CasE
- key: readability-identifier-naming.MemberCase
value: aNy_CasE
- key: readability-identifier-naming.PrivateMemberPrefix
value: 'm_'
- key: readability-identifier-naming.ProtectedMemberPrefix
value: 'm_'
- key: readability-identifier-naming.PublicMemberPrefix
value: ''
- key: readability-identifier-naming.ParameterCase
value: aNy_CasE
- key: readability-identifier-naming.UnionCase
value: CamelCase
- key: readability-identifier-naming.VariableCase
value: aNy_CasE
- key: readability-identifier-naming.IgnoreMainLikeFunctions
value: 1
- key: readability-implicit-bool-conversion.AllowPointerConditions
value: 1
- key: readability-magic-numbers.IgnorePowersOf2IntegerValues
value: 1
- key: readability-magic-numbers.IgnoredIntegerValues
value: 4;8;16;
- key: bugprone-argument-comment.CommentNullPtrs
value: 1
- key: bugprone-argument-comment.CommentBoolLiterals
value: 1
- key: bugprone-argument-comment.StrictMode
value: 1
- key: bugprone-argument-comment.CommentIntegerLiterals
value: 1
- key: bugprone-argument-comment.CommentUserDefinedLiterals
value: 1
- key: bugprone-argument-comment.CommentStringLiterals
value: 1
- key: bugprone-argument-comment.CommentFloatLiterals
value: 1
- key: bugprone-argument-comment.CommentCharacterLiterals
value: 1

6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@ tmp/
*.bk
*.rootix
*.sam
build/
cmake-build-*/
Build/
BUILD/
Testing/
.vscode/
88 changes: 63 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,44 +1,82 @@
cmake_minimum_required(VERSION 3.16)
project(ramtools VERSION 1.0.0 LANGUAGES CXX)

project(ramtools LANGUAGES CXX)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

find_package(ROOT 6.26 REQUIRED
COMPONENTS Core RIO Tree ROOTNTuple)
option(RAMTOOLS_BUILD_TESTS "Build unit tests" ON)
option(RAMTOOLS_BUILD_BENCHMARKS "Build benchmarks" ON)
option(RAMTOOLS_BUILD_TOOLS "Build tools" ON)

set(RNTUPLE_LIBS ROOT::ROOTNTuple ROOT::ROOTNTupleUtil)
find_package(ROOT 6.26 REQUIRED COMPONENTS Core RIO Tree ROOTNTuple ROOTNTupleUtil)

include(${ROOT_USE_FILE})

include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/rntuple)
add_library(ramtools_tree SHARED
src/ttree/RAMRecord.cxx
)

target_include_directories(ramtools_tree PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<INSTALL_INTERFACE:include>
)

set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/inc)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the same as include_directories. Why do we need this to be set globally?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still confused about this, not able to implement removing include directories.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will need more information about that. Compiling which library fails if you remove that line?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some changes, what do you think about it now?


ROOT_GENERATE_DICTIONARY(G__ramtools_tree
ttree/RAMRecord.h
ttree/Utils.h
ttree/CigarOps.h
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/inc/ttree/LinkDef.h
MODULE ramtools_tree
)

ROOT_STANDARD_LIBRARY_PACKAGE(ramrecord
SOURCES ramrecord.C
HEADERS ramrecord.h
LIBRARIES ROOT::Core ROOT::RIO ROOT::Tree
target_link_libraries(ramtools_tree PUBLIC
ROOT::Core
ROOT::RIO
ROOT::Tree
)

set(RAMTOOLS_ROOT_LIBS ROOT::Core ROOT::RIO ROOT::Tree)
add_library(ramtools_ntuple SHARED

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this is a separate library?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it was better to separate them but now will make it one.

src/rntuple/RAMNTupleRecord.cxx
)
target_include_directories(ramtools_ntuple PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(ramtools_ntuple PUBLIC
ROOT::Core
ROOT::RIO
ROOT::Tree
ROOT::ROOTNTuple
ROOT::ROOTNTupleUtil
)

install(TARGETS ramtools_tree ramtools_ntuple
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(DIRECTORY inc/ DESTINATION include)

ROOT_STANDARD_LIBRARY_PACKAGE(ramntuplerecord
SOURCES rntuple/RAMntuplerecord.C
HEADERS rntuple/RAMNTupleRecord.h
LIBRARIES ROOT::Core ROOT::RIO ROOT::Tree ${RNTUPLE_LIBS}
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/libramtools_tree_rdict.pcm
${CMAKE_CURRENT_BINARY_DIR}/libramtools_tree.rootmap
DESTINATION lib
)

ROOT_EXECUTABLE(samtoramntuple
rntuple/samtoramntuple.C
LIBRARIES ramntuplerecord ${RAMTOOLS_ROOT_LIBS} ${RNTUPLE_LIBS})
if(RAMTOOLS_BUILD_TOOLS)
add_subdirectory(tools)
endif()

include(CTest)
file(GLOB RAMTESTS tests/test_*.C)
foreach(testfile ${RAMTESTS})
get_filename_component(testname ${testfile} NAME_WE)
add_test(NAME ${testname}
COMMAND root -l -b -q ${testfile}+)
set_tests_properties(${testname} PROPERTIES WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endforeach()
if(RAMTOOLS_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif()

if(RAMTOOLS_BUILD_BENCHMARKS)
add_subdirectory(benchmark)
endif()
9 changes: 0 additions & 9 deletions LinkDef.h

This file was deleted.

2 changes: 2 additions & 0 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Benchmark targets can be added here in future

File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions cmake/ramtoolsConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/ramtoolsTargets.cmake")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this file needed?

Loading