Compare commits
1 Commits
81ecc87d39
...
v0.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
| e6c82b6db6 |
+288
@@ -0,0 +1,288 @@
|
|||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
AccessModifierOffset: 0
|
||||||
|
AlignAfterOpenBracket: DontAlign
|
||||||
|
AlignArrayOfStructures: None
|
||||||
|
AlignConsecutiveAssignments:
|
||||||
|
Enabled: false
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
AlignFunctionDeclarations: false
|
||||||
|
AlignFunctionPointers: false
|
||||||
|
PadOperators: true
|
||||||
|
AlignConsecutiveBitFields:
|
||||||
|
Enabled: false
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
AlignFunctionDeclarations: false
|
||||||
|
AlignFunctionPointers: false
|
||||||
|
PadOperators: false
|
||||||
|
AlignConsecutiveDeclarations:
|
||||||
|
Enabled: false
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
AlignFunctionDeclarations: true
|
||||||
|
AlignFunctionPointers: false
|
||||||
|
PadOperators: false
|
||||||
|
AlignConsecutiveMacros:
|
||||||
|
Enabled: false
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
AlignFunctionDeclarations: false
|
||||||
|
AlignFunctionPointers: false
|
||||||
|
PadOperators: false
|
||||||
|
AlignConsecutiveShortCaseStatements:
|
||||||
|
Enabled: false
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCaseArrows: false
|
||||||
|
AlignCaseColons: false
|
||||||
|
AlignConsecutiveTableGenBreakingDAGArgColons:
|
||||||
|
Enabled: false
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
AlignFunctionDeclarations: false
|
||||||
|
AlignFunctionPointers: false
|
||||||
|
PadOperators: false
|
||||||
|
AlignConsecutiveTableGenCondOperatorColons:
|
||||||
|
Enabled: false
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
AlignFunctionDeclarations: false
|
||||||
|
AlignFunctionPointers: false
|
||||||
|
PadOperators: false
|
||||||
|
AlignConsecutiveTableGenDefinitionColons:
|
||||||
|
Enabled: false
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
AlignFunctionDeclarations: false
|
||||||
|
AlignFunctionPointers: false
|
||||||
|
PadOperators: false
|
||||||
|
AlignEscapedNewlines: Right
|
||||||
|
AlignOperands: DontAlign
|
||||||
|
AlignTrailingComments:
|
||||||
|
Kind: Never
|
||||||
|
OverEmptyLines: 0
|
||||||
|
AllowAllArgumentsOnNextLine: true
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
|
AllowBreakBeforeNoexceptSpecifier: Never
|
||||||
|
AllowShortBlocksOnASingleLine: Empty
|
||||||
|
AllowShortCaseExpressionOnASingleLine: true
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: true
|
||||||
|
AllowShortEnumsOnASingleLine: true
|
||||||
|
AllowShortFunctionsOnASingleLine: All
|
||||||
|
AllowShortIfStatementsOnASingleLine: Never
|
||||||
|
AllowShortLambdasOnASingleLine: All
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
AllowShortNamespacesOnASingleLine: false
|
||||||
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
|
AttributeMacros:
|
||||||
|
- __capability
|
||||||
|
BinPackArguments: true
|
||||||
|
BinPackParameters: BinPack
|
||||||
|
BitFieldColonSpacing: Both
|
||||||
|
BraceWrapping:
|
||||||
|
AfterCaseLabel: false
|
||||||
|
AfterClass: false
|
||||||
|
AfterControlStatement: Never
|
||||||
|
AfterEnum: false
|
||||||
|
AfterExternBlock: false
|
||||||
|
AfterFunction: true
|
||||||
|
AfterNamespace: false
|
||||||
|
AfterObjCDeclaration: false
|
||||||
|
AfterStruct: false
|
||||||
|
AfterUnion: false
|
||||||
|
BeforeCatch: false
|
||||||
|
BeforeElse: false
|
||||||
|
BeforeLambdaBody: false
|
||||||
|
BeforeWhile: false
|
||||||
|
IndentBraces: false
|
||||||
|
SplitEmptyFunction: true
|
||||||
|
SplitEmptyRecord: true
|
||||||
|
SplitEmptyNamespace: true
|
||||||
|
BreakAdjacentStringLiterals: true
|
||||||
|
BreakAfterAttributes: Leave
|
||||||
|
BreakAfterJavaFieldAnnotations: false
|
||||||
|
BreakAfterReturnType: None
|
||||||
|
BreakArrays: true
|
||||||
|
BreakBeforeBinaryOperators: All
|
||||||
|
BreakBeforeConceptDeclarations: Always
|
||||||
|
BreakBeforeBraces: Attach
|
||||||
|
BreakBeforeInlineASMColon: OnlyMultiline
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakBinaryOperations: Never
|
||||||
|
BreakConstructorInitializers: BeforeComma
|
||||||
|
BreakFunctionDefinitionParameters: false
|
||||||
|
BreakInheritanceList: BeforeColon
|
||||||
|
BreakStringLiterals: true
|
||||||
|
BreakTemplateDeclarations: MultiLine
|
||||||
|
ColumnLimit: 120
|
||||||
|
CommentPragmas: '^ IWYU pragma:'
|
||||||
|
CompactNamespaces: false
|
||||||
|
ConstructorInitializerIndentWidth: 2
|
||||||
|
ContinuationIndentWidth: 2
|
||||||
|
Cpp11BracedListStyle: false
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
DisableFormat: false
|
||||||
|
EmptyLineAfterAccessModifier: Never
|
||||||
|
EmptyLineBeforeAccessModifier: LogicalBlock
|
||||||
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
FixNamespaceComments: false
|
||||||
|
ForEachMacros:
|
||||||
|
- foreach
|
||||||
|
- Q_FOREACH
|
||||||
|
- BOOST_FOREACH
|
||||||
|
IfMacros:
|
||||||
|
- KJ_IF_MAYBE
|
||||||
|
IncludeBlocks: Preserve
|
||||||
|
IncludeCategories:
|
||||||
|
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||||
|
Priority: 2
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||||
|
Priority: 3
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
- Regex: '.*'
|
||||||
|
Priority: 1
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
IncludeIsMainRegex: '(Test)?$'
|
||||||
|
IncludeIsMainSourceRegex: ''
|
||||||
|
IndentAccessModifiers: true
|
||||||
|
IndentCaseBlocks: false
|
||||||
|
IndentCaseLabels: false
|
||||||
|
IndentExportBlock: true
|
||||||
|
IndentExternBlock: AfterExternBlock
|
||||||
|
IndentGotoLabels: true
|
||||||
|
IndentPPDirectives: None
|
||||||
|
IndentRequiresClause: true
|
||||||
|
IndentWidth: 2
|
||||||
|
IndentWrappedFunctionNames: false
|
||||||
|
InsertBraces: false
|
||||||
|
InsertNewlineAtEOF: false
|
||||||
|
InsertTrailingCommas: None
|
||||||
|
IntegerLiteralSeparator:
|
||||||
|
Binary: 0
|
||||||
|
BinaryMinDigits: 0
|
||||||
|
Decimal: 0
|
||||||
|
DecimalMinDigits: 0
|
||||||
|
Hex: 0
|
||||||
|
HexMinDigits: 0
|
||||||
|
JavaScriptQuotes: Leave
|
||||||
|
JavaScriptWrapImports: true
|
||||||
|
KeepEmptyLines:
|
||||||
|
AtEndOfFile: false
|
||||||
|
AtStartOfBlock: true
|
||||||
|
AtStartOfFile: true
|
||||||
|
KeepFormFeed: false
|
||||||
|
LambdaBodyIndentation: Signature
|
||||||
|
LineEnding: DeriveLF
|
||||||
|
MacroBlockBegin: ''
|
||||||
|
MacroBlockEnd: ''
|
||||||
|
MainIncludeChar: Quote
|
||||||
|
MaxEmptyLinesToKeep: 1
|
||||||
|
NamespaceIndentation: All
|
||||||
|
ObjCBinPackProtocolList: Auto
|
||||||
|
ObjCBlockIndentWidth: 4
|
||||||
|
ObjCBreakBeforeNestedBlockParam: true
|
||||||
|
ObjCSpaceAfterProperty: true
|
||||||
|
ObjCSpaceBeforeProtocolList: true
|
||||||
|
PackConstructorInitializers: BinPack
|
||||||
|
PenaltyBreakAssignment: 2
|
||||||
|
PenaltyBreakBeforeFirstCallParameter: 19
|
||||||
|
PenaltyBreakBeforeMemberAccess: 150
|
||||||
|
PenaltyBreakComment: 300
|
||||||
|
PenaltyBreakFirstLessLess: 120
|
||||||
|
PenaltyBreakOpenParenthesis: 0
|
||||||
|
PenaltyBreakScopeResolution: 500
|
||||||
|
PenaltyBreakString: 1000
|
||||||
|
PenaltyBreakTemplateDeclaration: 10
|
||||||
|
PenaltyExcessCharacter: 1000000
|
||||||
|
PenaltyIndentedWhitespace: 0
|
||||||
|
PenaltyReturnTypeOnItsOwnLine: 60
|
||||||
|
PointerAlignment: Left
|
||||||
|
PPIndentWidth: -1
|
||||||
|
QualifierAlignment: Leave
|
||||||
|
ReferenceAlignment: Pointer
|
||||||
|
ReflowComments: Always
|
||||||
|
RemoveBracesLLVM: false
|
||||||
|
RemoveEmptyLinesInUnwrappedLines: false
|
||||||
|
RemoveParentheses: Leave
|
||||||
|
RemoveSemicolon: false
|
||||||
|
RequiresClausePosition: OwnLine
|
||||||
|
RequiresExpressionIndentation: OuterScope
|
||||||
|
SeparateDefinitionBlocks: Leave
|
||||||
|
ShortNamespaceLines: 1
|
||||||
|
SkipMacroDefinitionBody: false
|
||||||
|
SortIncludes: CaseSensitive
|
||||||
|
SortJavaStaticImport: Before
|
||||||
|
SortUsingDeclarations: LexicographicNumeric
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
SpaceAfterLogicalNot: false
|
||||||
|
SpaceAfterTemplateKeyword: true
|
||||||
|
SpaceAroundPointerQualifiers: Default
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeCaseColon: false
|
||||||
|
SpaceBeforeCpp11BracedList: true
|
||||||
|
SpaceBeforeCtorInitializerColon: true
|
||||||
|
SpaceBeforeInheritanceColon: true
|
||||||
|
SpaceBeforeJsonColon: false
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
SpaceBeforeParensOptions:
|
||||||
|
AfterControlStatements: true
|
||||||
|
AfterForeachMacros: true
|
||||||
|
AfterFunctionDefinitionName: false
|
||||||
|
AfterFunctionDeclarationName: false
|
||||||
|
AfterIfMacros: true
|
||||||
|
AfterOverloadedOperator: false
|
||||||
|
AfterPlacementOperator: true
|
||||||
|
AfterRequiresInClause: false
|
||||||
|
AfterRequiresInExpression: false
|
||||||
|
BeforeNonEmptyParentheses: false
|
||||||
|
SpaceBeforeRangeBasedForLoopColon: true
|
||||||
|
SpaceBeforeSquareBrackets: false
|
||||||
|
SpaceInEmptyBlock: true
|
||||||
|
SpacesBeforeTrailingComments: 1
|
||||||
|
SpacesInAngles: Never
|
||||||
|
SpacesInContainerLiterals: true
|
||||||
|
SpacesInLineCommentPrefix:
|
||||||
|
Minimum: 1
|
||||||
|
Maximum: -1
|
||||||
|
SpacesInParens: Never
|
||||||
|
SpacesInParensOptions:
|
||||||
|
ExceptDoubleParentheses: false
|
||||||
|
InCStyleCasts: false
|
||||||
|
InConditionalStatements: false
|
||||||
|
InEmptyParentheses: false
|
||||||
|
Other: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
Standard: Latest
|
||||||
|
StatementAttributeLikeMacros:
|
||||||
|
- Q_EMIT
|
||||||
|
StatementMacros:
|
||||||
|
- Q_UNUSED
|
||||||
|
- QT_REQUIRE_VERSION
|
||||||
|
TableGenBreakInsideDAGArg: DontBreak
|
||||||
|
TabWidth: 8
|
||||||
|
UseTab: Never
|
||||||
|
VerilogBreakBetweenInstancePorts: true
|
||||||
|
WhitespaceSensitiveMacros:
|
||||||
|
- BOOST_PP_STRINGIZE
|
||||||
|
- CF_SWIFT_NAME
|
||||||
|
- NS_SWIFT_NAME
|
||||||
|
- PP_STRINGIZE
|
||||||
|
- STRINGIZE
|
||||||
|
WrapNamespaceBodyWithEmptyLines: Leave
|
||||||
|
...
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
build/
|
||||||
@@ -12,6 +12,9 @@ option(HDK_GRID_TESTS "Build hdk-grid tests" ${HDK_TESTS})
|
|||||||
# No examples for grid at the moment
|
# No examples for grid at the moment
|
||||||
|
|
||||||
add_library(hdk-grid INTERFACE)
|
add_library(hdk-grid INTERFACE)
|
||||||
|
if(NOT TARGET hdk::hdk-grid)
|
||||||
|
add_library(hdk::hdk-grid ALIAS hdk-grid)
|
||||||
|
endif()
|
||||||
target_compile_features(hdk-grid INTERFACE cxx_std_17)
|
target_compile_features(hdk-grid INTERFACE cxx_std_17)
|
||||||
|
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
@@ -30,16 +33,19 @@ include(CMakePackageConfigHelpers)
|
|||||||
|
|
||||||
install(TARGETS hdk-grid
|
install(TARGETS hdk-grid
|
||||||
EXPORT hdk-gridTargets
|
EXPORT hdk-gridTargets
|
||||||
|
COMPONENT hdk-grid_dev
|
||||||
)
|
)
|
||||||
|
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
|
COMPONENT hdk-grid_dev
|
||||||
)
|
)
|
||||||
|
|
||||||
install(EXPORT hdk-gridTargets
|
install(EXPORT hdk-gridTargets
|
||||||
FILE hdk-gridTargets.cmake
|
FILE hdk-gridTargets.cmake
|
||||||
NAMESPACE hdk::
|
NAMESPACE hdk::
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/hdk-grid
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/hdk-grid
|
||||||
|
COMPONENT hdk-grid_dev
|
||||||
)
|
)
|
||||||
|
|
||||||
configure_package_config_file(
|
configure_package_config_file(
|
||||||
@@ -58,8 +64,15 @@ install(FILES
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}/hdk-gridConfig.cmake
|
${CMAKE_CURRENT_BINARY_DIR}/hdk-gridConfig.cmake
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/hdk-gridConfigVersion.cmake
|
${CMAKE_CURRENT_BINARY_DIR}/hdk-gridConfigVersion.cmake
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/hdk-grid
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/hdk-grid
|
||||||
|
COMPONENT hdk-grid_dev
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Documentation Policy
|
||||||
|
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/HDKDocumentationPolicy.cmake)
|
||||||
|
|
||||||
|
# CPack Packaging Policy
|
||||||
|
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/HDKPackaging.cmake)
|
||||||
|
|
||||||
# TODO: Link to dependencies if we need but keep them minimal and optional.
|
# TODO: Link to dependencies if we need but keep them minimal and optional.
|
||||||
|
|
||||||
# DIRS important for coverage filtering
|
# DIRS important for coverage filtering
|
||||||
|
|||||||
@@ -62,3 +62,14 @@ class MyClass {
|
|||||||
}
|
}
|
||||||
}; // # 4
|
}; // # 4
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Shared HDK Packaging Notes
|
||||||
|
|
||||||
|
`hdk-grid` currently has no examples, but it follows the same install-prefix conventions as the rest of HDK.
|
||||||
|
|
||||||
|
Under a common install prefix:
|
||||||
|
|
||||||
|
- headers install to `${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}`
|
||||||
|
- package metadata installs under `${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/cmake/hdk-grid`
|
||||||
|
|
||||||
|
Other HDK modules that provide examples install shared assets to `assets` under the same prefix by default, so all HDK outputs remain co-located.
|
||||||
|
|||||||
@@ -0,0 +1,91 @@
|
|||||||
|
include(CMakeParseArguments)
|
||||||
|
|
||||||
|
# Resolve a dependency in this order:
|
||||||
|
# 1) already-defined target(s)
|
||||||
|
# 2) find_package() system package(s)
|
||||||
|
# 3) FetchContent fallback
|
||||||
|
function(hdk_resolve_dependency)
|
||||||
|
set(_opts "")
|
||||||
|
set(_one_value NAME MIN_VERSION USE_SYSTEM FETCH_FALLBACK GIT_REPOSITORY GIT_TAG FETCHCONTENT_NAME OUT_VAR)
|
||||||
|
set(_multi_value TARGETS PACKAGE_NAMES)
|
||||||
|
cmake_parse_arguments(HDK_DEP "${_opts}" "${_one_value}" "${_multi_value}" ${ARGN})
|
||||||
|
|
||||||
|
if(NOT HDK_DEP_NAME)
|
||||||
|
message(FATAL_ERROR "hdk_resolve_dependency requires NAME")
|
||||||
|
endif()
|
||||||
|
if(NOT HDK_DEP_TARGETS)
|
||||||
|
message(FATAL_ERROR "hdk_resolve_dependency(${HDK_DEP_NAME}) requires TARGETS")
|
||||||
|
endif()
|
||||||
|
if(NOT HDK_DEP_FETCHCONTENT_NAME)
|
||||||
|
message(FATAL_ERROR "hdk_resolve_dependency(${HDK_DEP_NAME}) requires FETCHCONTENT_NAME")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_hdk_dep_resolved_target "")
|
||||||
|
foreach(_target IN LISTS HDK_DEP_TARGETS)
|
||||||
|
if(TARGET ${_target})
|
||||||
|
set(_hdk_dep_resolved_target ${_target})
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if(NOT _hdk_dep_resolved_target AND HDK_DEP_USE_SYSTEM)
|
||||||
|
foreach(_pkg IN LISTS HDK_DEP_PACKAGE_NAMES)
|
||||||
|
if(HDK_DEP_MIN_VERSION)
|
||||||
|
find_package(${_pkg} ${HDK_DEP_MIN_VERSION} QUIET CONFIG)
|
||||||
|
else()
|
||||||
|
find_package(${_pkg} QUIET CONFIG)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
foreach(_target IN LISTS HDK_DEP_TARGETS)
|
||||||
|
if(TARGET ${_target})
|
||||||
|
set(_hdk_dep_resolved_target ${_target})
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if(_hdk_dep_resolved_target)
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT _hdk_dep_resolved_target)
|
||||||
|
if(NOT HDK_DEP_FETCH_FALLBACK)
|
||||||
|
if(HDK_DEP_MIN_VERSION)
|
||||||
|
message(FATAL_ERROR "${HDK_DEP_NAME} >= ${HDK_DEP_MIN_VERSION} not found and fallback is disabled")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "${HDK_DEP_NAME} not found and fallback is disabled")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT HDK_DEP_GIT_REPOSITORY)
|
||||||
|
message(FATAL_ERROR "hdk_resolve_dependency(${HDK_DEP_NAME}) fallback requires GIT_REPOSITORY")
|
||||||
|
endif()
|
||||||
|
if(NOT HDK_DEP_GIT_TAG)
|
||||||
|
message(FATAL_ERROR "hdk_resolve_dependency(${HDK_DEP_NAME}) fallback requires GIT_TAG")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(FetchContent)
|
||||||
|
FetchContent_Declare(
|
||||||
|
${HDK_DEP_FETCHCONTENT_NAME}
|
||||||
|
GIT_REPOSITORY ${HDK_DEP_GIT_REPOSITORY}
|
||||||
|
GIT_TAG ${HDK_DEP_GIT_TAG}
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(${HDK_DEP_FETCHCONTENT_NAME})
|
||||||
|
|
||||||
|
foreach(_target IN LISTS HDK_DEP_TARGETS)
|
||||||
|
if(TARGET ${_target})
|
||||||
|
set(_hdk_dep_resolved_target ${_target})
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT _hdk_dep_resolved_target)
|
||||||
|
message(FATAL_ERROR "${HDK_DEP_NAME} could not be resolved to any expected target: ${HDK_DEP_TARGETS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(HDK_DEP_OUT_VAR)
|
||||||
|
set(${HDK_DEP_OUT_VAR} ${_hdk_dep_resolved_target} PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
# HDK Documentation Policy
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
option(${PROJECT_NAME}_DOCS "Build documentation for ${PROJECT_NAME}" OFF)
|
||||||
|
|
||||||
|
if(${PROJECT_NAME}_DOCS)
|
||||||
|
find_package(Doxygen)
|
||||||
|
if(DOXYGEN_FOUND)
|
||||||
|
set(DOXYGEN_GENERATE_HTML YES)
|
||||||
|
set(DOXYGEN_GENERATE_MAN YES)
|
||||||
|
set(DOXYGEN_GENERATE_LATEX YES)
|
||||||
|
|
||||||
|
set(DOXYGEN_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docs)
|
||||||
|
set(DOXYGEN_STRIP_FROM_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
set(DOXYGEN_EXTRACT_ALL YES)
|
||||||
|
set(DOXYGEN_DIRECTORY_GRAPH YES)
|
||||||
|
set(DOXYGEN_JAVADOC_BANNER YES)
|
||||||
|
set(DOXYGEN_JAVADOC_AUTOBRIEF YES)
|
||||||
|
set(DOXYGEN_DOT_IMAGE_FORMAT svg)
|
||||||
|
set(DOXYGEN_INTERACTIVE_SVG YES)
|
||||||
|
set(DOXYGEN_INTERNAL_DOCS YES)
|
||||||
|
set(DOXYGEN_TIMESTAMP YES)
|
||||||
|
set(DOXYGEN_RECURSIVE YES)
|
||||||
|
set(DOXYGEN_TAB_SIZE 2)
|
||||||
|
set(DOXYGEN_BUILTIN_STL_SUPPORT YES)
|
||||||
|
set(DOXYGEN_HTML_DYNAMIC_SECTIONS YES)
|
||||||
|
set(DOXYGEN_GENERATE_TREEVIEW YES)
|
||||||
|
set(DOXYGEN_FULL_SIDEBAR YES)
|
||||||
|
set(DOXYGEN_QUIET YES)
|
||||||
|
set(DOXYGEN_SOURCE_BROWSER YES)
|
||||||
|
set(DOXYGEN_VERBATIM_HEADERS YES)
|
||||||
|
set(DOXYGEN_REFERENCED_BY_RELATION YES)
|
||||||
|
set(DOXYGEN_REFERENCES_RELATION YES)
|
||||||
|
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/INDEX.md")
|
||||||
|
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE INDEX.md)
|
||||||
|
set(_hdk_doc_mainpage "${CMAKE_CURRENT_SOURCE_DIR}/INDEX.md")
|
||||||
|
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
|
||||||
|
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE README.md)
|
||||||
|
set(_hdk_doc_mainpage "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
doxygen_add_docs(docs
|
||||||
|
${_hdk_doc_mainpage}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/include/
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/*.md
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
COMMENT "Generate ${PROJECT_NAME} API Documentation"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Automatically install documentation
|
||||||
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docs/html/
|
||||||
|
DESTINATION ${CMAKE_INSTALL_DOCDIR}
|
||||||
|
COMPONENT ${PROJECT_NAME}_doc
|
||||||
|
OPTIONAL)
|
||||||
|
|
||||||
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docs/man/man3/
|
||||||
|
DESTINATION ${CMAKE_INSTALL_MANDIR}/man3
|
||||||
|
COMPONENT ${PROJECT_NAME}_doc
|
||||||
|
OPTIONAL)
|
||||||
|
|
||||||
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docs/latex/
|
||||||
|
DESTINATION ${CMAKE_INSTALL_DOCDIR}/latex
|
||||||
|
COMPONENT ${PROJECT_NAME}_doc
|
||||||
|
OPTIONAL)
|
||||||
|
else()
|
||||||
|
message(WARNING "Doxygen not found, API documentation will not be generated for ${PROJECT_NAME}.")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
include(CMakeParseArguments)
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
# Resolve hdk-assets for examples only.
|
||||||
|
function(hdk_resolve_example_assets)
|
||||||
|
set(_opts "")
|
||||||
|
set(_one_value OUT_VAR FETCH_OPTION MIN_VERSION GIT_REPOSITORY GIT_TAG CONTEXT)
|
||||||
|
cmake_parse_arguments(HDK_ASSETS "${_opts}" "${_one_value}" "" ${ARGN})
|
||||||
|
|
||||||
|
if(NOT HDK_ASSETS_OUT_VAR)
|
||||||
|
message(FATAL_ERROR "hdk_resolve_example_assets requires OUT_VAR")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_resolved_assets_dir "")
|
||||||
|
set(_repo_assets_dir "${CMAKE_CURRENT_SOURCE_DIR}/../../assets")
|
||||||
|
if(EXISTS "${_repo_assets_dir}/textures")
|
||||||
|
set(_resolved_assets_dir "${_repo_assets_dir}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT _resolved_assets_dir)
|
||||||
|
if(HDK_ASSETS_MIN_VERSION)
|
||||||
|
find_package(hdk_assets ${HDK_ASSETS_MIN_VERSION} QUIET CONFIG NAMES hdk-assets hdk_assets)
|
||||||
|
else()
|
||||||
|
find_package(hdk_assets QUIET CONFIG NAMES hdk-assets hdk_assets)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
foreach(_candidate_var IN ITEMS HDK_ASSETS_SOURCE_DIR HDK_ASSETS_DIR hdk_assets_SOURCE_DIR hdk_assets_DIR)
|
||||||
|
if(NOT _resolved_assets_dir AND DEFINED ${_candidate_var})
|
||||||
|
set(_candidate_dir "${${_candidate_var}}")
|
||||||
|
if(EXISTS "${_candidate_dir}/textures")
|
||||||
|
set(_resolved_assets_dir "${_candidate_dir}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if(NOT _resolved_assets_dir AND DEFINED hdk_assets_DIR)
|
||||||
|
get_filename_component(_hdk_assets_prefix "${hdk_assets_DIR}" DIRECTORY)
|
||||||
|
get_filename_component(_hdk_assets_prefix "${_hdk_assets_prefix}" DIRECTORY)
|
||||||
|
get_filename_component(_hdk_assets_prefix "${_hdk_assets_prefix}" DIRECTORY)
|
||||||
|
if(EXISTS "${_hdk_assets_prefix}/assets/textures")
|
||||||
|
set(_resolved_assets_dir "${_hdk_assets_prefix}/assets")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT _resolved_assets_dir)
|
||||||
|
if(NOT HDK_ASSETS_FETCH_OPTION)
|
||||||
|
if(HDK_ASSETS_CONTEXT)
|
||||||
|
message(FATAL_ERROR "No suitable hdk-assets source found for ${HDK_ASSETS_CONTEXT} and fetch fallback is disabled")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "No suitable hdk-assets source found and fetch fallback is disabled")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT HDK_ASSETS_GIT_REPOSITORY)
|
||||||
|
message(FATAL_ERROR "hdk_resolve_example_assets fallback requires GIT_REPOSITORY")
|
||||||
|
endif()
|
||||||
|
if(NOT HDK_ASSETS_GIT_TAG)
|
||||||
|
message(FATAL_ERROR "hdk_resolve_example_assets fallback requires GIT_TAG")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
hdk_assets
|
||||||
|
GIT_REPOSITORY ${HDK_ASSETS_GIT_REPOSITORY}
|
||||||
|
GIT_TAG ${HDK_ASSETS_GIT_TAG}
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(hdk_assets)
|
||||||
|
set(_resolved_assets_dir "${hdk_assets_SOURCE_DIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(${HDK_ASSETS_OUT_VAR} "${_resolved_assets_dir}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
# HDK Packaging Policy
|
||||||
|
|
||||||
|
# Define variables for CPack
|
||||||
|
set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
|
||||||
|
set(CPACK_PACKAGE_VERSION "${CMAKE_PROJECT_VERSION}")
|
||||||
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CMAKE_PROJECT_DESCRIPTION}")
|
||||||
|
|
||||||
|
# We mainly want component-based installations for nice split packages
|
||||||
|
set(CPACK_DEB_COMPONENT_INSTALL ON CACHE INTERNAL "Enable component install")
|
||||||
|
|
||||||
|
# Setup Debian Generator
|
||||||
|
set(CPACK_GENERATOR "DEB" CACHE INTERNAL "Deb generator")
|
||||||
|
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "HDK Team" CACHE INTERNAL "HDK Team")
|
||||||
|
|
||||||
|
# Source package generator
|
||||||
|
set(CPACK_SOURCE_GENERATOR "TGZ;ZIP" CACHE INTERNAL "Sources")
|
||||||
|
set(CPACK_SOURCE_IGNORE_FILES
|
||||||
|
"/.git/"
|
||||||
|
"/build/"
|
||||||
|
"/build.*/"
|
||||||
|
".*~$"
|
||||||
|
CACHE INTERNAL "Ignores"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Component specific configurations
|
||||||
|
string(TOUPPER "${PROJECT_NAME}" UPPER_PROJ_NAME)
|
||||||
|
|
||||||
|
# CPack explicitly needs UPPERCASE. Hyphens must remain hyphens in modern CMake CPack.
|
||||||
|
set(COMP_DEV "${UPPER_PROJ_NAME}_DEV")
|
||||||
|
set(COMP_DOC "${UPPER_PROJ_NAME}_DOC")
|
||||||
|
set(COMP_EXAMPLES "${UPPER_PROJ_NAME}_EXAMPLES")
|
||||||
|
|
||||||
|
set(CPACK_DEBIAN_${COMP_DEV}_PACKAGE_NAME "${PROJECT_NAME}-dev" CACHE INTERNAL "")
|
||||||
|
set(CPACK_DEBIAN_${COMP_DOC}_PACKAGE_NAME "${PROJECT_NAME}-doc" CACHE INTERNAL "")
|
||||||
|
set(CPACK_DEBIAN_${COMP_EXAMPLES}_PACKAGE_NAME "${PROJECT_NAME}-examples" CACHE INTERNAL "")
|
||||||
|
|
||||||
|
set(CPACK_DEBIAN_${COMP_DEV}_FILE_NAME "${PROJECT_NAME}-dev.deb" CACHE INTERNAL "")
|
||||||
|
set(CPACK_DEBIAN_${COMP_DOC}_FILE_NAME "${PROJECT_NAME}-doc.deb" CACHE INTERNAL "")
|
||||||
|
set(CPACK_DEBIAN_${COMP_EXAMPLES}_FILE_NAME "${PROJECT_NAME}-examples.deb" CACHE INTERNAL "")
|
||||||
|
|
||||||
|
if(DEFINED ${PROJECT_NAME}_DEBIAN_DEPENDS)
|
||||||
|
set(CPACK_DEBIAN_${COMP_DEV}_PACKAGE_DEPENDS "${${PROJECT_NAME}_DEBIAN_DEPENDS}" CACHE INTERNAL "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||||
|
include(CPack)
|
||||||
|
endif()
|
||||||
Reference in New Issue
Block a user