Compare commits

...

4 Commits

Author SHA1 Message Date
11b7c4a20d update ifdefine 2026-01-05 18:55:45 +07:00
2831959056 update 2026-01-05 18:35:31 +07:00
5eb11f233f test 2026-01-05 18:29:34 +07:00
bd6aaac9d4 update 2026-01-05 18:18:12 +07:00
6 changed files with 38 additions and 118 deletions

View File

@@ -31,88 +31,24 @@ if(BUILDING_WITH_CATKIN)
endif() endif()
## System dependencies ## System dependencies
# Find yaml-cpp shared library first, prioritizing system installation over /usr/local # Find yaml-cpp library
# This avoids using static library from /usr/local/lib find_package(yaml-cpp REQUIRED)
# First, try pkg-config to get the correct library path # Use target if available (modern CMake)
find_package(PkgConfig QUIET) if(TARGET yaml-cpp::yaml-cpp)
if(PkgConfig_FOUND) set(YAML_CPP_TARGET yaml-cpp::yaml-cpp)
pkg_check_modules(YAMLCPP_PKG yaml-cpp QUIET) message(STATUS "Using yaml-cpp target: yaml-cpp::yaml-cpp")
if(YAMLCPP_PKG_FOUND AND YAMLCPP_PKG_LIBRARIES) elseif(TARGET yaml-cpp)
set(YAML_CPP_TARGET ${YAMLCPP_PKG_LIBRARIES}) set(YAML_CPP_TARGET yaml-cpp)
message(STATUS "Using yaml-cpp from pkg-config: ${YAML_CPP_TARGET}") message(STATUS "Using yaml-cpp target: yaml-cpp")
endif() elseif(yaml-cpp_LIBRARIES)
endif() # Fallback to library variable if target not available
set(YAML_CPP_TARGET ${yaml-cpp_LIBRARIES})
# If pkg-config didn't work, find shared library directly, prioritizing /usr/lib message(STATUS "Using yaml-cpp library: ${YAML_CPP_TARGET}")
if(NOT YAML_CPP_TARGET) else()
# First try system paths (avoid /usr/local which may have static library) # Last resort: use library name
find_library(YAML_CPP_SHARED_LIB set(YAML_CPP_TARGET yaml-cpp)
NAMES yaml-cpp message(STATUS "Using yaml-cpp library name: yaml-cpp")
PATHS /usr/lib
PATH_SUFFIXES x86_64-linux-gnu
NO_DEFAULT_PATH
)
if(YAML_CPP_SHARED_LIB AND EXISTS "${YAML_CPP_SHARED_LIB}")
# Verify it's actually a shared library (not a symlink to static)
get_filename_component(YAML_CPP_REAL_LIB "${YAML_CPP_SHARED_LIB}" REALPATH)
if(YAML_CPP_REAL_LIB MATCHES "\\.so")
set(YAML_CPP_TARGET ${YAML_CPP_SHARED_LIB})
message(STATUS "Found yaml-cpp shared library in /usr/lib: ${YAML_CPP_SHARED_LIB}")
# Also find include directory
find_path(YAML_CPP_INCLUDE_DIR
NAMES yaml-cpp/yaml.h
PATHS /usr/include
NO_DEFAULT_PATH
)
if(YAML_CPP_INCLUDE_DIR)
message(STATUS "Found yaml-cpp include directory: ${YAML_CPP_INCLUDE_DIR}")
endif()
endif()
endif()
endif()
# Now use find_package, but temporarily exclude /usr/local to avoid static library
set(CMAKE_PREFIX_PATH_SAVED ${CMAKE_PREFIX_PATH})
list(REMOVE_ITEM CMAKE_PREFIX_PATH "/usr/local")
find_package(yaml-cpp QUIET)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH_SAVED})
# Use target if available and we haven't found a library yet
if(NOT YAML_CPP_TARGET)
if(TARGET yaml-cpp::yaml-cpp)
set(YAML_CPP_TARGET yaml-cpp::yaml-cpp)
message(STATUS "Using yaml-cpp target: yaml-cpp::yaml-cpp")
elseif(TARGET yaml-cpp)
set(YAML_CPP_TARGET yaml-cpp)
message(STATUS "Using yaml-cpp target: yaml-cpp")
else()
# Last resort: try to find any library, but check if it's static
find_library(YAML_CPP_ANY_LIB
NAMES yaml-cpp
PATHS /usr/lib /usr/local/lib /lib
PATH_SUFFIXES x86_64-linux-gnu
)
if(YAML_CPP_ANY_LIB)
if(YAML_CPP_ANY_LIB MATCHES "\\.a$")
message(FATAL_ERROR
"yaml-cpp static library found at: ${YAML_CPP_ANY_LIB}\n"
"This cannot be linked into a shared library.\n"
"Solution: Remove static library or use system shared library:\n"
" sudo rm /usr/local/lib/libyaml-cpp.a\n"
"Or ensure /usr/lib/x86_64-linux-gnu/libyaml-cpp.so is found first."
)
else()
set(YAML_CPP_TARGET ${YAML_CPP_ANY_LIB})
message(STATUS "Found yaml-cpp library: ${YAML_CPP_TARGET}")
endif()
else()
set(YAML_CPP_TARGET yaml-cpp)
message(WARNING "yaml-cpp library not found. Using library name 'yaml-cpp'")
endif()
endif()
endif() endif()
find_package(console_bridge REQUIRED) find_package(console_bridge REQUIRED)
@@ -179,16 +115,6 @@ target_link_libraries(${PROJECT_NAME}
dl # Required for dladdr() function used in plugin_loader_helper.cpp dl # Required for dladdr() function used in plugin_loader_helper.cpp
) )
# Check if we're using static library and warn user
if(YAML_CPP_TARGET MATCHES "\\.a$" OR YAML_CPP_TARGET MATCHES "libyaml-cpp\\.a")
message(FATAL_ERROR
"yaml-cpp static library detected at: ${YAML_CPP_TARGET}\n"
"Static libraries cannot be linked into shared libraries without -fPIC.\n"
"Solution: Install shared library version:\n"
" sudo apt-get install libyaml-cpp-dev\n"
"Or rebuild yaml-cpp with -fPIC flag."
)
endif()
## Add cmake target dependencies ## Add cmake target dependencies

View File

@@ -19,10 +19,9 @@
<buildtool_depend version_gte="0.5.68">catkin</buildtool_depend> <buildtool_depend version_gte="0.5.68">catkin</buildtool_depend>
<build_depend>libconsole-bridge-dev</build_depend>
<build_depend>robot_xmlrpcpp</build_depend> <build_depend>robot_xmlrpcpp</build_depend>
<build_depend>robot_time</build_depend>
<run_depend>libconsole-bridge-dev</run_depend>
<run_depend>robot_xmlrpcpp</run_depend> <run_depend>robot_xmlrpcpp</run_depend>
<run_depend>robot_time</run_depend>
</package> </package>

View File

@@ -1,19 +1,4 @@
cmake_minimum_required(VERSION 3.10) cmake_minimum_required(VERSION 3.10)
# ========================================================
# Dual-mode CMakeLists.txt: Supports both Catkin and Standalone CMake
# ========================================================
# Detect if building with Catkin
if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL)
set(BUILDING_WITH_CATKIN TRUE)
message(STATUS "Building robot_nav_2d_utils with Catkin")
find_package(catkin REQUIRED)
else()
set(BUILDING_WITH_CATKIN FALSE)
message(STATUS "Building robot_nav_2d_utils with Standalone CMake")
endif()
project(robot_nav_2d_utils VERSION 1.0.0 LANGUAGES CXX) project(robot_nav_2d_utils VERSION 1.0.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
@@ -32,7 +17,18 @@ set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}")
# Catkin specific configuration # Catkin specific configuration
# ======================================================== # ========================================================
if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL)
set(BUILDING_WITH_CATKIN TRUE)
message(STATUS "Building robot_nav_2d_utils with Catkin")
else()
set(BUILDING_WITH_CATKIN FALSE)
message(STATUS "Building robot_nav_2d_utils with Standalone CMake")
endif()
if(BUILDING_WITH_CATKIN) if(BUILDING_WITH_CATKIN)
find_package(catkin REQUIRED COMPONENTS robot_xmlrpcpp)
catkin_package( catkin_package(
INCLUDE_DIRS include INCLUDE_DIRS include
LIBRARIES conversions path_ops polygons bounds tf_help robot_nav_2d_utils LIBRARIES conversions path_ops polygons bounds tf_help robot_nav_2d_utils

View File

@@ -19,8 +19,7 @@
<buildtool_depend version_gte="0.5.68">catkin</buildtool_depend> <buildtool_depend version_gte="0.5.68">catkin</buildtool_depend>
<build_depend>libconsole-bridge-dev</build_depend> <build_depend>robot_xmlrpcpp</build_depend>
<run_depend>robot_xmlrpcpp</run_depend>
<run_depend>libconsole-bridge-dev</run_depend>
</package> </package>

View File

@@ -14,8 +14,8 @@ subject to the following restrictions:
#ifndef GEN_MINMAX_H #ifndef TF3_GEN_MINMAX_H
#define GEN_MINMAX_H #define TF3_GEN_MINMAX_H
#include "Scalar.h" #include "Scalar.h"
@@ -33,7 +33,7 @@ TF3SIMD_FORCE_INLINE const T& tf3Max(const T& a, const T& b)
} }
template <class T> template <class T>
TF3SIMD_FORCE_INLINE const T& GEN_clamped(const T& a, const T& lb, const T& ub) TF3SIMD_FORCE_INLINE const T& tf3GEN_clamped(const T& a, const T& lb, const T& ub)
{ {
return a < lb ? lb : (ub < a ? ub : a); return a < lb ? lb : (ub < a ? ub : a);
} }
@@ -57,7 +57,7 @@ TF3SIMD_FORCE_INLINE void tf3SetMax(T& a, const T& b)
} }
template <class T> template <class T>
TF3SIMD_FORCE_INLINE void GEN_clamp(T& a, const T& lb, const T& ub) TF3SIMD_FORCE_INLINE void tf3GEN_clamp(T& a, const T& lb, const T& ub)
{ {
if (a < lb) if (a < lb)
{ {