From 30eb3b602e55afe2f7dc961526f30790a318b287 Mon Sep 17 00:00:00 2001 From: giwrgostheod Date: Tue, 31 Mar 2020 20:14:12 +0100 Subject: [PATCH] Cleaning CMakeLists and adding clang-format. --- .clang-format | 156 +++++++++++++++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 53 +---------------- 2 files changed, 157 insertions(+), 52 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..7e099f9 --- /dev/null +++ b/.clang-format @@ -0,0 +1,156 @@ +--- +Language: Cpp +# BasedOnStyle: Google +AccessModifierOffset: -1 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: WithoutElse +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakBeforeInheritanceComma: false +BreakInheritanceList: BeforeColon +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 80 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: true +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^' + Priority: 2 + - Regex: '^<.*\.h>' + Priority: 1 + - Regex: '^<.*' + Priority: 2 + - Regex: '.*' + Priority: 3 +IncludeIsMainRegex: '([-_](test|unittest))?$' +IndentCaseLabels: true +IndentPPDirectives: None +IndentWidth: 2 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBinPackProtocolList: Never +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Left +RawStringFormats: + - Language: Cpp + Delimiters: + - cc + - CC + - cpp + - Cpp + - CPP + - 'c++' + - 'C++' + CanonicalDelimiter: '' + BasedOnStyle: google + - Language: TextProto + Delimiters: + - pb + - PB + - proto + - PROTO + EnclosingFunctions: + - EqualsProto + - EquivToProto + - PARSE_PARTIAL_TEXT_PROTO + - PARSE_TEST_PROTO + - PARSE_TEXT_PROTO + - ParseTextOrDie + - ParseTextProtoOrDie + CanonicalDelimiter: '' + BasedOnStyle: google +ReflowComments: true +SortIncludes: true +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Auto +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION +TabWidth: 8 +UseTab: Never +... + diff --git a/CMakeLists.txt b/CMakeLists.txt index b4110a8..190e336 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,50 +22,11 @@ SET(HEADERS SET(HEADERS_DATA_STRUCTURES ) # common source shared -SET(SRC_WINSUM - #WinSum/WinSumBase.cpp - #WinSum/WinSum_addlong.cpp - ) SET(SOURCES ${HEADERS} - #benchmarks/query.cpp - #${SRC_WINSUM} ) -# -- apply to all configurations -#SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -fcilkplus -Wall" ) -#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include utils.h -fdiagnostics-color=auto -D_GLIBCXX_USE_CXX11_ABI=0") -#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include utils.h -fdiagnostics-color=auto") - -#SET(CMAKE_CXX_FLAGS_DEBUG -# "${CMAKE_CXX_FLAGS_DEBUG} -std=c++17 -g -O0 -Wall -Wfatal-errors") #-DHAVE_NUMA -#SET( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11 -g -fcilkplus -Wall -O2" ) -#SET(CMAKE_CXX_FLAGS_RELEASE "-std=c++17 -g -Wall -O3") #-DHAVE_NUMA -#SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} -std=c++11 -g -fcilkplus -Wall") -#if (CMAKE_BUILD_TYPE STREQUAL "Debug") -# add_definitions(-DCONFIG_KAGE_GLOBAL_DEBUG_LEVEL=30) -# # add_definitions(-D_GLIBCXX_DEBUG) # will fail compilation in folly -#endif () -#if (CMAKE_BUILD_TYPE STREQUAL "Release") -# add_definitions(-DCONFIG_KAGE_GLOBAL_DEBUG_LEVEL=50) -# add_definitions(-DNDEBUG) -#endif () -#if (CMAKE_BUILD_TYPE STREQUAL "MinSizeRel") -# add_definitions(-DCONFIG_KAGE_GLOBAL_DEBUG_LEVEL=20) -#endif () - -# SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lboost_date_time" ) SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread") -#SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}" ) -#SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread -L/home/xzl/tmp/boost_1_61_0/stage/lib -static" ) - - -# xzl: tbb will be in the default lib path -#FIND_LIBRARY(tbb NAMES libtbb.so) -#FIND_LIBRARY(tbb NAMES libtbb.so PATHS tbb/lib/intel64/gcc4.7) -#FIND_LIBRARY(tbb_malloc NAMES libtbbmalloc.so PATHS tbb/lib/intel64/gcc4.7) -#TARGET_LINK_LIBRARIES(test.bin boost_date_time boost_system boost_thread numa ${tbb})) - # Boost Library set(Boost_USE_STATIC_LIBS OFF) @@ -73,7 +34,6 @@ set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME OFF) find_package(Boost 1.63.0 COMPONENTS filesystem regex program_options iostreams) - # VTune directory set(VTUNE_DIR ${VTUNE_HOME}/vtune_amplifier) #${VTUNE_HOME}/vtune_amplifier)#"/media/george/DATA/intel/vtune_amplifier") @@ -81,15 +41,4 @@ include_directories(${VTUNE_DIR}/include) #include_directories(/media/george/DATA/intel/vtune_amplifier/lib64) #link_directories(/media/george/DATA/intel/vtune_amplifier/lib64) #include_directories(/media/george/DATA/intel/vtune_amplifier/lib64/runtime) -#link_directories(/media/george/DATA/intel/vtune_amplifier/lib64/runtime) - -# Locate GTest -#find_package(GTest REQUIRED) -#include_directories(${GTEST_INCLUDE_DIRS}) -#target_link_libraries(runTests ${GTEST_LIBRARIES} pthread) - -# Locate GBenchmark -#find_package(benchmark REQUIRED) -#include_directories(${benchmark_INCLUDE_DIRS}) -#target_link_libraries(runTests ${benchmark_LIBRARIES} pthread) - +#link_directories(/media/george/DATA/intel/vtune_amplifier/lib64/runtime) \ No newline at end of file