mirror of https://github.com/tstack/lnav
[build] run cmake-init and switch from hunter to conan for packages
parent
a0ee4427a6
commit
d0ba84d9be
@ -0,0 +1,178 @@
|
||||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: Chromium
|
||||
AccessModifierOffset: -2
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveMacros: false
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveBitFields: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: DontAlign
|
||||
AlignOperands: DontAlign
|
||||
AlignTrailingComments: false
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllConstructorInitializersOnNextLine: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortEnumsOnASingleLine: false
|
||||
AllowShortBlocksOnASingleLine: Empty
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: true
|
||||
AfterControlStatement: MultiLine
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
AfterExternBlock: true
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
BeforeLambdaBody: true
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
BreakBeforeBraces: Custom
|
||||
# BreakBeforeInheritanceComma: true
|
||||
BreakInheritanceList: BeforeComma
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: true
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
BreakAfterJavaFieldAnnotations: true
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 80
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DeriveLineEnding: false
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
# Standard library headers come before anything else
|
||||
- Regex: '^<[a-z_]+>'
|
||||
Priority: -1
|
||||
- Regex: '^<.+\.h(pp)?>'
|
||||
Priority: 1
|
||||
- Regex: '^<.*'
|
||||
Priority: 2
|
||||
- Regex: '.*'
|
||||
Priority: 3
|
||||
IncludeIsMainRegex: ''
|
||||
IncludeIsMainSourceRegex: ''
|
||||
IndentCaseLabels: true
|
||||
IndentCaseBlocks: false
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: AfterHash
|
||||
IndentExternBlock: NoIndent
|
||||
IndentWidth: 2
|
||||
IndentWrappedFunctionNames: false
|
||||
InsertTrailingCommas: Wrapped
|
||||
JavaScriptQuotes: Double
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Never
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCBreakBeforeNestedBlockParam: true
|
||||
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
|
||||
- ParseTestProto
|
||||
- ParsePartialTestProto
|
||||
CanonicalDelimiter: ''
|
||||
BasedOnStyle: google
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: false
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCpp11BracedList: true
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatementsExceptForEachMacros
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 2
|
||||
SpacesInAngles: false
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
SpaceBeforeSquareBrackets: false
|
||||
Standard: Auto
|
||||
StatementMacros:
|
||||
- Q_UNUSED
|
||||
- QT_REQUIRE_VERSION
|
||||
TabWidth: 8
|
||||
UseCRLF: false
|
||||
UseTab: Never
|
||||
WhitespaceSensitiveMacros:
|
||||
- STRINGIZE
|
||||
- PP_STRINGIZE
|
||||
- BOOST_PP_STRINGIZE
|
||||
...
|
@ -0,0 +1,154 @@
|
||||
---
|
||||
# Enable ALL the things! Except not really
|
||||
# misc-non-private-member-variables-in-classes: the options don't do anything
|
||||
Checks: "*,\
|
||||
-google-readability-todo,\
|
||||
-altera-unroll-loops,\
|
||||
-fuchsia-*,\
|
||||
fuchsia-multiple-inheritance,\
|
||||
-llvm-header-guard,\
|
||||
-llvm-include-order,\
|
||||
-llvmlibc-*,\
|
||||
-modernize-use-trailing-return-type,\
|
||||
-misc-non-private-member-variables-in-classes"
|
||||
WarningsAsErrors: ''
|
||||
CheckOptions:
|
||||
- key: 'bugprone-argument-comment.StrictMode'
|
||||
value: 'true'
|
||||
# Prefer using enum classes with 2 values for parameters instead of bools
|
||||
- key: 'bugprone-argument-comment.CommentBoolLiterals'
|
||||
value: 'true'
|
||||
- key: 'bugprone-misplaced-widening-cast.CheckImplicitCasts'
|
||||
value: 'true'
|
||||
- key: 'bugprone-sizeof-expression.WarnOnSizeOfIntegerExpression'
|
||||
value: 'true'
|
||||
- key: 'bugprone-suspicious-string-compare.WarnOnLogicalNotComparison'
|
||||
value: 'true'
|
||||
- key: 'readability-simplify-boolean-expr.ChainedConditionalReturn'
|
||||
value: 'true'
|
||||
- key: 'readability-simplify-boolean-expr.ChainedConditionalAssignment'
|
||||
value: 'true'
|
||||
- key: 'readability-uniqueptr-delete-release.PreferResetCall'
|
||||
value: 'true'
|
||||
- key: 'cppcoreguidelines-init-variables.MathHeader'
|
||||
value: '<cmath>'
|
||||
- key: 'cppcoreguidelines-narrowing-conversions.PedanticMode'
|
||||
value: 'true'
|
||||
- key: 'readability-else-after-return.WarnOnUnfixable'
|
||||
value: 'true'
|
||||
- key: 'readability-else-after-return.WarnOnConditionVariables'
|
||||
value: 'true'
|
||||
- key: 'readability-inconsistent-declaration-parameter-name.Strict'
|
||||
value: 'true'
|
||||
- key: 'readability-qualified-auto.AddConstToQualified'
|
||||
value: 'true'
|
||||
- key: 'readability-redundant-access-specifiers.CheckFirstDeclaration'
|
||||
value: 'true'
|
||||
# These seem to be the most common identifier styles
|
||||
- key: 'readability-identifier-naming.AbstractClassCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.ClassCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.ClassConstantCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.ClassMemberCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.ClassMethodCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.ConstantCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.ConstantMemberCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.ConstantParameterCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.ConstantPointerParameterCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.ConstexprFunctionCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.ConstexprMethodCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.ConstexprVariableCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.EnumCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.EnumConstantCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.FunctionCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.GlobalConstantCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.GlobalConstantPointerCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.GlobalFunctionCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.GlobalPointerCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.GlobalVariableCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.InlineNamespaceCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.LocalConstantCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.LocalConstantPointerCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.LocalPointerCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.LocalVariableCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.MacroDefinitionCase'
|
||||
value: 'UPPER_CASE'
|
||||
- key: 'readability-identifier-naming.MemberCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.MethodCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.NamespaceCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.ParameterCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.ParameterPackCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.PointerParameterCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.PrivateMemberCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.PrivateMemberPrefix'
|
||||
value: 'm_'
|
||||
- key: 'readability-identifier-naming.PrivateMethodCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.ProtectedMemberCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.ProtectedMemberPrefix'
|
||||
value: 'm_'
|
||||
- key: 'readability-identifier-naming.ProtectedMethodCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.PublicMemberCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.PublicMethodCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.ScopedEnumConstantCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.StaticConstantCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.StaticVariableCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.StructCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.TemplateParameterCase'
|
||||
value: 'CamelCase'
|
||||
- key: 'readability-identifier-naming.TemplateTemplateParameterCase'
|
||||
value: 'CamelCase'
|
||||
- key: 'readability-identifier-naming.TypeAliasCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.TypedefCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.TypeTemplateParameterCase'
|
||||
value: 'CamelCase'
|
||||
- key: 'readability-identifier-naming.UnionCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.ValueTemplateParameterCase'
|
||||
value: 'CamelCase'
|
||||
- key: 'readability-identifier-naming.VariableCase'
|
||||
value: 'lower_case'
|
||||
- key: 'readability-identifier-naming.VirtualMethodCase'
|
||||
value: 'lower_case'
|
||||
...
|
@ -0,0 +1,6 @@
|
||||
[codespell]
|
||||
builtin = clear,rare,en-GB_to_en-US,names,informal,code
|
||||
check-filenames =
|
||||
check-hidden =
|
||||
skip = */.git,*/build,*/prefix,*/conan
|
||||
quiet-level = 2
|
@ -1,60 +1,57 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused-parameter")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
|
||||
|
||||
include("cmake/HunterGate.cmake")
|
||||
huntergate(URL "https://github.com/cpp-pm/hunter/archive/v0.24.0.tar.gz"
|
||||
SHA1 "a3d7f4372b1dcd52faa6ff4a3bd5358e1d0e5efd"
|
||||
LOCAL)
|
||||
include(cmake/prelude.cmake)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
project(lnav VERSION 0.10.2)
|
||||
|
||||
# include(cmake/CodeCoverage.cmake) append_coverage_compiler_flags()
|
||||
|
||||
include(CTest)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
hunter_add_package(libpcre)
|
||||
find_package(libpcre CONFIG REQUIRED)
|
||||
|
||||
hunter_add_package(BZip2)
|
||||
find_package(BZip2 CONFIG REQUIRED)
|
||||
|
||||
hunter_add_package(sqlite3)
|
||||
find_package(sqlite3 CONFIG REQUIRED)
|
||||
|
||||
hunter_add_package(ZLIB)
|
||||
project(
|
||||
lnav
|
||||
VERSION 0.10.2
|
||||
DESCRIPTION "An advanced log file viewer for the small-scale."
|
||||
HOMEPAGE_URL "https://lnav.org/"
|
||||
LANGUAGES CXX C
|
||||
)
|
||||
|
||||
include(cmake/project-is-top-level.cmake)
|
||||
include(cmake/variables.cmake)
|
||||
|
||||
find_package(SQLite3 REQUIRED)
|
||||
find_package(BZip2 REQUIRED)
|
||||
find_package(LibArchive REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
hunter_add_package(CURL)
|
||||
find_package(CURL CONFIG REQUIRED)
|
||||
|
||||
hunter_add_package(ncursesw)
|
||||
find_package(ncursesw CONFIG REQUIRED)
|
||||
|
||||
hunter_add_package(readline)
|
||||
find_package(pcre REQUIRED)
|
||||
find_package(readline REQUIRED)
|
||||
|
||||
hunter_add_package(libarchive)
|
||||
find_package(libarchive CONFIG REQUIRED)
|
||||
find_package(ncurses REQUIRED)
|
||||
find_package(CURL REQUIRED)
|
||||
|
||||
set(lnav_LIBS
|
||||
ZLIB::zlib
|
||||
BZip2::bz2
|
||||
sqlite3::sqlite3
|
||||
PkgConfig::libpcre
|
||||
CURL::libcurl
|
||||
SQLite::SQLite3
|
||||
BZip2::BZip2
|
||||
ncurses::libcurses
|
||||
pcre::libpcre
|
||||
readline::readline
|
||||
readline::history
|
||||
PkgConfig::ncursesw
|
||||
PkgConfig::libarchive)
|
||||
LibArchive::LibArchive
|
||||
ZLIB::ZLIB
|
||||
)
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(test)
|
||||
|
||||
# ---- Install rules ----
|
||||
|
||||
if(NOT CMAKE_SKIP_INSTALL_RULES)
|
||||
include(cmake/install-rules.cmake)
|
||||
endif()
|
||||
|
||||
# ---- Developer mode ----
|
||||
|
||||
if(NOT lnav_DEVELOPER_MODE)
|
||||
return()
|
||||
elseif(NOT PROJECT_IS_TOP_LEVEL)
|
||||
message(
|
||||
AUTHOR_WARNING
|
||||
"Developer mode is intended for developers of lnav"
|
||||
)
|
||||
endif()
|
||||
|
||||
include(cmake/dev-mode.cmake)
|
||||
|
@ -0,0 +1,142 @@
|
||||
{
|
||||
"version": 2,
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 14,
|
||||
"patch": 0
|
||||
},
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "cmake-pedantic",
|
||||
"hidden": true,
|
||||
"warnings": {
|
||||
"dev": true,
|
||||
"deprecated": true,
|
||||
"uninitialized": true,
|
||||
"unusedCli": true,
|
||||
"systemVars": false
|
||||
},
|
||||
"errors": {
|
||||
"dev": true,
|
||||
"deprecated": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "dev-mode",
|
||||
"hidden": true,
|
||||
"inherits": "cmake-pedantic",
|
||||
"cacheVariables": {
|
||||
"lnav_DEVELOPER_MODE": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "conan",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/conan/conan_toolchain.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "cppcheck",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_CXX_CPPCHECK": "cppcheck;--inline-suppr"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "clang-tidy",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_CXX_CLANG_TIDY": "clang-tidy;--header-filter=${sourceDir}/*"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ci-std",
|
||||
"description": "This preset makes sure the project actually builds with at least the specified standard",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_CXX_EXTENSIONS": "OFF",
|
||||
"CMAKE_CXX_STANDARD": "14",
|
||||
"CMAKE_CXX_STANDARD_REQUIRED": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "flags-unix",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_CXX_FLAGS": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "flags-windows",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_CXX_FLAGS": "/W4 /permissive- /utf-8 /volatile:iso /EHsc /Zc:__cplusplus /Zc:throwingNew"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ci-unix",
|
||||
"generator": "Unix Makefiles",
|
||||
"hidden": true,
|
||||
"inherits": ["flags-unix", "ci-std"],
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ci-win64",
|
||||
"inherits": ["flags-windows", "ci-std"],
|
||||
"generator": "Visual Studio 17 2022",
|
||||
"architecture": "x64",
|
||||
"hidden": true
|
||||
},
|
||||
{
|
||||
"name": "coverage-unix",
|
||||
"binaryDir": "${sourceDir}/build/coverage",
|
||||
"inherits": "ci-unix",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"ENABLE_COVERAGE": "ON",
|
||||
"CMAKE_BUILD_TYPE": "Coverage",
|
||||
"CMAKE_CXX_FLAGS_COVERAGE": "-Og -g --coverage -fkeep-inline-functions -fkeep-static-functions",
|
||||
"CMAKE_EXE_LINKER_FLAGS_COVERAGE": "--coverage",
|
||||
"CMAKE_SHARED_LINKER_FLAGS_COVERAGE": "--coverage",
|
||||
"CMAKE_MAP_IMPORTED_CONFIG_SANITIZE": "Coverage;RelWithDebInfo;Release;Debug;"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ci-coverage",
|
||||
"inherits": ["coverage-unix", "dev-mode", "conan"],
|
||||
"cacheVariables": {
|
||||
"COVERAGE_HTML_COMMAND": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ci-sanitize",
|
||||
"binaryDir": "${sourceDir}/build/sanitize",
|
||||
"inherits": ["ci-unix", "dev-mode", "conan"],
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Sanitize",
|
||||
"CMAKE_CXX_FLAGS_SANITIZE": "-O2 -g -fsanitize=address,undefined -fno-omit-frame-pointer -fno-common",
|
||||
"CMAKE_MAP_IMPORTED_CONFIG_SANITIZE": "Sanitize;RelWithDebInfo;Release;Debug;"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ci-build",
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"hidden": true
|
||||
},
|
||||
{
|
||||
"name": "ci-macos",
|
||||
"inherits": ["ci-build", "ci-unix", "dev-mode", "conan"]
|
||||
},
|
||||
{
|
||||
"name": "ci-ubuntu",
|
||||
"inherits": ["ci-build", "ci-unix", "clang-tidy", "conan", "dev-mode"]
|
||||
},
|
||||
{
|
||||
"name": "ci-windows",
|
||||
"inherits": ["ci-build", "ci-win64", "dev-mode", "conan"]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
# ---- Variables ----
|
||||
|
||||
# We use variables separate from what CTest uses, because those have
|
||||
# customization issues
|
||||
set(
|
||||
COVERAGE_TRACE_COMMAND
|
||||
lcov -c -q
|
||||
-o "${PROJECT_BINARY_DIR}/coverage.info"
|
||||
-d "${PROJECT_BINARY_DIR}"
|
||||
--include "${PROJECT_SOURCE_DIR}/*"
|
||||
CACHE STRING
|
||||
"; separated command to generate a trace for the 'coverage' target"
|
||||
)
|
||||
|
||||
set(
|
||||
COVERAGE_HTML_COMMAND
|
||||
genhtml --legend -f -q
|
||||
"${PROJECT_BINARY_DIR}/coverage.info"
|
||||
-p "${PROJECT_SOURCE_DIR}"
|
||||
-o "${PROJECT_BINARY_DIR}/coverage_html"
|
||||
CACHE STRING
|
||||
"; separated command to generate an HTML report for the 'coverage' target"
|
||||
)
|
||||
|
||||
# ---- Coverage target ----
|
||||
|
||||
add_custom_target(
|
||||
coverage
|
||||
COMMAND ${COVERAGE_TRACE_COMMAND}
|
||||
COMMAND ${COVERAGE_HTML_COMMAND}
|
||||
COMMENT "Generating coverage report"
|
||||
VERBATIM
|
||||
)
|
@ -0,0 +1,32 @@
|
||||
include(cmake/folders.cmake)
|
||||
|
||||
include(CTest)
|
||||
if(BUILD_TESTING)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
add_custom_target(
|
||||
run-exe
|
||||
COMMAND lnav
|
||||
VERBATIM
|
||||
)
|
||||
add_dependencies(run-exe lnav)
|
||||
|
||||
option(BUILD_MCSS_DOCS "Build documentation using Doxygen and m.css" OFF)
|
||||
if(BUILD_MCSS_DOCS)
|
||||
include(cmake/docs.cmake)
|
||||
endif()
|
||||
|
||||
option(ENABLE_COVERAGE "Enable coverage support separate from CTest's" OFF)
|
||||
if(ENABLE_COVERAGE)
|
||||
include(cmake/coverage.cmake)
|
||||
endif()
|
||||
|
||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
||||
include(cmake/open-cpp-coverage.cmake OPTIONAL)
|
||||
endif()
|
||||
|
||||
include(cmake/lint-targets.cmake)
|
||||
include(cmake/spell-targets.cmake)
|
||||
|
||||
add_folders(Project)
|
@ -0,0 +1,112 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
foreach(var IN ITEMS PROJECT_BINARY_DIR PROJECT_SOURCE_DIR)
|
||||
if(NOT DEFINED "${var}")
|
||||
message(FATAL_ERROR "${var} must be defined")
|
||||
endif()
|
||||
endforeach()
|
||||
set(bin "${PROJECT_BINARY_DIR}")
|
||||
set(src "${PROJECT_SOURCE_DIR}")
|
||||
|
||||
# ---- Dependencies ----
|
||||
|
||||
set(mcss_SOURCE_DIR "${bin}/docs/.ci")
|
||||
if(NOT IS_DIRECTORY "${mcss_SOURCE_DIR}")
|
||||
file(MAKE_DIRECTORY "${mcss_SOURCE_DIR}")
|
||||
file(
|
||||
DOWNLOAD
|
||||
https://github.com/friendlyanon/m.css/releases/download/release-1/mcss.zip
|
||||
"${mcss_SOURCE_DIR}/mcss.zip"
|
||||
STATUS status
|
||||
EXPECTED_MD5 00cd2757ebafb9bcba7f5d399b3bec7f
|
||||
)
|
||||
if(NOT status MATCHES "^0;")
|
||||
message(FATAL_ERROR "Download failed with ${status}")
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_COMMAND}" -E tar xf mcss.zip
|
||||
WORKING_DIRECTORY "${mcss_SOURCE_DIR}"
|
||||
RESULT_VARIABLE result
|
||||
)
|
||||
if(NOT result EQUAL "0")
|
||||
message(FATAL_ERROR "Extraction failed with ${result}")
|
||||
endif()
|
||||
file(REMOVE "${mcss_SOURCE_DIR}/mcss.zip")
|
||||
endif()
|
||||
|
||||
find_program(Python3_EXECUTABLE NAMES python3 python)
|
||||
if(NOT Python3_EXECUTABLE)
|
||||
message(FATAL_ERROR "Python executable was not found")
|
||||
endif()
|
||||
|
||||
# ---- Process project() call in CMakeLists.txt ----
|
||||
|
||||
file(READ "${src}/CMakeLists.txt" content)
|
||||
|
||||
string(FIND "${content}" "project(" index)
|
||||
if(index EQUAL "-1")
|
||||
message(FATAL_ERROR "Could not find \"project(\"")
|
||||
endif()
|
||||
string(SUBSTRING "${content}" "${index}" -1 content)
|
||||
|
||||
string(FIND "${content}" "\n)\n" index)
|
||||
if(index EQUAL "-1")
|
||||
message(FATAL_ERROR "Could not find \"\\n)\\n\"")
|
||||
endif()
|
||||
string(SUBSTRING "${content}" 0 "${index}" content)
|
||||
|
||||
file(WRITE "${bin}/docs-ci.project.cmake" "docs_${content}\n)\n")
|
||||
|
||||
macro(list_pop_front list out)
|
||||
list(GET "${list}" 0 "${out}")
|
||||
list(REMOVE_AT "${list}" 0)
|
||||
endmacro()
|
||||
|
||||
function(docs_project name)
|
||||
cmake_parse_arguments(PARSE_ARGV 1 "" "" "VERSION;DESCRIPTION;HOMEPAGE_URL" LANGUAGES)
|
||||
set(PROJECT_NAME "${name}" PARENT_SCOPE)
|
||||
if(DEFINED _VERSION)
|
||||
set(PROJECT_VERSION "${_VERSION}" PARENT_SCOPE)
|
||||
string(REGEX MATCH "^[0-9]+(\\.[0-9]+)*" versions "${_VERSION}")
|
||||
string(REPLACE . ";" versions "${versions}")
|
||||
set(suffixes MAJOR MINOR PATCH TWEAK)
|
||||
while(NOT versions STREQUAL "" AND NOT suffixes STREQUAL "")
|
||||
list_pop_front(versions version)
|
||||
list_pop_front(suffixes suffix)
|
||||
set("PROJECT_VERSION_${suffix}" "${version}" PARENT_SCOPE)
|
||||
endwhile()
|
||||
endif()
|
||||
if(DEFINED _DESCRIPTION)
|
||||
set(PROJECT_DESCRIPTION "${_DESCRIPTION}" PARENT_SCOPE)
|
||||
endif()
|
||||
if(DEFINED _HOMEPAGE_URL)
|
||||
set(PROJECT_HOMEPAGE_URL "${_HOMEPAGE_URL}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
include("${bin}/docs-ci.project.cmake")
|
||||
|
||||
# ---- Generate docs ----
|
||||
|
||||
if(NOT DEFINED DOXYGEN_OUTPUT_DIRECTORY)
|
||||
set(DOXYGEN_OUTPUT_DIRECTORY "${bin}/docs")
|
||||
endif()
|
||||
set(out "${DOXYGEN_OUTPUT_DIRECTORY}")
|
||||
|
||||
foreach(file IN ITEMS Doxyfile conf.py)
|
||||
configure_file("${src}/docs/${file}.in" "${bin}/docs/${file}" @ONLY)
|
||||
endforeach()
|
||||
|
||||
set(mcss_script "${mcss_SOURCE_DIR}/documentation/doxygen.py")
|
||||
set(config "${bin}/docs/conf.py")
|
||||
|
||||
file(REMOVE_RECURSE "${out}/html" "${out}/xml")
|
||||
|
||||
execute_process(
|
||||
COMMAND "${Python3_EXECUTABLE}" "${mcss_script}" "${config}"
|
||||
WORKING_DIRECTORY "${bin}/docs"
|
||||
RESULT_VARIABLE result
|
||||
)
|
||||
if(NOT result EQUAL "0")
|
||||
message(FATAL_ERROR "m.css returned with ${result}")
|
||||
endif()
|
@ -0,0 +1,40 @@
|
||||
# ---- Dependencies ----
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
mcss URL
|
||||
https://github.com/friendlyanon/m.css/releases/download/release-1/mcss.zip
|
||||
URL_MD5 00cd2757ebafb9bcba7f5d399b3bec7f
|
||||
SOURCE_DIR "${PROJECT_BINARY_DIR}/mcss"
|
||||
UPDATE_DISCONNECTED YES
|
||||
)
|
||||
FetchContent_MakeAvailable(mcss)
|
||||
|
||||
find_package(Python3 3.6 REQUIRED)
|
||||
|
||||
# ---- Declare documentation target ----
|
||||
|
||||
set(
|
||||
DOXYGEN_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/docs"
|
||||
CACHE PATH "Path for the generated Doxygen documentation"
|
||||
)
|
||||
|
||||
set(working_dir "${PROJECT_BINARY_DIR}/docs")
|
||||
|
||||
foreach(file IN ITEMS Doxyfile conf.py)
|
||||
configure_file("docs/${file}.in" "${working_dir}/${file}" @ONLY)
|
||||
endforeach()
|
||||
|
||||
set(mcss_script "${mcss_SOURCE_DIR}/documentation/doxygen.py")
|
||||
set(config "${working_dir}/conf.py")
|
||||
|
||||
add_custom_target(
|
||||
docs
|
||||
COMMAND "${CMAKE_COMMAND}" -E remove_directory
|
||||
"${DOXYGEN_OUTPUT_DIRECTORY}/html"
|
||||
"${DOXYGEN_OUTPUT_DIRECTORY}/xml"
|
||||
COMMAND "${Python3_EXECUTABLE}" "${mcss_script}" "${config}"
|
||||
COMMENT "Building documentation using Doxygen and m.css"
|
||||
WORKING_DIRECTORY "${working_dir}"
|
||||
VERBATIM
|
||||
)
|
@ -0,0 +1,21 @@
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS YES)
|
||||
|
||||
# Call this function at the end of a directory scope to assign a folder to
|
||||
# targets created in that directory. Utility targets will be assigned to the
|
||||
# UtilityTargets folder, otherwise to the ${name}Targets folder. If a target
|
||||
# already has a folder assigned, then that target will be skipped.
|
||||
function(add_folders name)
|
||||
get_property(targets DIRECTORY PROPERTY BUILDSYSTEM_TARGETS)
|
||||
foreach(target IN LISTS targets)
|
||||
get_property(folder TARGET "${target}" PROPERTY FOLDER)
|
||||
if(DEFINED folder)
|
||||
continue()
|
||||
endif()
|
||||
set(folder Utility)
|
||||
get_property(type TARGET "${target}" PROPERTY TYPE)
|
||||
if(NOT type STREQUAL "UTILITY")
|
||||
set(folder "${name}")
|
||||
endif()
|
||||
set_property(TARGET "${target}" PROPERTY FOLDER "${folder}Targets")
|
||||
endforeach()
|
||||
endfunction()
|
@ -0,0 +1,44 @@
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# find_package(<package>) call for consumers to find this project
|
||||
set(package lnav)
|
||||
|
||||
install(
|
||||
TARGETS lnav
|
||||
RUNTIME COMPONENT lnav_Runtime
|
||||
)
|
||||
|
||||
write_basic_package_version_file(
|
||||
"${package}ConfigVersion.cmake"
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
|
||||
# Allow package maintainers to freely override the path for the configs
|
||||
set(
|
||||
lnav_INSTALL_CMAKEDIR "${CMAKE_INSTALL_DATADIR}/${package}"
|
||||
CACHE PATH "CMake package config location relative to the install prefix"
|
||||
)
|
||||
mark_as_advanced(lnav_INSTALL_CMAKEDIR)
|
||||
|
||||
install(
|
||||
FILES "${PROJECT_BINARY_DIR}/${package}ConfigVersion.cmake"
|
||||
DESTINATION "${lnav_INSTALL_CMAKEDIR}"
|
||||
COMPONENT lnav_Development
|
||||
)
|
||||
|
||||
# Export variables for the install script to use
|
||||
install(CODE "
|
||||
set(lnav_NAME [[$<TARGET_FILE_NAME:lnav>]])
|
||||
set(lnav_INSTALL_CMAKEDIR [[${lnav_INSTALL_CMAKEDIR}]])
|
||||
set(CMAKE_INSTALL_BINDIR [[${CMAKE_INSTALL_BINDIR}]])
|
||||
" COMPONENT lnav_Development)
|
||||
|
||||
install(
|
||||
SCRIPT cmake/install-script.cmake
|
||||
COMPONENT lnav_Development
|
||||
)
|
||||
|
||||
if(PROJECT_IS_TOP_LEVEL)
|
||||
include(CPack)
|
||||
endif()
|
@ -0,0 +1,18 @@
|
||||
file(
|
||||
RELATIVE_PATH relative_path
|
||||
"/${lnav_INSTALL_CMAKEDIR}"
|
||||
"/${CMAKE_INSTALL_BINDIR}/${lnav_NAME}"
|
||||
)
|
||||
|
||||
get_filename_component(prefix "${CMAKE_INSTALL_PREFIX}" ABSOLUTE)
|
||||
set(config_dir "${prefix}/${lnav_INSTALL_CMAKEDIR}")
|
||||
set(config_file "${config_dir}/lnavConfig.cmake")
|
||||
|
||||
message(STATUS "Installing: ${config_file}")
|
||||
file(WRITE "${config_file}" "\
|
||||
set(
|
||||
LNAV_EXECUTABLE
|
||||
\"\${CMAKE_CURRENT_LIST_DIR}/${relative_path}\"
|
||||
CACHE FILEPATH \"Path to the lnav executable\"
|
||||
)
|
||||
")
|
@ -0,0 +1,32 @@
|
||||
set(
|
||||
FORMAT_PATTERNS
|
||||
src/*.cc src/*.hh
|
||||
test/*.cc test/*.hh
|
||||
CACHE STRING
|
||||
"; separated patterns relative to the project source dir to format"
|
||||
)
|
||||
|
||||
set(FORMAT_COMMAND clang-format CACHE STRING "Formatter to use")
|
||||
|
||||
add_custom_target(
|
||||
format-check
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-D "FORMAT_COMMAND=${FORMAT_COMMAND}"
|
||||
-D "PATTERNS=${FORMAT_PATTERNS}"
|
||||
-P "${PROJECT_SOURCE_DIR}/cmake/lint.cmake"
|
||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
||||
COMMENT "Linting the code"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_custom_target(
|
||||
format-fix
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-D "FORMAT_COMMAND=${FORMAT_COMMAND}"
|
||||
-D "PATTERNS=${FORMAT_PATTERNS}"
|
||||
-D FIX=YES
|
||||
-P "${PROJECT_SOURCE_DIR}/cmake/lint.cmake"
|
||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
||||
COMMENT "Fixing the code"
|
||||
VERBATIM
|
||||
)
|
@ -0,0 +1,50 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
macro(default name)
|
||||
if(NOT DEFINED "${name}")
|
||||
set("${name}" "${ARGN}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
default(FORMAT_COMMAND clang-format)
|
||||
default(
|
||||
PATTERNS
|
||||
src/*.cc src/*.hh
|
||||
test/*.cc test/*.hh
|
||||
)
|
||||
default(FIX NO)
|
||||
|
||||
set(flag --output-replacements-xml)
|
||||
set(args OUTPUT_VARIABLE output)
|
||||
if(FIX)
|
||||
set(flag -i)
|
||||
set(args "")
|
||||
endif()
|
||||
|
||||
file(GLOB_RECURSE files ${PATTERNS})
|
||||
set(badly_formatted "")
|
||||
set(output "")
|
||||
string(LENGTH "${CMAKE_SOURCE_DIR}/" path_prefix_length)
|
||||
|
||||
foreach(file IN LISTS files)
|
||||
execute_process(
|
||||
COMMAND "${FORMAT_COMMAND}" --style=file "${flag}" "${file}"
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
RESULT_VARIABLE result
|
||||
${args}
|
||||
)
|
||||
if(NOT result EQUAL "0")
|
||||
message(FATAL_ERROR "'${file}': formatter returned with ${result}")
|
||||
endif()
|
||||
if(NOT FIX AND output MATCHES "\n<replacement offset")
|
||||
string(SUBSTRING "${file}" "${path_prefix_length}" -1 relative_file)
|
||||
list(APPEND badly_formatted "${relative_file}")
|
||||
endif()
|
||||
set(output "")
|
||||
endforeach()
|
||||
|
||||
if(NOT badly_formatted STREQUAL "")
|
||||
list(JOIN badly_formatted "\n" bad_list)
|
||||
message("The following files are badly formatted:\n\n${bad_list}\n")
|
||||
message(FATAL_ERROR "Run again with FIX=YES to fix these files.")
|
||||
endif()
|
@ -0,0 +1,31 @@
|
||||
# Example file to run OpenCppCoverage on Windows
|
||||
|
||||
include(ProcessorCount)
|
||||
ProcessorCount(N)
|
||||
|
||||
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/opencppcoverage")
|
||||
|
||||
# Convert delimiters to Windows ones
|
||||
string(REPLACE "/" "\\" binary_dir "${PROJECT_BINARY_DIR}")
|
||||
string(REPLACE "/" "\\" source_dir "${PROJECT_SOURCE_DIR}")
|
||||
string(REPLACE "/" "\\" ctest "${CMAKE_CTEST_COMMAND}")
|
||||
|
||||
add_custom_target(
|
||||
win-cov
|
||||
COMMAND OpenCppCoverage -q
|
||||
# We want coverage from the child processes of CTest
|
||||
--cover_children
|
||||
# Subdirectory where the tests reside in the binary directory
|
||||
--modules "${binary_dir}\\test"
|
||||
# This command is for the developer, so export as html instead of cobertura
|
||||
--export_type "html:${binary_dir}\\opencppcoverage"
|
||||
# Source (not header) file locations
|
||||
--sources "${source_dir}\\source"
|
||||
--sources "${source_dir}\\test\\source"
|
||||
# Working directory for CTest, which should be the binary directory
|
||||
--working_dir "${binary_dir}"
|
||||
# OpenCppCoverage should be run only with the Debug configuration tests
|
||||
-- "${ctest}" -C Debug --output-on-failure -j "${N}"
|
||||
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
|
||||
VERBATIM
|
||||
)
|
@ -0,0 +1,10 @@
|
||||
# ---- In-source guard ----
|
||||
|
||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"In-source builds are not supported. "
|
||||
"Please read the BUILDING document before trying to build this project. "
|
||||
"You may need to delete 'CMakeCache.txt' and 'CMakeFiles/' first."
|
||||
)
|
||||
endif()
|
@ -0,0 +1,6 @@
|
||||
# This variable is set by project() in CMake 3.21+
|
||||
string(
|
||||
COMPARE EQUAL
|
||||
"${CMAKE_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}"
|
||||
PROJECT_IS_TOP_LEVEL
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
set(SPELL_COMMAND codespell CACHE STRING "Spell checker to use")
|
||||
|
||||
add_custom_target(
|
||||
spell-check
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-D "SPELL_COMMAND=${SPELL_COMMAND}"
|
||||
-P "${PROJECT_SOURCE_DIR}/cmake/spell.cmake"
|
||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
||||
COMMENT "Checking spelling"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_custom_target(
|
||||
spell-fix
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-D "SPELL_COMMAND=${SPELL_COMMAND}"
|
||||
-D FIX=YES
|
||||
-P "${PROJECT_SOURCE_DIR}/cmake/spell.cmake"
|
||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
||||
COMMENT "Fixing spelling errors"
|
||||
VERBATIM
|
||||
)
|
@ -0,0 +1,29 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
macro(default name)
|
||||
if(NOT DEFINED "${name}")
|
||||
set("${name}" "${ARGN}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
default(SPELL_COMMAND codespell)
|
||||
default(FIX NO)
|
||||
|
||||
set(flag "")
|
||||
if(FIX)
|
||||
set(flag -w)
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND "${SPELL_COMMAND}" ${flag}
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
RESULT_VARIABLE result
|
||||
)
|
||||
|
||||
if(result EQUAL "65")
|
||||
message(FATAL_ERROR "Run again with FIX=YES to fix these errors.")
|
||||
elseif(result EQUAL "64")
|
||||
message(FATAL_ERROR "Spell checker printed the usage info. Bad arguments?")
|
||||
elseif(NOT result EQUAL "0")
|
||||
message(FATAL_ERROR "Spell checker returned with ${result}")
|
||||
endif()
|
@ -0,0 +1,28 @@
|
||||
# ---- Developer mode ----
|
||||
|
||||
# Developer mode enables targets and code paths in the CMake scripts that are
|
||||
# only relevant for the developer(s) of lnav
|
||||
# Targets necessary to build the project must be provided unconditionally, so
|
||||
# consumers can trivially build and package the project
|
||||
if(PROJECT_IS_TOP_LEVEL)
|
||||
option(lnav_DEVELOPER_MODE "Enable developer mode" OFF)
|
||||
endif()
|
||||
|
||||
# ---- Warning guard ----
|
||||
|
||||
# target_include_directories with the SYSTEM modifier will request the compiler
|
||||
# to omit warnings from the provided paths, if the compiler supports that
|
||||
# This is to provide a user experience similar to find_package when
|
||||
# add_subdirectory or FetchContent is used to consume this project
|
||||
set(warning_guard "")
|
||||
if(NOT PROJECT_IS_TOP_LEVEL)
|
||||
option(
|
||||
lnav_INCLUDES_WITH_SYSTEM
|
||||
"Use SYSTEM modifier for lnav's includes, disabling warnings"
|
||||
ON
|
||||
)
|
||||
mark_as_advanced(lnav_INCLUDES_WITH_SYSTEM)
|
||||
if(lnav_INCLUDES_WITH_SYSTEM)
|
||||
set(warning_guard SYSTEM)
|
||||
endif()
|
||||
endif()
|
@ -0,0 +1,54 @@
|
||||
from conans import ConanFile
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps
|
||||
|
||||
|
||||
class LnavConan(ConanFile):
|
||||
name = "lnav"
|
||||
version = "0.10.2"
|
||||
homepage = "https://lnav.org"
|
||||
url = "https://github.com/tstack/lnav.git"
|
||||
license = "BSD-2-Clause"
|
||||
description = (
|
||||
"The Log File Navigator, lnav for short, is an advanced "
|
||||
"log file viewer for the small-scale"
|
||||
)
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
exports_sources = "*"
|
||||
no_copy_source = True
|
||||
requires = (
|
||||
"bzip2/1.0.8",
|
||||
"libarchive/3.6.0",
|
||||
"libcurl/7.80.0",
|
||||
"ncurses/6.3",
|
||||
"pcre/8.45",
|
||||
"readline/8.1.2",
|
||||
"sqlite3/3.38.0",
|
||||
"zlib/1.2.11",
|
||||
)
|
||||
generators = ("virtualrunenv",)
|
||||
default_options = {
|
||||
"libarchive:with_bzip2": True,
|
||||
"libarchive:with_lz4": True,
|
||||
"libarchive:with_lzo": True,
|
||||
"libarchive:with_lzma": True,
|
||||
"libarchive:with_zstd": True,
|
||||
"pcre:with_jit": True,
|
||||
"sqlite3:enable_json1": True,
|
||||
"sqlite3:enable_soundex": True,
|
||||
}
|
||||
|
||||
def generate(self):
|
||||
CMakeToolchain(self).generate()
|
||||
CMakeDeps(self).generate()
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
|
||||
def deploy(self):
|
||||
self.copy("*", dst="bin", src="bin")
|
@ -0,0 +1,32 @@
|
||||
# Configuration for Doxygen for use with CMake
|
||||
# Only options that deviate from the default are included
|
||||
# To create a new Doxyfile containing all available options, call `doxygen -g`
|
||||
|
||||
# Get Project name and version from CMake
|
||||
PROJECT_NAME = "@PROJECT_NAME@"
|
||||
PROJECT_NUMBER = "@PROJECT_VERSION@"
|
||||
|
||||
# Add sources
|
||||
INPUT = "@PROJECT_SOURCE_DIR@/README.md" "@PROJECT_SOURCE_DIR@/include" "@PROJECT_SOURCE_DIR@/source" "@PROJECT_SOURCE_DIR@/docs/pages"
|
||||
EXTRACT_ALL = YES
|
||||
RECURSIVE = YES
|
||||
OUTPUT_DIRECTORY = "@DOXYGEN_OUTPUT_DIRECTORY@"
|
||||
|
||||
# Use the README as a main page
|
||||
USE_MDFILE_AS_MAINPAGE = "@PROJECT_SOURCE_DIR@/README.md"
|
||||
|
||||
# set relative include paths
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH = "@PROJECT_SOURCE_DIR@/include" "@PROJECT_SOURCE_DIR@"
|
||||
STRIP_FROM_INC_PATH =
|
||||
|
||||
# We use m.css to generate the html documentation, so we only need XML output
|
||||
GENERATE_XML = YES
|
||||
GENERATE_HTML = NO
|
||||
GENERATE_LATEX = NO
|
||||
XML_PROGRAMLISTING = NO
|
||||
CREATE_SUBDIRS = NO
|
||||
|
||||
# Include all directories, files and namespaces in the documentation
|
||||
# Disable to include only explicitly documented objects
|
||||
M_SHOW_UNDOCUMENTED = YES
|
@ -0,0 +1,6 @@
|
||||
DOXYFILE = 'Doxyfile'
|
||||
|
||||
LINKS_NAVBAR1 = [
|
||||
(None, 'pages', [(None, 'about')]),
|
||||
(None, 'namespaces', []),
|
||||
]
|
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* @page about About
|
||||
* @section about-doxygen Doxygen documentation
|
||||
* This page is auto generated using
|
||||
* <a href="https://www.doxygen.nl/">Doxygen</a>, making use of some useful
|
||||
* <a href="https://www.doxygen.nl/manual/commands.html">special commands</a>.
|
||||
*/
|
@ -1,5 +1,5 @@
|
||||
add_library(pcrepp STATIC ../config.h pcrepp.hh pcrepp.cc)
|
||||
add_library(pcrepp STATIC ../config.h.in pcrepp.hh pcrepp.cc)
|
||||
|
||||
target_include_directories(pcrepp PUBLIC . .. ../fmtlib
|
||||
${CMAKE_CURRENT_BINARY_DIR}/..)
|
||||
target_link_libraries(pcrepp PkgConfig::libpcre)
|
||||
target_link_libraries(pcrepp pcre::libpcre)
|
||||
|
@ -1,5 +1,5 @@
|
||||
add_library(remote STATIC ../config.h remote.ssh.cc remote.ssh.hh)
|
||||
add_library(remote STATIC ../config.h.in remote.ssh.cc remote.ssh.hh)
|
||||
|
||||
target_include_directories(remote PUBLIC . .. ../fmtlib
|
||||
${CMAKE_CURRENT_BINARY_DIR}/..)
|
||||
target_link_libraries(remote cppfmt PkgConfig::libpcre)
|
||||
target_link_libraries(remote cppfmt pcre::libpcre)
|
||||
|
Loading…
Reference in New Issue