From 383440cb3eb69e1747691c27685c76fe29420691 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 03:57:51 +0000 Subject: [PATCH 01/46] Stub out initial github workflow to build with CMake --- .github/workflows/cmake_ci.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/cmake_ci.yaml diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml new file mode 100644 index 00000000000..1fea345fe53 --- /dev/null +++ b/.github/workflows/cmake_ci.yaml @@ -0,0 +1,18 @@ +name: Build +on: + push: +jobs: + build-project: + name: Build Project + runs-on: ubuntu-24.04 + steps: + - name: Checkout Project + uses: actions/checkout@v4.2.2 + + - name: Install apt dependencies uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: libfmt-dev libg2o-dev libopencv-dev + version: 1.0 + + - name: Build Project + uses: threeal/cmake-action@v2.1.0 From e56a08cc1598f02faf36706bf61430f679318027 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 04:01:58 +0000 Subject: [PATCH 02/46] Update run conditions --- .github/workflows/cmake_ci.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index 1fea345fe53..780e261bccb 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -1,6 +1,12 @@ name: Build + on: + pull_request: push: + branches: + - master + workflow_dispatch: + jobs: build-project: name: Build Project From 3e99ceb50d5519698df8560fa5841566b0f7ddd5 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 04:03:36 +0000 Subject: [PATCH 03/46] Correct YAML error --- .github/workflows/cmake_ci.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index 780e261bccb..ce1f528b550 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -15,7 +15,8 @@ jobs: - name: Checkout Project uses: actions/checkout@v4.2.2 - - name: Install apt dependencies uses: awalsh128/cache-apt-pkgs-action@latest + - name: Install apt dependencies + uses: awalsh128/cache-apt-pkgs-action@latest with: packages: libfmt-dev libg2o-dev libopencv-dev version: 1.0 From 0e20e3d4633229b5e1fbb2c8b5b0918932e47bcc Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 04:13:48 +0000 Subject: [PATCH 04/46] Add run-vcpkg to install Pangolin --- .github/workflows/cmake_ci.yaml | 5 +++++ vcpkg.json | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 vcpkg.json diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index ce1f528b550..69a0b76e59c 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -21,5 +21,10 @@ jobs: packages: libfmt-dev libg2o-dev libopencv-dev version: 1.0 + - name: Build Pangolin with vcpkg + uses: lukka/run-vcpkg@v11 + with: + runVcpkgInstall: true + - name: Build Project uses: threeal/cmake-action@v2.1.0 diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 00000000000..d54b47d53aa --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", + "dependencies": [ + "pangolin" + ] +} From dd6dd730ddac3f8e449126742b6c6ca608b4562d Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 04:19:18 +0000 Subject: [PATCH 05/46] Update vcpkg.json --- vcpkg.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vcpkg.json b/vcpkg.json index d54b47d53aa..cce84e8f86c 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,5 +1,6 @@ { - "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", + "name": "main", + "version-string": "latest", "dependencies": [ "pangolin" ] From bd00dbe7141de74baadd912eb4043e892a5cfac5 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 04:26:03 +0000 Subject: [PATCH 06/46] Add vcpkg configuration --- vcpkg.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vcpkg.json b/vcpkg.json index cce84e8f86c..4f906ca5eed 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,6 +1,14 @@ { "name": "main", "version-string": "latest", + "configuration": { + "default-registry": + { + "kind": "git", + "baseline": "e3db8f65d2414c301c29a8467c6aee94e3ba09fc", + "repository": "https://github.com/Microsoft/vcpkg" + } + }, "dependencies": [ "pangolin" ] From 9d430196a56c964c82b666f9933cee794e586eb4 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 04:31:00 +0000 Subject: [PATCH 07/46] Add vcpkgGitCommitId to CI file --- .github/workflows/cmake_ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index 69a0b76e59c..1c842ea5af6 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -25,6 +25,7 @@ jobs: uses: lukka/run-vcpkg@v11 with: runVcpkgInstall: true + vcpkgGitCommitId: e3db8f65d2414c301c29a8467c6aee94e3ba09fc - name: Build Project uses: threeal/cmake-action@v2.1.0 From 789f19ced6c9defb6a4b080812930b0ac1344973 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 04:33:08 +0000 Subject: [PATCH 08/46] Add nasm to packages --- .github/workflows/cmake_ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index 1c842ea5af6..21998ade6b0 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -18,7 +18,7 @@ jobs: - name: Install apt dependencies uses: awalsh128/cache-apt-pkgs-action@latest with: - packages: libfmt-dev libg2o-dev libopencv-dev + packages: libfmt-dev libg2o-dev libopencv-dev nasm version: 1.0 - name: Build Pangolin with vcpkg From 2bc78cfdc0588c88fe9bdb178e4a43ba437ce245 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 04:45:46 +0000 Subject: [PATCH 09/46] Add Pangolin APT dependencies --- .github/workflows/cmake_ci.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index 21998ade6b0..d92e0bcd0e0 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -18,7 +18,9 @@ jobs: - name: Install apt dependencies uses: awalsh128/cache-apt-pkgs-action@latest with: - packages: libfmt-dev libg2o-dev libopencv-dev nasm + packages: libfmt-dev libg2o-dev libopencv-dev nasm \ + libgl1-mesa-dev libwayland-dev libxkbcommon-dev wayland-protocols libegl1-mesa-dev \ + libc++-dev libepoxy-dev libglew-dev libeigen3-dev cmake g++ ninja-build version: 1.0 - name: Build Pangolin with vcpkg From d146456ccb9f54247f2cfac8ffe27d1f29ff39a0 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 05:31:30 +0000 Subject: [PATCH 10/46] Integate vcpkg into CMake --- .github/workflows/cmake_ci.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index d92e0bcd0e0..2dc67ce4457 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -31,3 +31,6 @@ jobs: - name: Build Project uses: threeal/cmake-action@v2.1.0 + with: + options: | + -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg From ba2f3aa2aba0f5dc3e64225eee4e7878451aaa4f Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 05:43:52 +0000 Subject: [PATCH 11/46] vcpkg caching, try config mode --- .github/workflows/cmake_ci.yaml | 3 +++ CMakeLists.txt | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index 2dc67ce4457..f7a0bdd835c 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -19,6 +19,7 @@ jobs: uses: awalsh128/cache-apt-pkgs-action@latest with: packages: libfmt-dev libg2o-dev libopencv-dev nasm \ + libx11-dev libgles2-mesa-dev \ libgl1-mesa-dev libwayland-dev libxkbcommon-dev wayland-protocols libegl1-mesa-dev \ libc++-dev libepoxy-dev libglew-dev libeigen3-dev cmake g++ ninja-build version: 1.0 @@ -28,6 +29,8 @@ jobs: with: runVcpkgInstall: true vcpkgGitCommitId: e3db8f65d2414c301c29a8467c6aee94e3ba09fc + # Enable caching of built packages + doNotCache: false - name: Build Project uses: threeal/cmake-action@v2.1.0 diff --git a/CMakeLists.txt b/CMakeLists.txt index a03a584b5f2..25c5b40937f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ MESSAGE("OPENCV VERSION:") MESSAGE(${OpenCV_VERSION}) find_package(Eigen3 3.1.0 REQUIRED) -find_package(Pangolin REQUIRED) +find_package(Pangolin CONFIG REQUIRED) find_package(Sophus REQUIRED) find_package(g2o REQUIRED) find_package(fmt REQUIRED) @@ -73,6 +73,7 @@ add_library(${PROJECT_NAME} SHARED src/TwoViewReconstruction.cc src/Viewer.cc ) +target_compile_definitions(${PROJECT_NAME} PUBLIC REGISTER_TIMES) target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS} From a9a2f641edb7d644067eb9eec88932826faf1388 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 16:16:39 +0000 Subject: [PATCH 12/46] Correct syntax for cmake-action option --- .github/workflows/cmake_ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index f7a0bdd835c..2e7bb4b63f9 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -36,4 +36,4 @@ jobs: uses: threeal/cmake-action@v2.1.0 with: options: | - -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg + CMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg From 607352056ada996cbc8bdd873470cdcc07082fa0 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 17:08:29 +0000 Subject: [PATCH 13/46] Correct name for cmake toolchain file --- .github/workflows/cmake_ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index 2e7bb4b63f9..eca77c39e95 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -36,4 +36,4 @@ jobs: uses: threeal/cmake-action@v2.1.0 with: options: | - CMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg + CMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake From e682e0d273470154e76dbd8f4c3a16f70c10f8fc Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 17:41:19 +0000 Subject: [PATCH 14/46] Added sophus as vcpkg dependency --- vcpkg.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vcpkg.json b/vcpkg.json index 4f906ca5eed..5e8821bd03c 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -10,6 +10,7 @@ } }, "dependencies": [ - "pangolin" + "pangolin", + "sophus" ] } From c5c90b0422e0e817af8325f0d5937b8cefc9b228 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 18:09:18 +0000 Subject: [PATCH 15/46] Build g2o using vcpkg? --- .github/workflows/cmake_ci.yaml | 2 +- vcpkg.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index eca77c39e95..fc030220065 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -18,7 +18,7 @@ jobs: - name: Install apt dependencies uses: awalsh128/cache-apt-pkgs-action@latest with: - packages: libfmt-dev libg2o-dev libopencv-dev nasm \ + packages: libfmt-dev libopencv-dev nasm \ libx11-dev libgles2-mesa-dev \ libgl1-mesa-dev libwayland-dev libxkbcommon-dev wayland-protocols libegl1-mesa-dev \ libc++-dev libepoxy-dev libglew-dev libeigen3-dev cmake g++ ninja-build diff --git a/vcpkg.json b/vcpkg.json index 5e8821bd03c..d6272b41056 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -11,6 +11,7 @@ }, "dependencies": [ "pangolin", - "sophus" + "sophus", + "g2o[spdlog]" ] } From 91a38181a316fc9bd5feb8b83785f38364f4baff Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 18:18:45 +0000 Subject: [PATCH 16/46] Update dependency for g2o --- vcpkg.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vcpkg.json b/vcpkg.json index d6272b41056..9deb464d476 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -12,6 +12,11 @@ "dependencies": [ "pangolin", "sophus", - "g2o[spdlog]" + { + "name": "g2o", + "features": [ + "spdlog" + ] + } ] } From da4737d79551f3158231ea7e47b5b817af22a292 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 20:47:13 +0000 Subject: [PATCH 17/46] Add libboost-serialization-dev to apt dependencies --- .github/workflows/cmake_ci.yaml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index fc030220065..eeec7ec0a73 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -18,10 +18,24 @@ jobs: - name: Install apt dependencies uses: awalsh128/cache-apt-pkgs-action@latest with: - packages: libfmt-dev libopencv-dev nasm \ - libx11-dev libgles2-mesa-dev \ - libgl1-mesa-dev libwayland-dev libxkbcommon-dev wayland-protocols libegl1-mesa-dev \ - libc++-dev libepoxy-dev libglew-dev libeigen3-dev cmake g++ ninja-build + packages: \ + cmake \ + g++ \ + libboost-serialization-dev \ + libc++-dev \ + libegl1-mesa-dev \ + libeigen3-dev \ + libepoxy-dev \ + libfmt-dev \ + libgl1-mesa-dev \ + libgles2-mesa-dev \ + libglew-dev \ + libopencv-dev nasm \ + libwayland-dev \ + libx11-dev \ + libxkbcommon-dev \ + ninja-build \ + wayland-protocols version: 1.0 - name: Build Pangolin with vcpkg From 42ddcd649840806b812a7d1d9110478d6fb15f1a Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 22:11:50 +0000 Subject: [PATCH 18/46] Fix fmt error with CameraType, use more packages from vcpkg. --- .github/workflows/cmake_ci.yaml | 2 -- src/Settings.cc | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index eeec7ec0a73..1ab57ea7da1 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -24,9 +24,7 @@ jobs: libboost-serialization-dev \ libc++-dev \ libegl1-mesa-dev \ - libeigen3-dev \ libepoxy-dev \ - libfmt-dev \ libgl1-mesa-dev \ libgles2-mesa-dev \ libglew-dev \ diff --git a/src/Settings.cc b/src/Settings.cc index 736aa162f97..e88b5cc0e8f 100644 --- a/src/Settings.cc +++ b/src/Settings.cc @@ -117,7 +117,7 @@ void Settings::setMonoCamera(CameraType type, const std::vector& k, // vOverlapping; // } } else { - spdlog::error("Error: {} not known", type); + spdlog::error("Error: {} not known", static_cast(type)); exit(-1); } } From e8b5edab83d66759019a3d1d1f371685d4e10bd9 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 23:15:12 +0000 Subject: [PATCH 19/46] Alternative github workflow from https://github.com/lukka/CppCMakeVcpkgTemplate/blob/v11/.github/workflows/hosted-ninja-vcpkg_submod.ymlwq --- .clang-format | 1 + .github/workflows/cmake_ci.yaml | 31 ++++++++++++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000000..f6cb8ad931f --- /dev/null +++ b/.clang-format @@ -0,0 +1 @@ +BasedOnStyle: Google diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index 1ab57ea7da1..a6071b2a997 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -12,9 +12,6 @@ jobs: name: Build Project runs-on: ubuntu-24.04 steps: - - name: Checkout Project - uses: actions/checkout@v4.2.2 - - name: Install apt dependencies uses: awalsh128/cache-apt-pkgs-action@latest with: @@ -36,16 +33,28 @@ jobs: wayland-protocols version: 1.0 - - name: Build Pangolin with vcpkg + - name: Checkout Project + uses: actions/checkout@v4.2.2 + with: + submodules: true + + - uses: lukka/get-cmake@latest + + - name: Restore from cache and setup vcpkg executable and data files. uses: lukka/run-vcpkg@v11 with: - runVcpkgInstall: true - vcpkgGitCommitId: e3db8f65d2414c301c29a8467c6aee94e3ba09fc - # Enable caching of built packages + vcpkgJsonGlob: 'vcpkg.json' doNotCache: false - - name: Build Project - uses: threeal/cmake-action@v2.1.0 + # Note: if the preset misses the "configuration", it is possible to explicitly select the + # configuration with the additional `--config` flag, e.g.: + # buildPreset: 'ninja-vcpkg' + # buildPresetAdditionalArgs: "[`--config`, `Release`]" + # testPreset: 'ninja-vcpkg' + # testPresetAdditionalArgs: "[`--config`, `Release`]" + - name: Run CMake+vcpkg+Ninja+CTest to build packages and generate/build/test the code. + uses: lukka/run-cmake@v10 with: - options: | - CMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake + configurePreset: 'ninja-multi-vcpkg' + buildPreset: 'ninja-vcpkg-release' + testPreset: 'test-release' From 22775c7bb89ad441516515094f62b406009d4ef1 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 23:20:49 +0000 Subject: [PATCH 20/46] Use default configure prefix --- .github/workflows/cmake_ci.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index a6071b2a997..f23827db1fe 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -38,6 +38,7 @@ jobs: with: submodules: true + # Based on sample workflow from https://github.com/lukka/CppCMakeVcpkgTemplate/blob/v11/.github/workflows/hosted-ninja-vcpkg_submod.yml - uses: lukka/get-cmake@latest - name: Restore from cache and setup vcpkg executable and data files. @@ -55,6 +56,7 @@ jobs: - name: Run CMake+vcpkg+Ninja+CTest to build packages and generate/build/test the code. uses: lukka/run-cmake@v10 with: - configurePreset: 'ninja-multi-vcpkg' - buildPreset: 'ninja-vcpkg-release' - testPreset: 'test-release' + configurePreset: 'build' + # configurePreset: 'ninja-multi-vcpkg' + # buildPreset: 'ninja-vcpkg-release' + # testPreset: 'test-release' From 8614de2c11727f29b120d64316a6450f35b37e3f Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 23:25:22 +0000 Subject: [PATCH 21/46] Remove explicity vcpkg.conf glob --- .github/workflows/cmake_ci.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index f23827db1fe..003c4bc7de0 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -44,7 +44,6 @@ jobs: - name: Restore from cache and setup vcpkg executable and data files. uses: lukka/run-vcpkg@v11 with: - vcpkgJsonGlob: 'vcpkg.json' doNotCache: false # Note: if the preset misses the "configuration", it is possible to explicitly select the @@ -56,7 +55,7 @@ jobs: - name: Run CMake+vcpkg+Ninja+CTest to build packages and generate/build/test the code. uses: lukka/run-cmake@v10 with: - configurePreset: 'build' + configurePreset: 'default' # configurePreset: 'ninja-multi-vcpkg' # buildPreset: 'ninja-vcpkg-release' # testPreset: 'test-release' From edf588a4898b6c0432eb6dfcd3d933d37e73de1e Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 23:31:59 +0000 Subject: [PATCH 22/46] Give up, add vcpkg at submodule. --- .github/workflows/cmake_ci.yaml | 1 + .gitmodules | 3 +++ CMakePresets.json | 16 ++++++++++++++++ vcpkg | 1 + 4 files changed, 21 insertions(+) create mode 100644 .gitmodules create mode 100644 CMakePresets.json create mode 160000 vcpkg diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index 003c4bc7de0..1a26973c43e 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -45,6 +45,7 @@ jobs: uses: lukka/run-vcpkg@v11 with: doNotCache: false + vcpkgGitCommitId: e3db8f65d2414c301c29a8467c6aee94e3ba09fc # Note: if the preset misses the "configuration", it is possible to explicitly select the # configuration with the additional `--config` flag, e.g.: diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000000..a0a57f3d70f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vcpkg"] + path = vcpkg + url = https://github.com/microsoft/vcpkg.git diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 00000000000..2668c687143 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,16 @@ +{ + "version": 2, + "configurePresets": [ + { + "name": "default", + "generator": "Unix Makefiles", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + }, + "environment": { + "VCPKG_ROOT": "vcpkg/" + } + } + ] +} diff --git a/vcpkg b/vcpkg new file mode 160000 index 00000000000..2cf2bcc60ad --- /dev/null +++ b/vcpkg @@ -0,0 +1 @@ +Subproject commit 2cf2bcc60add50f79b2c418487d9cd1b6c7c1fec From 1366d2836811d28e03b2b35c6afbc83dac68178f Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Tue, 6 Jan 2026 23:33:28 +0000 Subject: [PATCH 23/46] Give up, use Ninja --- .github/workflows/cmake_ci.yaml | 7 +- CMakePresets.json | 116 +++++++++++++++++++++++++++++--- 2 files changed, 109 insertions(+), 14 deletions(-) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index 1a26973c43e..15fe06eac39 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -56,7 +56,6 @@ jobs: - name: Run CMake+vcpkg+Ninja+CTest to build packages and generate/build/test the code. uses: lukka/run-cmake@v10 with: - configurePreset: 'default' - # configurePreset: 'ninja-multi-vcpkg' - # buildPreset: 'ninja-vcpkg-release' - # testPreset: 'test-release' + configurePreset: 'ninja-multi-vcpkg' + buildPreset: 'ninja-vcpkg-release' + testPreset: 'test-release' diff --git a/CMakePresets.json b/CMakePresets.json index 2668c687143..4941cb56b56 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,16 +1,112 @@ { - "version": 2, + "version": 8, + "cmakeMinimumRequired": { + "major": 3, + "minor": 21, + "patch": 0 + }, "configurePresets": [ { - "name": "default", - "generator": "Unix Makefiles", - "binaryDir": "${sourceDir}/build", - "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" - }, - "environment": { - "VCPKG_ROOT": "vcpkg/" - } + "name": "ninja-multi-vcpkg", + "displayName": "Ninja Multi-Config", + "description": "Configure with vcpkg toolchain and generate Ninja project files for all configurations", + "binaryDir": "${sourceDir}/builds/${presetName}", + "generator": "Ninja Multi-Config", + "toolchainFile": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake" + } + ], + "buildPresets": [ + { + "name": "ninja-vcpkg-debug", + "configurePreset": "ninja-multi-vcpkg", + "displayName": "Build (Debug)", + "description": "Build with Ninja/vcpkg (Debug)", + "configuration": "Debug" + }, + { + "name": "ninja-vcpkg-release", + "configurePreset": "ninja-multi-vcpkg", + "displayName": "Build (Release)", + "description": "Build with Ninja/vcpkg (Release)", + "configuration": "Release" + }, + { + "name": "ninja-vcpkg", + "configurePreset": "ninja-multi-vcpkg", + "displayName": "Build", + "description": "Build with Ninja/vcpkg", + "hidden": true + }, + { + "name": "ninja-vcpkg-check-format", + "configurePreset": "ninja-multi-vcpkg", + "displayName": "Build", + "targets": [ + "check-format" + ], + "description": "Build with Ninja/vcpkg check-format" + }, + { + "name": "ninja-vcpkg-format", + "configurePreset": "ninja-multi-vcpkg", + "displayName": "Build", + "targets": [ + "format" + ], + "description": "Build with Ninja/vcpkg format" + } + ], + "workflowPresets": [ + { + "name": "format", + "steps": [ + { + "name": "ninja-multi-vcpkg", + "type": "configure" + }, + { + "name": "ninja-vcpkg-format", + "type": "build" + } + ] + }, + { + "name": "check-format", + "steps": [ + { + "name": "ninja-multi-vcpkg", + "type": "configure" + }, + { + "name": "ninja-vcpkg-check-format", + "type": "build" + } + ] + } + ], + "testPresets": [ + { + "name": "test-ninja-vcpkg", + "configurePreset": "ninja-multi-vcpkg", + "hidden": true + }, + { + "name": "test-debug", + "description": "Test (Debug)", + "displayName": "Test (Debug)", + "configuration": "Debug", + "inherits": [ + "test-ninja-vcpkg" + ] + }, + { + "name": "test-release", + "description": "Test (Release)", + "displayName": "Test (Release)", + "configuration": "Release", + "inherits": [ + "test-ninja-vcpkg" + ] } ] } From f2c73d0f1e229146b8665e83214606100c295300 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 00:22:02 +0000 Subject: [PATCH 24/46] Relax versioning for Eigen --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 25c5b40937f..e04bd7c8b22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ find_package(OpenCV 4.4) MESSAGE("OPENCV VERSION:") MESSAGE(${OpenCV_VERSION}) -find_package(Eigen3 3.1.0 REQUIRED) +find_package(Eigen3 REQUIRED) find_package(Pangolin CONFIG REQUIRED) find_package(Sophus REQUIRED) find_package(g2o REQUIRED) From 8f133753f7fbe4c33f483ae1f3dce219b30eee17 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 01:06:06 +0000 Subject: [PATCH 25/46] Fix compilation of DBoW2 --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e04bd7c8b22..70bf43f4429 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,8 @@ find_package(fmt REQUIRED) find_package(spdlog REQUIRED) find_package(Boost REQUIRED COMPONENTS serialization) +add_subdirectory(Thirdparty/DBoW2) + include_directories( ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include @@ -80,7 +82,7 @@ target_link_libraries(${PROJECT_NAME} Eigen3::Eigen Sophus::Sophus ${Pangolin_LIBRARIES} - ${PROJECT_SOURCE_DIR}/Thirdparty/DBoW2/lib/libDBoW2.so + DBoW2 fmt::fmt g2o::core g2o::types_sim3 From 699692304e52eceb8a616fa18a73cea15d40598c Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 01:15:01 +0000 Subject: [PATCH 26/46] Update build.sh --- .gitignore | 1 + CMakePresets.json | 53 ----------------------------------------------- build.sh | 37 +++++---------------------------- build_ros.sh | 7 ------- 4 files changed, 6 insertions(+), 92 deletions(-) delete mode 100755 build_ros.sh diff --git a/.gitignore b/.gitignore index 7227515c0a3..907b1aa6044 100644 --- a/.gitignore +++ b/.gitignore @@ -66,6 +66,7 @@ Thirdparty/g2o/config.h Thirdparty/g2o/lib/ Vocabulary/ORBvoc.txt build/ +builds/ lib/ diff --git a/CMakePresets.json b/CMakePresets.json index 4941cb56b56..db9b6595a43 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -29,59 +29,6 @@ "displayName": "Build (Release)", "description": "Build with Ninja/vcpkg (Release)", "configuration": "Release" - }, - { - "name": "ninja-vcpkg", - "configurePreset": "ninja-multi-vcpkg", - "displayName": "Build", - "description": "Build with Ninja/vcpkg", - "hidden": true - }, - { - "name": "ninja-vcpkg-check-format", - "configurePreset": "ninja-multi-vcpkg", - "displayName": "Build", - "targets": [ - "check-format" - ], - "description": "Build with Ninja/vcpkg check-format" - }, - { - "name": "ninja-vcpkg-format", - "configurePreset": "ninja-multi-vcpkg", - "displayName": "Build", - "targets": [ - "format" - ], - "description": "Build with Ninja/vcpkg format" - } - ], - "workflowPresets": [ - { - "name": "format", - "steps": [ - { - "name": "ninja-multi-vcpkg", - "type": "configure" - }, - { - "name": "ninja-vcpkg-format", - "type": "build" - } - ] - }, - { - "name": "check-format", - "steps": [ - { - "name": "ninja-multi-vcpkg", - "type": "configure" - }, - { - "name": "ninja-vcpkg-check-format", - "type": "build" - } - ] } ], "testPresets": [ diff --git a/build.sh b/build.sh index 87f9c4bf653..6b73a4e51e4 100755 --- a/build.sh +++ b/build.sh @@ -1,40 +1,13 @@ -echo "Configuring and building Thirdparty/DBoW2 ..." +BUILD_TYPE=${BUILD_TYPE:-release} -cd Thirdparty/DBoW2 -mkdir build -cd build -cmake .. -DCMAKE_BUILD_TYPE=Release -make -j2 - -cd ../../g2o - -echo "Configuring and building Thirdparty/g2o ..." - -mkdir build -cd build -cmake .. -DCMAKE_BUILD_TYPE=Release -make -j2 - -cd ../../Sophus - -echo "Configuring and building Thirdparty/Sophus ..." +git submodule sync vcpkg +cd vcpkg && ./bootstrap-vcpkg.sh +cd .. -mkdir build -cd build -cmake .. -DCMAKE_BUILD_TYPE=Release -make -j2 +cmake --build --preset ninja-vcpkg-${BUILD_TYPE} -cd ../../../ echo "Uncompress vocabulary ..." - cd Vocabulary tar -xf ORBvoc.txt.tar.gz cd .. - -echo "Configuring and building ORB_SLAM3 ..." - -mkdir build -cd build -cmake .. -DCMAKE_BUILD_TYPE=Release -make -j2 diff --git a/build_ros.sh b/build_ros.sh deleted file mode 100755 index 1f13d2155fc..00000000000 --- a/build_ros.sh +++ /dev/null @@ -1,7 +0,0 @@ -echo "Building ROS nodes" - -cd Examples/ROS/ORB_SLAM3 -mkdir build -cd build -cmake .. -DROS_BUILD_TYPE=Release -make -j From 134a6a52908e97e3ff4fb70cfd126de36735e159 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 05:09:24 +0000 Subject: [PATCH 27/46] Try using system packages for lapack and openblas --- .github/workflows/cmake_ci.yaml | 5 ++++- vcpkg.json | 5 ++++- vcpkg_overlays/blas/portfile.cmake | 1 + vcpkg_overlays/blas/vcpkg.json | 4 ++++ vcpkg_overlays/lapack/portfile.cmake | 1 + vcpkg_overlays/lapack/vcpkg.json | 4 ++++ 6 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 vcpkg_overlays/blas/portfile.cmake create mode 100644 vcpkg_overlays/blas/vcpkg.json create mode 100644 vcpkg_overlays/lapack/portfile.cmake create mode 100644 vcpkg_overlays/lapack/vcpkg.json diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index 15fe06eac39..e5ade8b83ea 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -18,6 +18,7 @@ jobs: packages: \ cmake \ g++ \ + libblas-dev \ libboost-serialization-dev \ libc++-dev \ libegl1-mesa-dev \ @@ -25,7 +26,9 @@ jobs: libgl1-mesa-dev \ libgles2-mesa-dev \ libglew-dev \ - libopencv-dev nasm \ + liblapack-dev \ + libopencv-dev \ + nasm \ libwayland-dev \ libx11-dev \ libxkbcommon-dev \ diff --git a/vcpkg.json b/vcpkg.json index 9deb464d476..7b2209453e0 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -7,7 +7,10 @@ "kind": "git", "baseline": "e3db8f65d2414c301c29a8467c6aee94e3ba09fc", "repository": "https://github.com/Microsoft/vcpkg" - } + }, + "overlay-ports": [ + "vcpkg_overlays" + ] }, "dependencies": [ "pangolin", diff --git a/vcpkg_overlays/blas/portfile.cmake b/vcpkg_overlays/blas/portfile.cmake new file mode 100644 index 00000000000..065116c276a --- /dev/null +++ b/vcpkg_overlays/blas/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg_overlays/blas/vcpkg.json b/vcpkg_overlays/blas/vcpkg.json new file mode 100644 index 00000000000..39a06e27a48 --- /dev/null +++ b/vcpkg_overlays/blas/vcpkg.json @@ -0,0 +1,4 @@ +{ + "name": "blas", + "version": "3.12.0" +} diff --git a/vcpkg_overlays/lapack/portfile.cmake b/vcpkg_overlays/lapack/portfile.cmake new file mode 100644 index 00000000000..065116c276a --- /dev/null +++ b/vcpkg_overlays/lapack/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg_overlays/lapack/vcpkg.json b/vcpkg_overlays/lapack/vcpkg.json new file mode 100644 index 00000000000..2e4a0957e96 --- /dev/null +++ b/vcpkg_overlays/lapack/vcpkg.json @@ -0,0 +1,4 @@ +{ + "name": "lapack", + "version": "3.12.0" +} From 49f271405265aa3d1794bdcd9b690ac199ef80f3 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 05:47:04 +0000 Subject: [PATCH 28/46] Load dependencies from script --- .github/workflows/cmake_ci.yaml | 30 +++++++++++------------------- install_apt_dependencies.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 19 deletions(-) create mode 100755 install_apt_dependencies.sh diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index e5ade8b83ea..303c578075c 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -12,28 +12,20 @@ jobs: name: Build Project runs-on: ubuntu-24.04 steps: + # Load the set of APT dependencies from the install_apt_dependencies scripts + # to reduce repetition + - id: generate_deps + run: | + # Run your script and capture its output into a shell variable + SCRIPT_OUTPUT=$(./install_apt_dependencies.sh --deps) + + # Write the variable to the GITHUB_OUTPUT file + echo "apt_deps=$SCRIPT_OUTPUT" >> "$GITHUB_OUTPUT" + - name: Install apt dependencies uses: awalsh128/cache-apt-pkgs-action@latest with: - packages: \ - cmake \ - g++ \ - libblas-dev \ - libboost-serialization-dev \ - libc++-dev \ - libegl1-mesa-dev \ - libepoxy-dev \ - libgl1-mesa-dev \ - libgles2-mesa-dev \ - libglew-dev \ - liblapack-dev \ - libopencv-dev \ - nasm \ - libwayland-dev \ - libx11-dev \ - libxkbcommon-dev \ - ninja-build \ - wayland-protocols + packages: ${{ steps.generate_deps.outputs.apt_deps }} version: 1.0 - name: Checkout Project diff --git a/install_apt_dependencies.sh b/install_apt_dependencies.sh new file mode 100755 index 00000000000..c6495b779e7 --- /dev/null +++ b/install_apt_dependencies.sh @@ -0,0 +1,31 @@ +#!/usr/bin/bash + +APT_DEPENDENCIES="cmake \ + g++ \ + libblas-dev \ + libboost-serialization-dev \ + libc++-dev \ + libegl1-mesa-dev \ + libepoxy-dev \ + libgl1-mesa-dev \ + libgles2-mesa-dev \ + libglew-dev \ + liblapack-dev \ + libopencv-dev \ + nasm \ + libwayland-dev \ + libx11-dev \ + libxkbcommon-dev \ + ninja-build \ + wayland-protocols" + + +myarg=$1 +if [[ "$myarg" = "--deps" ]]; then + echo $APT_DEPENDENCIES + exit 0 +fi + + +sudo apt-get update && \ +sudo apt-get install --no-install-recommends -y $APT_DEPENDENCIES From ed6e817ea808a23c4e60639adc5a246687894fc8 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 05:51:32 +0000 Subject: [PATCH 29/46] Move all apt dependencies to a single script --- README.md | 36 ++++++++++++++++++++++------ install_apt_dependencies.sh | 2 ++ vcpkg.json | 8 +------ vcpkg_overlays/eigen3/portfile.cmake | 1 + vcpkg_overlays/eigen3/vcpkg.json | 4 ++++ vcpkg_overlays/g2o/portfile.cmake | 1 + vcpkg_overlays/g2o/vcpkg.json | 4 ++++ 7 files changed, 42 insertions(+), 14 deletions(-) create mode 100644 vcpkg_overlays/eigen3/portfile.cmake create mode 100644 vcpkg_overlays/eigen3/vcpkg.json create mode 100644 vcpkg_overlays/g2o/portfile.cmake create mode 100644 vcpkg_overlays/g2o/vcpkg.json diff --git a/README.md b/README.md index 6534edb898d..08b39071cec 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,37 @@ > [!NOTE] > This is my personal "working" fork of ORBSLAM3, which focuses on integrating ORBSLAM3 into ROS2. The actual ROS2 integration is implemented in [orbslam3_ros2](https://gitlab.com/apl-ocean-engineering/orbslam3_ros2). -Relative to the original code, this repo contains multiple updates: +As I dug further into the code, I got more opinionated and have made multiple styilistic updates. My intention is to make only positive readability, portability and performance improvements but YMMV. -* I removed the "ThirdParty" copies of "Sophus" and "g2o" in lieu of packages which can be installed "rosdep" (or `apt`). Due to API changes, this necessitated some syntactically invasive (but functionally equivalent) changes. -* This branch contains preliminary migration to [spdlog](https://github.com/gabime/spdlog) as a more controllable logging backend. This is a slow-motion migration to better manage text output from ORBSLAM3. -* As I dug further into the code, I got more opinionated. I also added [pre-commit](.pre-commit-config.yaml), which introduced significant textual changes. No going back! -* [`Thirdparty/tl/`](Thirdparty/tl/) includes a copy of [TartanLlama's expected](https://github.com/TartanLlama/expected) which is released under the [CC0-1.0 (Public doamin) license](http://creativecommons.org/publicdomain/zero/1.0/) +* Started modernization, currently to C++17 +* Replace bare pointers with managed pointers in most cases. +* Minor updates to the System and Setting initialization procedure, primarily to separate creation of a Setting structure (from a file or otherwise) from initialization of System, and provide more paths to catching and reporting errors during initialization. See the [Examples/](Examples/). +* No other substantial API changes (yet) +* Added [pre-commit](.pre-commit-config.yaml), which introduced significant textual changes. +* Cleanup on dependencies: + * Removed built-in `g2o` and `Sophus` builds. + * Add [TartanLlama's expected](https://github.com/TartanLlama/expected) which is released under the [CC0-1.0 (Public doamin) license](http://creativecommons.org/publicdomain/zero/1.0/) (this may be remove if/when I standardize on C++20) +* I am only targetting Ubuntu right now. I've updated the build process as follows: + * When building for ROS2, use [orbslam3_ros2](https://gitlab.com/apl-ocean-engineering/orbslam3_ros2) which includes this repo as a submodule. Dependencies (g2o, Sophus, Pangolin) are included from ROS apt via `rosdep`. + * For non-ROS builds, I am now using `vcpkg` as a dependency manager as it can build the non-apt-gettable dependencies (Pangolin). **However** I am using overlays to preferentially use apt versions of packages when available (OpenCV, g2o, etc). +* Other minor changes: + * Removed integrated Realsense support. Realsense-enabled binaries should go in a separate package. + + + +## Building + +I am only testing on Ubuntu 24.04. As noted above, I prefer to use system packages as much as possible and use `vcpkg` for dependencies with no published binaries (outside of ROS). + +I've gone full koolaid and adopted `ninja` as a builder as well. + +To build under Ubuntu, use the convenience scripts: + +``` +./install_apt_dependencies.sh +./build.sh +``` -> [!WARNING] -> I _am not_ testing this repo outside of ROS2. I am *only* checking [orbslam3_ros2](https://gitlab.com/apl-ocean-engineering/orbslam3_ros2) in a ROS2 / colcon environment. I do not expect this to build with `cmake` nor do I expect the original `Examples/` to run. ----- ----- diff --git a/install_apt_dependencies.sh b/install_apt_dependencies.sh index c6495b779e7..19de08081c8 100755 --- a/install_apt_dependencies.sh +++ b/install_apt_dependencies.sh @@ -6,7 +6,9 @@ APT_DEPENDENCIES="cmake \ libboost-serialization-dev \ libc++-dev \ libegl1-mesa-dev \ + libeigen3-dev \ libepoxy-dev \ + libg2o-dev \ libgl1-mesa-dev \ libgles2-mesa-dev \ libglew-dev \ diff --git a/vcpkg.json b/vcpkg.json index 7b2209453e0..6060a9308c4 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -14,12 +14,6 @@ }, "dependencies": [ "pangolin", - "sophus", - { - "name": "g2o", - "features": [ - "spdlog" - ] - } + "sophus" ] } diff --git a/vcpkg_overlays/eigen3/portfile.cmake b/vcpkg_overlays/eigen3/portfile.cmake new file mode 100644 index 00000000000..065116c276a --- /dev/null +++ b/vcpkg_overlays/eigen3/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg_overlays/eigen3/vcpkg.json b/vcpkg_overlays/eigen3/vcpkg.json new file mode 100644 index 00000000000..4f917bc6ff0 --- /dev/null +++ b/vcpkg_overlays/eigen3/vcpkg.json @@ -0,0 +1,4 @@ +{ + "name": "eigen3", + "version": "3.4.0" +} diff --git a/vcpkg_overlays/g2o/portfile.cmake b/vcpkg_overlays/g2o/portfile.cmake new file mode 100644 index 00000000000..065116c276a --- /dev/null +++ b/vcpkg_overlays/g2o/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg_overlays/g2o/vcpkg.json b/vcpkg_overlays/g2o/vcpkg.json new file mode 100644 index 00000000000..ea6ca92a70e --- /dev/null +++ b/vcpkg_overlays/g2o/vcpkg.json @@ -0,0 +1,4 @@ +{ + "name": "g2o", + "version": "4.1.0" +} From 503f634cad0ac8e2228695d1d73ff36adb26cfe1 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 05:55:49 +0000 Subject: [PATCH 30/46] Need to checkout earlier --- .github/workflows/cmake_ci.yaml | 10 +++++----- CMakeLists.txt | 2 +- vcpkg.json | 4 +++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index 303c578075c..5bd1aab133f 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -12,6 +12,11 @@ jobs: name: Build Project runs-on: ubuntu-24.04 steps: + - name: Checkout Project + uses: actions/checkout@v4.2.2 + with: + submodules: true + # Load the set of APT dependencies from the install_apt_dependencies scripts # to reduce repetition - id: generate_deps @@ -28,11 +33,6 @@ jobs: packages: ${{ steps.generate_deps.outputs.apt_deps }} version: 1.0 - - name: Checkout Project - uses: actions/checkout@v4.2.2 - with: - submodules: true - # Based on sample workflow from https://github.com/lukka/CppCMakeVcpkgTemplate/blob/v11/.github/workflows/hosted-ninja-vcpkg_submod.yml - uses: lukka/get-cmake@latest diff --git a/CMakeLists.txt b/CMakeLists.txt index 70bf43f4429..73fe275306f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ MESSAGE(${OpenCV_VERSION}) find_package(Eigen3 REQUIRED) find_package(Pangolin CONFIG REQUIRED) -find_package(Sophus REQUIRED) +find_package(Sophus CONFIG REQUIRED) find_package(g2o REQUIRED) find_package(fmt REQUIRED) find_package(spdlog REQUIRED) diff --git a/vcpkg.json b/vcpkg.json index 6060a9308c4..895df083500 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -14,6 +14,8 @@ }, "dependencies": [ "pangolin", - "sophus" + "sophus", + "g2o", + "eigen3" ] } From 8412cf5af38722ce0658bd62c1457a7d857c3505 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 06:01:46 +0000 Subject: [PATCH 31/46] Use system ffmpeg as well. --- .github/workflows/cmake_ci.yaml | 3 ++- install_apt_dependencies.sh | 7 +++++++ vcpkg_overlays/ffmpeg/portfile.cmake | 1 + vcpkg_overlays/ffmpeg/vcpkg.json | 4 ++++ 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 vcpkg_overlays/ffmpeg/portfile.cmake create mode 100644 vcpkg_overlays/ffmpeg/vcpkg.json diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index 5bd1aab133f..878f3188bc0 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -19,7 +19,8 @@ jobs: # Load the set of APT dependencies from the install_apt_dependencies scripts # to reduce repetition - - id: generate_deps + - name: Generate dependency list + id: generate_deps run: | # Run your script and capture its output into a shell variable SCRIPT_OUTPUT=$(./install_apt_dependencies.sh --deps) diff --git a/install_apt_dependencies.sh b/install_apt_dependencies.sh index 19de08081c8..53595ea1d2c 100755 --- a/install_apt_dependencies.sh +++ b/install_apt_dependencies.sh @@ -2,6 +2,13 @@ APT_DEPENDENCIES="cmake \ g++ \ + libavcodec-dev \ + libavdevice-dev \ + libavfilter-dev \ + libavformat-dev \ + libavutil-dev \ + libswresample-dev \ + libswscale-dev \ libblas-dev \ libboost-serialization-dev \ libc++-dev \ diff --git a/vcpkg_overlays/ffmpeg/portfile.cmake b/vcpkg_overlays/ffmpeg/portfile.cmake new file mode 100644 index 00000000000..065116c276a --- /dev/null +++ b/vcpkg_overlays/ffmpeg/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg_overlays/ffmpeg/vcpkg.json b/vcpkg_overlays/ffmpeg/vcpkg.json new file mode 100644 index 00000000000..10cbb7ec305 --- /dev/null +++ b/vcpkg_overlays/ffmpeg/vcpkg.json @@ -0,0 +1,4 @@ +{ + "name": "ffmpeg", + "version": "6.1.1" +} From 2376280bc2a0370c62e97bd3f286c9806f1322b2 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 06:09:39 +0000 Subject: [PATCH 32/46] Remove g2o overlay --- README.md | 5 +++-- build.sh | 7 +------ vcpkg_overlays/g2o/portfile.cmake | 1 - vcpkg_overlays/g2o/vcpkg.json | 4 ---- 4 files changed, 4 insertions(+), 13 deletions(-) delete mode 100644 vcpkg_overlays/g2o/portfile.cmake delete mode 100644 vcpkg_overlays/g2o/vcpkg.json diff --git a/README.md b/README.md index 08b39071cec..b8cc3544246 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ As I dug further into the code, I got more opinionated and have made multiple st * Add [TartanLlama's expected](https://github.com/TartanLlama/expected) which is released under the [CC0-1.0 (Public doamin) license](http://creativecommons.org/publicdomain/zero/1.0/) (this may be remove if/when I standardize on C++20) * I am only targetting Ubuntu right now. I've updated the build process as follows: * When building for ROS2, use [orbslam3_ros2](https://gitlab.com/apl-ocean-engineering/orbslam3_ros2) which includes this repo as a submodule. Dependencies (g2o, Sophus, Pangolin) are included from ROS apt via `rosdep`. - * For non-ROS builds, I am now using `vcpkg` as a dependency manager as it can build the non-apt-gettable dependencies (Pangolin). **However** I am using overlays to preferentially use apt versions of packages when available (OpenCV, g2o, etc). + * For non-ROS builds, I am now using `vcpkg` as a dependency manager as it can build the non-apt-gettable dependencies (Pangolin). **However** I am using overlays to preferentially use apt versions of packages when available (OpenCV, etc). + * Note we build `g2o` from source even though an APT package is available to get a newer version. * Other minor changes: * Removed integrated Realsense support. Realsense-enabled binaries should go in a separate package. @@ -21,7 +22,7 @@ As I dug further into the code, I got more opinionated and have made multiple st ## Building -I am only testing on Ubuntu 24.04. As noted above, I prefer to use system packages as much as possible and use `vcpkg` for dependencies with no published binaries (outside of ROS). +I am only testing on Ubuntu 24.04. As noted above, I prefer to use system packages as much as possible and use `vcpkg` for dependencies with no published binaries (outside of ROS). To override this behavior and have vcpkg build additional packages from source, remove the relevant directories from the [`vcpkg_overlays/`](vcpkg_overlays/) directory. I've gone full koolaid and adopted `ninja` as a builder as well. diff --git a/build.sh b/build.sh index 6b73a4e51e4..5e9a1ba35f8 100755 --- a/build.sh +++ b/build.sh @@ -1,3 +1,4 @@ +# Options are "release" and "debug" (see CMakePresets.json) BUILD_TYPE=${BUILD_TYPE:-release} git submodule sync vcpkg @@ -5,9 +6,3 @@ cd vcpkg && ./bootstrap-vcpkg.sh cd .. cmake --build --preset ninja-vcpkg-${BUILD_TYPE} - - -echo "Uncompress vocabulary ..." -cd Vocabulary -tar -xf ORBvoc.txt.tar.gz -cd .. diff --git a/vcpkg_overlays/g2o/portfile.cmake b/vcpkg_overlays/g2o/portfile.cmake deleted file mode 100644 index 065116c276a..00000000000 --- a/vcpkg_overlays/g2o/portfile.cmake +++ /dev/null @@ -1 +0,0 @@ -set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg_overlays/g2o/vcpkg.json b/vcpkg_overlays/g2o/vcpkg.json deleted file mode 100644 index ea6ca92a70e..00000000000 --- a/vcpkg_overlays/g2o/vcpkg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "g2o", - "version": "4.1.0" -} From 7c014b55364b3570fad19b8029c28f624cf6cd69 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 06:19:26 +0000 Subject: [PATCH 33/46] Update ffmpeg overlay to include features --- build.sh | 1 + vcpkg_overlays/ffmpeg/vcpkg.json | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 5e9a1ba35f8..aa18f2fe39b 100755 --- a/build.sh +++ b/build.sh @@ -5,4 +5,5 @@ git submodule sync vcpkg cd vcpkg && ./bootstrap-vcpkg.sh cd .. +cmake --preset ninja-multi-vcpkg cmake --build --preset ninja-vcpkg-${BUILD_TYPE} diff --git a/vcpkg_overlays/ffmpeg/vcpkg.json b/vcpkg_overlays/ffmpeg/vcpkg.json index 10cbb7ec305..91b34b7c2c5 100644 --- a/vcpkg_overlays/ffmpeg/vcpkg.json +++ b/vcpkg_overlays/ffmpeg/vcpkg.json @@ -1,4 +1,24 @@ { "name": "ffmpeg", - "version": "6.1.1" + "version": "6.1.1", + "features": { + "avcodec": { + "description": "" + }, + "avdevice": { + "description": "" + }, + "avfilter": { + "description": "" + }, + "avformat": { + "description": "" + }, + "swresample": { + "description": "" + }, + "swscale": { + "description": "" + } + } } From 1daede23e12917291b69f92b59827ac1c001b12a Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 15:32:55 +0000 Subject: [PATCH 34/46] Give up, don't try to use lapack and blas from system packages. --- vcpkg_overlays/blas/portfile.cmake | 1 - vcpkg_overlays/blas/vcpkg.json | 4 ---- vcpkg_overlays/eigen3/portfile.cmake | 1 - vcpkg_overlays/eigen3/vcpkg.json | 4 ---- vcpkg_overlays/lapack/portfile.cmake | 1 - vcpkg_overlays/lapack/vcpkg.json | 4 ---- 6 files changed, 15 deletions(-) delete mode 100644 vcpkg_overlays/blas/portfile.cmake delete mode 100644 vcpkg_overlays/blas/vcpkg.json delete mode 100644 vcpkg_overlays/eigen3/portfile.cmake delete mode 100644 vcpkg_overlays/eigen3/vcpkg.json delete mode 100644 vcpkg_overlays/lapack/portfile.cmake delete mode 100644 vcpkg_overlays/lapack/vcpkg.json diff --git a/vcpkg_overlays/blas/portfile.cmake b/vcpkg_overlays/blas/portfile.cmake deleted file mode 100644 index 065116c276a..00000000000 --- a/vcpkg_overlays/blas/portfile.cmake +++ /dev/null @@ -1 +0,0 @@ -set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg_overlays/blas/vcpkg.json b/vcpkg_overlays/blas/vcpkg.json deleted file mode 100644 index 39a06e27a48..00000000000 --- a/vcpkg_overlays/blas/vcpkg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "blas", - "version": "3.12.0" -} diff --git a/vcpkg_overlays/eigen3/portfile.cmake b/vcpkg_overlays/eigen3/portfile.cmake deleted file mode 100644 index 065116c276a..00000000000 --- a/vcpkg_overlays/eigen3/portfile.cmake +++ /dev/null @@ -1 +0,0 @@ -set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg_overlays/eigen3/vcpkg.json b/vcpkg_overlays/eigen3/vcpkg.json deleted file mode 100644 index 4f917bc6ff0..00000000000 --- a/vcpkg_overlays/eigen3/vcpkg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "eigen3", - "version": "3.4.0" -} diff --git a/vcpkg_overlays/lapack/portfile.cmake b/vcpkg_overlays/lapack/portfile.cmake deleted file mode 100644 index 065116c276a..00000000000 --- a/vcpkg_overlays/lapack/portfile.cmake +++ /dev/null @@ -1 +0,0 @@ -set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg_overlays/lapack/vcpkg.json b/vcpkg_overlays/lapack/vcpkg.json deleted file mode 100644 index 2e4a0957e96..00000000000 --- a/vcpkg_overlays/lapack/vcpkg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "lapack", - "version": "3.12.0" -} From 8e32b39947dfeedf4a5f16987591465035b3570f Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 16:10:11 +0000 Subject: [PATCH 35/46] Added libfmt as dependency, removed libg2o --- install_apt_dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_apt_dependencies.sh b/install_apt_dependencies.sh index 53595ea1d2c..ce26413527d 100755 --- a/install_apt_dependencies.sh +++ b/install_apt_dependencies.sh @@ -15,7 +15,7 @@ APT_DEPENDENCIES="cmake \ libegl1-mesa-dev \ libeigen3-dev \ libepoxy-dev \ - libg2o-dev \ + libfmt-dev \ libgl1-mesa-dev \ libgles2-mesa-dev \ libglew-dev \ From 2731a71f8e39788772473bf4dd03f3b944937efd Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 17:36:16 +0000 Subject: [PATCH 36/46] Add spdlog as apt dependency --- install_apt_dependencies.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/install_apt_dependencies.sh b/install_apt_dependencies.sh index ce26413527d..c5d94ddc453 100755 --- a/install_apt_dependencies.sh +++ b/install_apt_dependencies.sh @@ -7,8 +7,6 @@ APT_DEPENDENCIES="cmake \ libavfilter-dev \ libavformat-dev \ libavutil-dev \ - libswresample-dev \ - libswscale-dev \ libblas-dev \ libboost-serialization-dev \ libc++-dev \ @@ -21,10 +19,13 @@ APT_DEPENDENCIES="cmake \ libglew-dev \ liblapack-dev \ libopencv-dev \ - nasm \ + libspdlog-dev \ + libswresample-dev \ + libswscale-dev \ libwayland-dev \ libx11-dev \ libxkbcommon-dev \ + nasm \ ninja-build \ wayland-protocols" From f5820aaf82880e32c6f0cec6bb3bf029b753ead6 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 17:46:27 +0000 Subject: [PATCH 37/46] Attempt to re-enable caching. --- .github/workflows/cmake_ci.yaml | 11 +++++++++++ vcpkg.json | 2 +- .../ffmpeg/portfile.cmake | 0 {vcpkg_overlays => vcpkg_overlay}/ffmpeg/vcpkg.json | 0 4 files changed, 12 insertions(+), 1 deletion(-) rename {vcpkg_overlays => vcpkg_overlay}/ffmpeg/portfile.cmake (100%) rename {vcpkg_overlays => vcpkg_overlay}/ffmpeg/vcpkg.json (100%) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index 878f3188bc0..a0c70a69e20 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -37,6 +37,14 @@ jobs: # Based on sample workflow from https://github.com/lukka/CppCMakeVcpkgTemplate/blob/v11/.github/workflows/hosted-ninja-vcpkg_submod.yml - uses: lukka/get-cmake@latest + # + - name: Cache vcpkg + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/vcpkg_cache + key: vcpkg-${{ matrix.triplet }}-${{ hashFiles('vcpkg.json', 'vcpkg_overlay/**', 'CMakeLists.txt', '**/CMakeLists.txt', 'CMakePresets.json') }} + + - name: Restore from cache and setup vcpkg executable and data files. uses: lukka/run-vcpkg@v11 with: @@ -51,6 +59,9 @@ jobs: # testPresetAdditionalArgs: "[`--config`, `Release`]" - name: Run CMake+vcpkg+Ninja+CTest to build packages and generate/build/test the code. uses: lukka/run-cmake@v10 + env: + VCPKG_BINARY_SOURCES: clear;files,${{ github.workspace }}/vcpkg_cache,readwrite + VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }} with: configurePreset: 'ninja-multi-vcpkg' buildPreset: 'ninja-vcpkg-release' diff --git a/vcpkg.json b/vcpkg.json index 895df083500..bced0c493ce 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -9,7 +9,7 @@ "repository": "https://github.com/Microsoft/vcpkg" }, "overlay-ports": [ - "vcpkg_overlays" + "vcpkg_overlay" ] }, "dependencies": [ diff --git a/vcpkg_overlays/ffmpeg/portfile.cmake b/vcpkg_overlay/ffmpeg/portfile.cmake similarity index 100% rename from vcpkg_overlays/ffmpeg/portfile.cmake rename to vcpkg_overlay/ffmpeg/portfile.cmake diff --git a/vcpkg_overlays/ffmpeg/vcpkg.json b/vcpkg_overlay/ffmpeg/vcpkg.json similarity index 100% rename from vcpkg_overlays/ffmpeg/vcpkg.json rename to vcpkg_overlay/ffmpeg/vcpkg.json From 185ca6a0b8f06d07adc74f1193d88b34812e15b3 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 18:51:22 +0000 Subject: [PATCH 38/46] Confused by blas / lapack linkage errors --- vcpkg.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vcpkg.json b/vcpkg.json index bced0c493ce..0b0b51d48da 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -16,6 +16,8 @@ "pangolin", "sophus", "g2o", - "eigen3" + "eigen3", + "blas", + "lapack" ] } From 8e59c224e53811e9f8ecc472534581e6020a6b82 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 20:26:44 +0000 Subject: [PATCH 39/46] Debugging workflow issues --- .github/workflows/cmake_ci.yaml | 5 ++++- vcpkg.json | 4 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index a0c70a69e20..9c724632673 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -44,13 +44,16 @@ jobs: path: ${{ github.workspace }}/vcpkg_cache key: vcpkg-${{ matrix.triplet }}-${{ hashFiles('vcpkg.json', 'vcpkg_overlay/**', 'CMakeLists.txt', '**/CMakeLists.txt', 'CMakePresets.json') }} - - name: Restore from cache and setup vcpkg executable and data files. uses: lukka/run-vcpkg@v11 with: doNotCache: false vcpkgGitCommitId: e3db8f65d2414c301c29a8467c6aee94e3ba09fc + - name: Libraries + run: | + ls -al /lib/x86_64-linux-gnu/ + # Note: if the preset misses the "configuration", it is possible to explicitly select the # configuration with the additional `--config` flag, e.g.: # buildPreset: 'ninja-vcpkg' diff --git a/vcpkg.json b/vcpkg.json index 0b0b51d48da..bced0c493ce 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -16,8 +16,6 @@ "pangolin", "sophus", "g2o", - "eigen3", - "blas", - "lapack" + "eigen3" ] } From a30e9ad6e427f6be23f95d7c042c4b9c030c077b Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 20:39:35 +0000 Subject: [PATCH 40/46] Explicitly install libblas3? --- install_apt_dependencies.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install_apt_dependencies.sh b/install_apt_dependencies.sh index c5d94ddc453..a8a50affeea 100755 --- a/install_apt_dependencies.sh +++ b/install_apt_dependencies.sh @@ -7,6 +7,7 @@ APT_DEPENDENCIES="cmake \ libavfilter-dev \ libavformat-dev \ libavutil-dev \ + libblas3 \ libblas-dev \ libboost-serialization-dev \ libc++-dev \ @@ -17,6 +18,7 @@ APT_DEPENDENCIES="cmake \ libgl1-mesa-dev \ libgles2-mesa-dev \ libglew-dev \ + liblapack3 \ liblapack-dev \ libopencv-dev \ libspdlog-dev \ From d1a9808e94e2c29a13846b0ae374377923482997 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 20:42:46 +0000 Subject: [PATCH 41/46] Run install scripts? --- .github/workflows/cmake_ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index 9c724632673..5dbe99067cc 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -33,6 +33,7 @@ jobs: with: packages: ${{ steps.generate_deps.outputs.apt_deps }} version: 1.0 + execute_install_scripts: true # Based on sample workflow from https://github.com/lukka/CppCMakeVcpkgTemplate/blob/v11/.github/workflows/hosted-ninja-vcpkg_submod.yml - uses: lukka/get-cmake@latest From b38fab81af73acc53f96193c444d8b4d903217d2 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 21:09:24 +0000 Subject: [PATCH 42/46] Don't explicitly install liblapack and liblas3 --- .github/workflows/cmake_ci.yaml | 2 ++ install_apt_dependencies.sh | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index 5dbe99067cc..a38de7ae048 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -28,6 +28,8 @@ jobs: # Write the variable to the GITHUB_OUTPUT file echo "apt_deps=$SCRIPT_OUTPUT" >> "$GITHUB_OUTPUT" + # Execute_install_scripts runs the preinst,postinst scripts after restoring from cache + # I think this necessary to ensure alternatives are set up (for libblas, etc) - name: Install apt dependencies uses: awalsh128/cache-apt-pkgs-action@latest with: diff --git a/install_apt_dependencies.sh b/install_apt_dependencies.sh index a8a50affeea..c5d94ddc453 100755 --- a/install_apt_dependencies.sh +++ b/install_apt_dependencies.sh @@ -7,7 +7,6 @@ APT_DEPENDENCIES="cmake \ libavfilter-dev \ libavformat-dev \ libavutil-dev \ - libblas3 \ libblas-dev \ libboost-serialization-dev \ libc++-dev \ @@ -18,7 +17,6 @@ APT_DEPENDENCIES="cmake \ libgl1-mesa-dev \ libgles2-mesa-dev \ libglew-dev \ - liblapack3 \ liblapack-dev \ libopencv-dev \ libspdlog-dev \ From 622994f1cdc0a3ce6a3f4bce8d0ec9660197a43e Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 21:09:38 +0000 Subject: [PATCH 43/46] Updates to README --- README.md | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index b8cc3544246..934f6932f88 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,39 @@ > [!NOTE] -> This is my personal "working" fork of ORBSLAM3, which focuses on integrating ORBSLAM3 into ROS2. The actual ROS2 integration is implemented in [orbslam3_ros2](https://gitlab.com/apl-ocean-engineering/orbslam3_ros2). +> This is my personal "working" fork of ORBSLAM3, which is part of a larger effort to integrate ORBSLAM3 into ROS2. This repo remains (distantly) related to the author's original upstream repo, and contains no ROS2-specific code. The actual ROS2 integration is implemented in [orbslam3_ros2](https://gitlab.com/apl-ocean-engineering/orbslam3_ros2) which includes this repo as a submodule. -As I dug further into the code, I got more opinionated and have made multiple styilistic updates. My intention is to make only positive readability, portability and performance improvements but YMMV. +As I dug further into the code, I got more opinionated and have made multiple stylistic changes. My intention is to make only positive readability, portability and performance improvements but YMMV: * Started modernization, currently to C++17 * Replace bare pointers with managed pointers in most cases. -* Minor updates to the System and Setting initialization procedure, primarily to separate creation of a Setting structure (from a file or otherwise) from initialization of System, and provide more paths to catching and reporting errors during initialization. See the [Examples/](Examples/). -* No other substantial API changes (yet) +* Minor updates to the System and Setting initialization procedure, primarily to separate creation of the Settings (from a file or otherwise) from the initialization of System, and provide more paths to catching and reporting errors during initialization. See the [Examples/](Examples/). * Added [pre-commit](.pre-commit-config.yaml), which introduced significant textual changes. * Cleanup on dependencies: - * Removed built-in `g2o` and `Sophus` builds. + * Removed built-in `g2o` and `Sophus` sources, get these from a dependency manager (vcpkg for non-ROS, and rosdep for ROS) * Add [TartanLlama's expected](https://github.com/TartanLlama/expected) which is released under the [CC0-1.0 (Public doamin) license](http://creativecommons.org/publicdomain/zero/1.0/) (this may be remove if/when I standardize on C++20) -* I am only targetting Ubuntu right now. I've updated the build process as follows: - * When building for ROS2, use [orbslam3_ros2](https://gitlab.com/apl-ocean-engineering/orbslam3_ros2) which includes this repo as a submodule. Dependencies (g2o, Sophus, Pangolin) are included from ROS apt via `rosdep`. - * For non-ROS builds, I am now using `vcpkg` as a dependency manager as it can build the non-apt-gettable dependencies (Pangolin). **However** I am using overlays to preferentially use apt versions of packages when available (OpenCV, etc). - * Note we build `g2o` from source even though an APT package is available to get a newer version. +* I am only targetting Ubuntu 24.04 right now. I've updated the build process as follows: + * When building for ROS2, use [orbslam3_ros2](https://gitlab.com/apl-ocean-engineering/orbslam3_ros2) which includes this repo as a submodule. Dependencies (g2o, Sophus, Pangolin) are included from ROS apt via rosdep. + * For non-ROS builds, I am now using `vcpkg` as a dependency manager as it can build the non-apt-gettable dependencies (Pangolin). **However** I am using overlays to preferentially use apt versions of packages whenever feasible (ffmpeg, etc). + * In some cases (`g2o` and its dependencies) we use vcpkg's version to ensure dependencies stay in sycn. * Other minor changes: * Removed integrated Realsense support. Realsense-enabled binaries should go in a separate package. - ## Building -I am only testing on Ubuntu 24.04. As noted above, I prefer to use system packages as much as possible and use `vcpkg` for dependencies with no published binaries (outside of ROS). To override this behavior and have vcpkg build additional packages from source, remove the relevant directories from the [`vcpkg_overlays/`](vcpkg_overlays/) directory. +I am only testing on Ubuntu 24.04. + +As noted above, I prefer to use system packages as much as possible and use `vcpkg` for dependencies with no published binaries (outside of ROS). To override this behavior and have vcpkg build additional packages from source, remove the relevant directories from the [`vcpkg_overlays/`](vcpkg_overlays/) directory. I've gone full koolaid and adopted `ninja` as a builder as well. -To build under Ubuntu, use the convenience scripts: +To build in Ubuntu, use the convenience scripts: ``` ./install_apt_dependencies.sh ./build.sh ``` +This will build Release versions the ORB_SLAM3 library and all of the `Examples`. ----- ----- From 4e90b93fcb24f15932f56c971107adc0e9b207e0 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 21:13:16 +0000 Subject: [PATCH 44/46] Manually force reinstall libblas and liblapack --- .github/workflows/cmake_ci.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index a38de7ae048..141ab5c094a 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -28,14 +28,17 @@ jobs: # Write the variable to the GITHUB_OUTPUT file echo "apt_deps=$SCRIPT_OUTPUT" >> "$GITHUB_OUTPUT" - # Execute_install_scripts runs the preinst,postinst scripts after restoring from cache - # I think this necessary to ensure alternatives are set up (for libblas, etc) - name: Install apt dependencies uses: awalsh128/cache-apt-pkgs-action@latest with: packages: ${{ steps.generate_deps.outputs.apt_deps }} version: 1.0 - execute_install_scripts: true + + # I think this necessary to ensure alternatives are set up (for libblas, etc) + # It's not properly set up when restoring packages from cache + - name: Force install libblas and liblapack + run: apt-get install --reinstall libblas-dev liblapack-dev + shell: bash # Based on sample workflow from https://github.com/lukka/CppCMakeVcpkgTemplate/blob/v11/.github/workflows/hosted-ninja-vcpkg_submod.yml - uses: lukka/get-cmake@latest From a21b75175b765eda34bd25c48a4a7efbb8a46294 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 21:17:56 +0000 Subject: [PATCH 45/46] apt-get with sudo --- .github/workflows/cmake_ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index 141ab5c094a..6531cda2d0a 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -37,7 +37,7 @@ jobs: # I think this necessary to ensure alternatives are set up (for libblas, etc) # It's not properly set up when restoring packages from cache - name: Force install libblas and liblapack - run: apt-get install --reinstall libblas-dev liblapack-dev + run: sudo apt-get install --reinstall libblas-dev liblapack-dev shell: bash # Based on sample workflow from https://github.com/lukka/CppCMakeVcpkgTemplate/blob/v11/.github/workflows/hosted-ninja-vcpkg_submod.yml From d706881d54d1614688636467b8e6d617668678f5 Mon Sep 17 00:00:00 2001 From: Aaron Marburg Date: Wed, 7 Jan 2026 21:19:25 +0000 Subject: [PATCH 46/46] Remove debug step --- .github/workflows/cmake_ci.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/cmake_ci.yaml b/.github/workflows/cmake_ci.yaml index 6531cda2d0a..7d3e51d3d3d 100644 --- a/.github/workflows/cmake_ci.yaml +++ b/.github/workflows/cmake_ci.yaml @@ -56,10 +56,6 @@ jobs: doNotCache: false vcpkgGitCommitId: e3db8f65d2414c301c29a8467c6aee94e3ba09fc - - name: Libraries - run: | - ls -al /lib/x86_64-linux-gnu/ - # Note: if the preset misses the "configuration", it is possible to explicitly select the # configuration with the additional `--config` flag, e.g.: # buildPreset: 'ninja-vcpkg'