Skip to content

Commit

Permalink
Merge pull request #45 from kobejean/jean
Browse files Browse the repository at this point in the history
Update `g2o` to fix `g2o_viewer`
  • Loading branch information
kobejean authored Feb 21, 2022
2 parents a1a7567 + 191ed4d commit 1cfc226
Show file tree
Hide file tree
Showing 535 changed files with 29,310 additions and 27,760 deletions.
2 changes: 1 addition & 1 deletion script/build_frameworks.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ rm -rf build/frameworks
mkdir build/frameworks

./script/build_lar_framework.bash
# ./script/build_g2o_framework.bash
./script/build_g2o_framework.bash

# Uncomment if opencv needs to be rebuilt
# Otherwise just download the framework from here: https://github.com/kobejean/lar/releases/download/v0.5.0/opencv2.xcframework.zip
Expand Down
212 changes: 212 additions & 0 deletions thirdparty/g2o/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: true
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
DeriveLineEnding: true
DerivePointerAlignment: true
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*\.h>'
Priority: 1
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 3
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseLabels: true
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentRequires: false
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: Signature
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
PenaltyIndentedWhitespace: 0
PointerAlignment: Left
PPIndentWidth: -1
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: pb
BasedOnStyle: google
ReferenceAlignment: Pointer
ReflowComments: true
ShortNamespaceLines: 1
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceAroundPointerQualifiers: Default
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both
Standard: Auto
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
...

3 changes: 2 additions & 1 deletion thirdparty/g2o/.codacy.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
exclude_paths:
- 'EXTERNAL/**'
- 'script/**'
- 'g2o/EXTERNAL/**'
- g2o/examples/interactive_slam/slam_parser/parser/bison_parser.cpp
- g2o/examples/interactive_slam/slam_parser/parser/flex_scanner.cpp
- g2o/examples/interactive_slam/slam_parser/parser/FlexLexer.h
8 changes: 7 additions & 1 deletion thirdparty/g2o/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ jobs:
echo github.event_name: ${{github.event_name}}
echo runner.os: ${{runner.os}}
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ matrix.os }}-${{ matrix.type }}
max-size: 1000M

- name: Install dependencies on Ubuntu
if: runner.os == 'Linux'
run: |
Expand All @@ -67,7 +73,7 @@ jobs:
- name: Configure CMake
run: |
cmake --version
cmake -B ${{github.workspace}}/build -DBUILD_UNITTESTS=ON -DBUILD_CODE_COVERAGE=${{matrix.config.do_coverage}} -DCMAKE_BUILD_TYPE=${{matrix.config.build_type}}
cmake -B ${{github.workspace}}/build -DBUILD_UNITTESTS=ON -DBUILD_CODE_COVERAGE=${{matrix.config.do_coverage}} -DCMAKE_BUILD_TYPE=${{matrix.config.build_type}} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build Introspection
shell: bash
Expand Down
26 changes: 26 additions & 0 deletions thirdparty/g2o/.github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Clang-format-check

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
checkout-and-check-formatting:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2

- name: Install clang
run: |
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main" | sudo tee -a /etc/apt/sources.list.d/clang.list
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install clang-format-13
sudo ln -s /usr/lib/llvm-13/bin/clang-format /usr/local/bin/clang-format
clang-format --version
- name: clang format check
run: bash script/run-style-check-diff.sh
2 changes: 1 addition & 1 deletion thirdparty/g2o/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.14)
set(CMAKE_LEGACY_CYGWIN_WIN32 0)

project(g2o)
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/g2o/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ will install g2o together with its required dependencies. In this case no manual

If using [vcpkg](https://github.com/Microsoft/vcpkg), then

`scripts\install-deps-windows.bat`
`script\install-deps-windows.bat`

will build and install the required dependencies. The location of `vcpkg` and required triplet are determined by the environment variables `VCPKG_ROOT_DIR` and `VCPKG_DEFAULT_TRIPLET`.

Expand Down
2 changes: 1 addition & 1 deletion thirdparty/g2o/appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ build:
project: c:\projects\g2o\build\g2o.sln

install:
- set QTDIR=C:\Qt\5.15.1\msvc2019_64
- set QTDIR=C:\Qt\5.15.2\msvc2019_64
- set PATH=%PATH%;%QTDIR%\bin
- ps: wget https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.zip -outfile eigen3.zip
- cmd: 7z x eigen3.zip -o"C:\projects" -y > nul
Expand Down
39 changes: 21 additions & 18 deletions thirdparty/g2o/benchmarks/jacobian_timing_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
#include "g2o/core/dynamic_aligned_buffer.hpp"

#ifdef G2O_USE_VENDORED_CERES
#include "g2o/EXTERNAL/ceres/fixed_array.h"
#include "g2o/EXTERNAL/ceres/fixed_array.h"
#else
#include <ceres/internal/fixed_array.h>
#include <ceres/internal/fixed_array.h>
#endif

// Test several different ways of evaluating Jacobians to see the impact of different ways of implementing stuff.
// Test several different ways of evaluating Jacobians to see the impact of
// different ways of implementing stuff.

template <typename number_t, int D>
void BM_FixedArray(benchmark::State& state) {
Expand Down Expand Up @@ -76,7 +77,8 @@ void BM_VariableArrayPointer(benchmark::State& state) {
template <typename number_t, int D>
void BM_StaticEigenMatrix(benchmark::State& state) {
while (state.KeepRunning()) {
Eigen::Matrix<number_t, D, 1> add_vi = Eigen::Matrix<number_t, D, 1>::Zero();
Eigen::Matrix<number_t, D, 1> add_vi =
Eigen::Matrix<number_t, D, 1>::Zero();
for (int i = 0; i < D; ++i) {
benchmark::DoNotOptimize(add_vi[i] = 1);
benchmark::DoNotOptimize(add_vi[i] = -1);
Expand All @@ -88,7 +90,8 @@ void BM_StaticEigenMatrix(benchmark::State& state) {
template <typename number_t, int D>
void BM_StaticEigenMatrixPointer(benchmark::State& state) {
while (state.KeepRunning()) {
Eigen::Matrix<number_t, D, 1> add_vi = Eigen::Matrix<number_t, D, 1>::Zero();
Eigen::Matrix<number_t, D, 1> add_vi =
Eigen::Matrix<number_t, D, 1>::Zero();
number_t* v = add_vi.data();
for (int i = 0; i < D; ++i) {
benchmark::DoNotOptimize((*v) = 1);
Expand Down Expand Up @@ -210,19 +213,19 @@ void BM_ClassFixedArrayDynamic(benchmark::State& state) {
}
}

#define DECLARE_TESTS(N, D) \
BENCHMARK_TEMPLATE2(BM_FixedArray, N, D); \
BENCHMARK_TEMPLATE2(BM_FixedArrayPointer, N, D); \
BENCHMARK_TEMPLATE(BM_VariableArray, N)->Arg(D); \
BENCHMARK_TEMPLATE(BM_VariableArrayPointer, N)->Arg(D); \
BENCHMARK_TEMPLATE2(BM_StaticEigenMatrix, N, D); \
BENCHMARK_TEMPLATE2(BM_StaticEigenMatrixPointer, N, D); \
BENCHMARK_TEMPLATE(BM_DynamicEigenMatrix, N)->Arg(D); \
BENCHMARK_TEMPLATE(BM_DynamicEigenMatrixPointer, N)->Arg(D); \
BENCHMARK_TEMPLATE2(BM_DynamicAlignedBuffer, N, D); \
BENCHMARK_TEMPLATE2(BM_DynamicAlignedPointerBuffer, N, D); \
BENCHMARK_TEMPLATE(BM_StaticDynamicPointerHybrid, N)->Arg(D);\
BENCHMARK_TEMPLATE(BM_ClassFixedArrayStatic, N, D); \
#define DECLARE_TESTS(N, D) \
BENCHMARK_TEMPLATE2(BM_FixedArray, N, D); \
BENCHMARK_TEMPLATE2(BM_FixedArrayPointer, N, D); \
BENCHMARK_TEMPLATE(BM_VariableArray, N)->Arg(D); \
BENCHMARK_TEMPLATE(BM_VariableArrayPointer, N)->Arg(D); \
BENCHMARK_TEMPLATE2(BM_StaticEigenMatrix, N, D); \
BENCHMARK_TEMPLATE2(BM_StaticEigenMatrixPointer, N, D); \
BENCHMARK_TEMPLATE(BM_DynamicEigenMatrix, N)->Arg(D); \
BENCHMARK_TEMPLATE(BM_DynamicEigenMatrixPointer, N)->Arg(D); \
BENCHMARK_TEMPLATE2(BM_DynamicAlignedBuffer, N, D); \
BENCHMARK_TEMPLATE2(BM_DynamicAlignedPointerBuffer, N, D); \
BENCHMARK_TEMPLATE(BM_StaticDynamicPointerHybrid, N)->Arg(D); \
BENCHMARK_TEMPLATE(BM_ClassFixedArrayStatic, N, D); \
BENCHMARK_TEMPLATE(BM_ClassFixedArrayDynamic, N)->Arg(D);

/*
Expand Down
1 change: 0 additions & 1 deletion thirdparty/g2o/g2o/apps/g2o_cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ install(TARGETS g2o_cli_library g2o_cli_application
LIBRARY DESTINATION ${LIBRARY_DESTINATION}
ARCHIVE DESTINATION ${ARCHIVE_DESTINATION}
INCLUDES DESTINATION ${INCLUDES_DESTINATION}
BUNDLE DESTINATION ${LIBRARY_DESTINATION}
)

file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp")
Expand Down
Loading

0 comments on commit 1cfc226

Please sign in to comment.