Skip to content

Commit

Permalink
[g2o] Add feature spdlog
Browse files Browse the repository at this point in the history
  • Loading branch information
WangWeiLin-MV committed Dec 31, 2024
1 parent 7bac262 commit b373ba9
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
14 changes: 14 additions & 0 deletions ports/g2o/0003-dependency-spdlog.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c2b0a09b..2645ff66 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -177,7 +177,8 @@ find_package(QGLViewer)
option(G2O_USE_LOGGING "Try to use spdlog for logging" ON)
set(G2O_HAVE_LOGGING 0)
if (G2O_USE_LOGGING)
- find_package(spdlog 1.6 QUIET)
+ find_package(spdlog 1.6 REQUIRED CONFIG)
+ set(G2O_HAVE_LOGGING 1)
if (TARGET spdlog::spdlog OR TARGET spdlog::spdlog_header_only)
set(G2O_HAVE_LOGGING 1)
message(STATUS "Compiling with logging support")
7 changes: 7 additions & 0 deletions ports/g2o/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,21 @@ vcpkg_from_github(
HEAD_REF master
PATCHES
fix-absolute.patch
0003-dependency-spdlog.diff
)

string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_LGPL_SHARED_LIBS)
file(REMOVE "${SOURCE_PATH}/cmake_modules/FindBLAS.cmake")

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
spdlog G2O_USE_LOGGING
)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DBUILD_LGPL_SHARED_LIBS=${BUILD_LGPL_SHARED_LIBS}
-DG2O_BUILD_EXAMPLES=OFF
-DG2O_BUILD_APPS=OFF
Expand Down
13 changes: 10 additions & 3 deletions ports/g2o/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "g2o",
"version-date": "2024-12-14",
"port-version": 1,
"port-version": 2,
"description": "g2o: A General Framework for Graph Optimization",
"homepage": "https://openslam.org/g2o.html",
"dependencies": [
"ceres",
"eigen3",
"lapack",
"spdlog",
"suitesparse",
{
"name": "vcpkg-cmake",
Expand All @@ -18,5 +17,13 @@
"name": "vcpkg-cmake-config",
"host": true
}
]
],
"features": {
"spdlog": {
"description": "Use spdlog for logging",
"dependencies": [
"spdlog"
]
}
}
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2986,7 +2986,7 @@
},
"g2o": {
"baseline": "2024-12-14",
"port-version": 1
"port-version": 2
},
"g3log": {
"baseline": "2.4",
Expand Down
5 changes: 5 additions & 0 deletions versions/g-/g2o.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "3c1f1836df83234a33a1f96cb292331f45f1650f",
"version-date": "2024-12-14",
"port-version": 2
},
{
"git-tree": "a4cbc27e6ebb4c53963c9cff2b686ea4dc12e4d3",
"version-date": "2024-12-14",
Expand Down

0 comments on commit b373ba9

Please sign in to comment.