Skip to content

Commit 7a2cad7

Browse files
Build - vendor the glog dependency.
This also moves away from using miniglog embedded inside Ceres solver.
1 parent e942172 commit 7a2cad7

99 files changed

Lines changed: 19650 additions & 265 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ mm_common_setup_clang_tidy_compile_commands(
125125

126126
include(MMSolverUtils)
127127

128-
# Build features
128+
# Build features.
129129
add_subdirectory(share)
130130

131131
if (MMSOLVER_BUILD_PLUGIN)
132-
# Set up vendored Eigen variables for external dependencies that need them
132+
# Set up vendored Eigen variables for external dependencies that need them.
133133
set(eigen_vendored_dir "${CMAKE_CURRENT_SOURCE_DIR}/lib/thirdparty/eigen")
134134
if(EXISTS "${eigen_vendored_dir}")
135135
set(Eigen3_FOUND TRUE)
@@ -139,6 +139,9 @@ if (MMSOLVER_BUILD_PLUGIN)
139139
message(STATUS "Set up vendored Eigen variables for main build dependencies: ${eigen_vendored_dir}")
140140
endif()
141141

142+
# Build vendored dependencies first.
143+
add_subdirectory(lib)
144+
142145
# Finds and builds external (third-party) dependencies.
143146
#
144147
# NOTE: Dependencies are handled in mmsolverlibs sub-project.

lib/CMakeLists.txt

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,13 @@ set(PROJECT_DESCRIPTION "mmSolver libraries.")
5656
set(PROJECT_AUTHOR "David Cattermole")
5757
set(PROJECT_COPYRIGHT "2023, 2024, David Cattermole.")
5858

59-
set(MMSOLVERLIBS_LIB_DIR "/path/to/rust/build/directory/" CACHE PATH
59+
# TODO: This relies on the '${mmsolverlibs_rust_DIR}' variable being set,
60+
# which is not ideal at all. Instead this should be a default value
61+
# (such as "/path/to/rust/build/directory/").
62+
set(MMSOLVERLIBS_LIB_DIR "${mmsolverlibs_rust_DIR}" CACHE PATH
6063
"The path to the directory containing the compiled library.")
6164

62-
# Add custom modules to the module path
65+
# Add custom modules to the module path.
6366
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
6467
${CMAKE_CURRENT_SOURCE_DIR}/../share/cmake/modules
6568
${CMAKE_CURRENT_SOURCE_DIR}/share/cmake/modules)
@@ -71,16 +74,6 @@ include(MMCommonUtils)
7174
option(MMSOLVER_DEBUG "Enable mmSolver debug mode; prints details and enables debug assertions." OFF)
7275
mm_common_set_global_compile_options(MMSOLVER_DEBUG)
7376

74-
# Ensure compile_commands.json is generated as part of the build, for
75-
# clang-tidy to use.
76-
#
77-
# We must have CMAKE_EXPORT_COMPILE_COMMANDS set to ON for this to
78-
# work.
79-
include(MMCommonUtils)
80-
mm_common_setup_clang_tidy_compile_commands(
81-
${CMAKE_BINARY_DIR}
82-
${CMAKE_CURRENT_LIST_DIR})
83-
8477
include(MMRustUtils)
8578
set(rust_linktime_file "NOT-FOUND")
8679
mm_rust_find_rust_library(${rust_lib_name} ${MMSOLVERLIBS_LIB_DIR} rust_linktime_file)

lib/thirdparty/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@
2121

2222
add_subdirectory(cminpack)
2323
add_subdirectory(eigen)
24+
add_subdirectory(glog)
2425
add_subdirectory(openMVG)

lib/thirdparty/glog/.clang-format

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: Google
4+
AccessModifierOffset: -1
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveMacros: false
7+
AlignConsecutiveAssignments: false
8+
AlignConsecutiveDeclarations: false
9+
AlignEscapedNewlines: Left
10+
AlignOperands: true
11+
AlignTrailingComments: true
12+
AllowAllArgumentsOnNextLine: true
13+
AllowAllConstructorInitializersOnNextLine: true
14+
AllowAllParametersOfDeclarationOnNextLine: true
15+
AllowShortBlocksOnASingleLine: Never
16+
AllowShortCaseLabelsOnASingleLine: false
17+
AllowShortFunctionsOnASingleLine: All
18+
AllowShortLambdasOnASingleLine: All
19+
AllowShortIfStatementsOnASingleLine: WithoutElse
20+
AllowShortLoopsOnASingleLine: true
21+
AlwaysBreakAfterDefinitionReturnType: None
22+
AlwaysBreakAfterReturnType: None
23+
AlwaysBreakBeforeMultilineStrings: true
24+
AlwaysBreakTemplateDeclarations: Yes
25+
BinPackArguments: true
26+
BinPackParameters: true
27+
BraceWrapping:
28+
AfterCaseLabel: false
29+
AfterClass: false
30+
AfterControlStatement: false
31+
AfterEnum: false
32+
AfterFunction: false
33+
AfterNamespace: false
34+
AfterObjCDeclaration: false
35+
AfterStruct: false
36+
AfterUnion: false
37+
AfterExternBlock: false
38+
BeforeCatch: false
39+
BeforeElse: false
40+
IndentBraces: false
41+
SplitEmptyFunction: true
42+
SplitEmptyRecord: true
43+
SplitEmptyNamespace: true
44+
BreakBeforeBinaryOperators: None
45+
BreakBeforeBraces: Attach
46+
BreakBeforeInheritanceComma: false
47+
BreakInheritanceList: BeforeColon
48+
BreakBeforeTernaryOperators: true
49+
BreakConstructorInitializersBeforeComma: false
50+
BreakConstructorInitializers: BeforeColon
51+
BreakAfterJavaFieldAnnotations: false
52+
BreakStringLiterals: true
53+
ColumnLimit: 80
54+
CommentPragmas: '^ IWYU pragma:'
55+
CompactNamespaces: false
56+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
57+
ConstructorInitializerIndentWidth: 4
58+
ContinuationIndentWidth: 4
59+
Cpp11BracedListStyle: true
60+
DeriveLineEnding: true
61+
DerivePointerAlignment: false
62+
DisableFormat: false
63+
ExperimentalAutoDetectBinPacking: false
64+
FixNamespaceComments: true
65+
ForEachMacros:
66+
- foreach
67+
- Q_FOREACH
68+
- BOOST_FOREACH
69+
IncludeBlocks: Regroup
70+
IncludeCategories:
71+
- Regex: '^<ext/.*\.h>'
72+
Priority: 2
73+
SortPriority: 0
74+
- Regex: '^<.*\.h>'
75+
Priority: 1
76+
SortPriority: 0
77+
- Regex: '^<.*'
78+
Priority: 2
79+
SortPriority: 0
80+
- Regex: '.*'
81+
Priority: 3
82+
SortPriority: 0
83+
IncludeIsMainRegex: '([-_](test|unittest))?$'
84+
IncludeIsMainSourceRegex: ''
85+
IndentCaseLabels: true
86+
IndentGotoLabels: true
87+
IndentPPDirectives: AfterHash
88+
IndentWidth: 2
89+
IndentWrappedFunctionNames: false
90+
JavaScriptQuotes: Leave
91+
JavaScriptWrapImports: true
92+
KeepEmptyLinesAtTheStartOfBlocks: false
93+
MacroBlockBegin: ''
94+
MacroBlockEnd: ''
95+
MaxEmptyLinesToKeep: 1
96+
NamespaceIndentation: None
97+
ObjCBinPackProtocolList: Never
98+
ObjCBlockIndentWidth: 2
99+
ObjCSpaceAfterProperty: false
100+
ObjCSpaceBeforeProtocolList: true
101+
PenaltyBreakAssignment: 2
102+
PenaltyBreakBeforeFirstCallParameter: 1
103+
PenaltyBreakComment: 300
104+
PenaltyBreakFirstLessLess: 120
105+
PenaltyBreakString: 1000
106+
PenaltyBreakTemplateDeclaration: 10
107+
PenaltyExcessCharacter: 1000000
108+
PenaltyReturnTypeOnItsOwnLine: 200
109+
PointerAlignment: Left
110+
RawStringFormats:
111+
- Language: Cpp
112+
Delimiters:
113+
- cc
114+
- CC
115+
- cpp
116+
- Cpp
117+
- CPP
118+
- 'c++'
119+
- 'C++'
120+
CanonicalDelimiter: ''
121+
BasedOnStyle: google
122+
- Language: TextProto
123+
Delimiters:
124+
- pb
125+
- PB
126+
- proto
127+
- PROTO
128+
EnclosingFunctions:
129+
- EqualsProto
130+
- EquivToProto
131+
- PARSE_PARTIAL_TEXT_PROTO
132+
- PARSE_TEST_PROTO
133+
- PARSE_TEXT_PROTO
134+
- ParseTextOrDie
135+
- ParseTextProtoOrDie
136+
CanonicalDelimiter: ''
137+
BasedOnStyle: google
138+
ReflowComments: true
139+
SortIncludes: true
140+
SortUsingDeclarations: true
141+
SpaceAfterCStyleCast: false
142+
SpaceAfterLogicalNot: false
143+
SpaceAfterTemplateKeyword: true
144+
SpaceBeforeAssignmentOperators: true
145+
SpaceBeforeCpp11BracedList: false
146+
SpaceBeforeCtorInitializerColon: true
147+
SpaceBeforeInheritanceColon: true
148+
SpaceBeforeParens: ControlStatements
149+
SpaceBeforeRangeBasedForLoopColon: true
150+
SpaceInEmptyBlock: false
151+
SpaceInEmptyParentheses: false
152+
SpacesBeforeTrailingComments: 2
153+
SpacesInAngles: false
154+
SpacesInConditionalStatement: false
155+
SpacesInContainerLiterals: true
156+
SpacesInCStyleCastParentheses: false
157+
SpacesInParentheses: false
158+
SpacesInSquareBrackets: false
159+
SpaceBeforeSquareBrackets: false
160+
Standard: c++14
161+
StatementMacros:
162+
- Q_UNUSED
163+
- QT_REQUIRE_VERSION
164+
TabWidth: 8
165+
UseCRLF: false
166+
UseTab: Never
167+
...
168+

lib/thirdparty/glog/.clang-tidy

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
Checks: 'clang-diagnostic-*,clang-analyzer-*,google-*,modernize-*,-modernize-use-trailing-return-type,readability-*,portability-*,performance-*,bugprone-*,android-*,darwin-*,clang-analyzer-*'
3+
WarningsAsErrors: ''
4+
HeaderFilterRegex: ''
5+
AnalyzeTemporaryDtors: false
6+
FormatStyle: file
7+
CheckOptions:
8+
- key: cert-dcl16-c.NewSuffixes
9+
value: 'L;LL;LU;LLU'
10+
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
11+
value: '0'
12+
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
13+
value: '1'
14+
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
15+
value: '1'
16+
- key: google-build-namespaces.HeaderFileExtensions
17+
value: ',h,hh,hpp,hxx'
18+
- key: google-global-names-in-headers.HeaderFileExtensions
19+
value: ',h,hh,hpp,hxx'
20+
- key: google-readability-braces-around-statements.ShortStatementLines
21+
value: '1'
22+
- key: google-readability-function-size.BranchThreshold
23+
value: '4294967295'
24+
- key: google-readability-function-size.LineThreshold
25+
value: '4294967295'
26+
- key: google-readability-function-size.NestingThreshold
27+
value: '4294967295'
28+
- key: google-readability-function-size.ParameterThreshold
29+
value: '4294967295'
30+
- key: google-readability-function-size.StatementThreshold
31+
value: '800'
32+
- key: google-readability-function-size.VariableThreshold
33+
value: '4294967295'
34+
- key: google-readability-namespace-comments.ShortNamespaceLines
35+
value: '10'
36+
- key: google-readability-namespace-comments.SpacesBeforeComments
37+
value: '2'
38+
- key: google-runtime-int.SignedTypePrefix
39+
value: int
40+
- key: google-runtime-int.TypeSuffix
41+
value: ''
42+
- key: google-runtime-int.UnsignedTypePrefix
43+
value: uint
44+
- key: google-runtime-references.WhiteListTypes
45+
value: ''
46+
- key: modernize-loop-convert.MaxCopySize
47+
value: '16'
48+
- key: modernize-loop-convert.MinConfidence
49+
value: reasonable
50+
- key: modernize-loop-convert.NamingStyle
51+
value: CamelCase
52+
- key: modernize-pass-by-value.IncludeStyle
53+
value: llvm
54+
- key: modernize-replace-auto-ptr.IncludeStyle
55+
value: llvm
56+
- key: modernize-use-nullptr.NullMacros
57+
value: 'NULL'
58+
...
59+

lib/thirdparty/glog/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.h linguist-language=C++

lib/thirdparty/glog/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.orig
2+
/build*/
3+
bazel-*

lib/thirdparty/glog/AUTHORS

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This is the official list of glog authors for copyright purposes.
2+
# This file is distinct from the CONTRIBUTORS files.
3+
# See the latter for an explanation.
4+
#
5+
# Names should be added to this file as:
6+
# Name or Organization <email address>
7+
# The email address is not required for organizations.
8+
#
9+
# Please keep the list sorted.
10+
11+
Abhishek Dasgupta <abhi2743@gmail.com>
12+
Abhishek Parmar <abhishek@orng.net>
13+
Andrew Schwartzmeyer <andrew@schwartzmeyer.com>
14+
Andy Ying <andy@trailofbits.com>
15+
Brian Silverman <bsilver16384@gmail.com>
16+
Dmitriy Arbitman <d.arbitman@gmail.com>
17+
Google Inc.
18+
Guillaume Dumont <dumont.guillaume@gmail.com>
19+
LingBin <lingbinlb@gmail.com>
20+
Marco Wang <m.aesophor@gmail.com>
21+
Michael Tanner <michael@tannertaxpro.com>
22+
MiniLight <MiniLightAR@Gmail.com>
23+
romange <romange@users.noreply.github.com>
24+
Roman Perepelitsa <roman.perepelitsa@gmail.com>
25+
Sergiu Deitsch <sergiu.deitsch@gmail.com>
26+
tbennun <tbennun@gmail.com>
27+
Teddy Reed <teddy@prosauce.org>
28+
Vijaymahantesh Sattigeri <vijaymahantesh016@gmail.com>
29+
Zhongming Qu <qzmfranklin@gmail.com>
30+
Zhuoran Shen <cmsflash99@gmail.com>

0 commit comments

Comments
 (0)