diff --git a/CMakeLists.txt b/CMakeLists.txt index 46e38451a..a114ffb7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ if (CCACHE_PROGRAM) endif () ## Project Options -option(BUILD_TESTING "Build tests" ON) +option(BUILD_TESTING "Build tests" OFF) option(STATIC_CHECK "Enable static check" OFF) option(ENABLE_LOGGING "Enable logging" ON) @@ -26,12 +26,16 @@ option(ENABLE_VISUALIZATION "Enable visualization targets" ON) option(USE_SYS_SPDLOG "Use system spdlog" OFF) option(XMOTION_DEV_MODE "Development mode forces building tests" OFF) -if (DEFINED ENV{ROS_DISTRO} AND "$ENV{ROS_DISTRO}" STREQUAL "humble") - message(STATUS "ROS_DISTRO is $ENV{ROS_DISTRO}, use system spdlog") +if (DEFINED ENV{ROS_DISTRO}) + set(BUILD_WITH_ROS ON) +endif () + +if (BUILD_WITH_ROS) + message(STATUS "Use spdlog from the system installation") set(USE_SYS_SPDLOG ON) endif () -if (BUILD_AS_MODULE OR (NOT (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64"))) +if (BUILD_WITH_ROS OR BUILD_AS_MODULE OR (NOT (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64"))) message(STATUS "Visualization targets are not build on non-x86_64 or when built as module") set(ENABLE_VISUALIZATION OFF) else () diff --git a/cmake/xmotionConfig.cmake.in b/cmake/xmotionConfig.cmake.in index f8b6a70b9..af0b3ff5e 100644 --- a/cmake/xmotionConfig.cmake.in +++ b/cmake/xmotionConfig.cmake.in @@ -7,6 +7,13 @@ include(CMakeFindDependencyMacro) find_dependency(Threads REQUIRED) # Any extra setup +find_package(PkgConfig REQUIRED) +pkg_check_modules(Libevent REQUIRED IMPORTED_TARGET libevent) +find_dependency(graph REQUIRED) + +if (DEFINED ENV{ROS_DISTRO}) + find_dependency(spdlog REQUIRED) +endif () # Add the targets file include("${CMAKE_CURRENT_LIST_DIR}/xmotionTargets.cmake") \ No newline at end of file diff --git a/src/common/math_utils/CMakeLists.txt b/src/common/math_utils/CMakeLists.txt index 8aca3414e..219035adc 100644 --- a/src/common/math_utils/CMakeLists.txt +++ b/src/common/math_utils/CMakeLists.txt @@ -1,7 +1,5 @@ -find_package(Boost REQUIRED filesystem) - add_library(math_utils STATIC src/matrix.cpp) -target_link_libraries(math_utils PUBLIC logging stb Boost::filesystem) +target_link_libraries(math_utils PUBLIC logging stb) target_include_directories(math_utils PUBLIC $ $) diff --git a/src/common/math_utils/include/math_utils/details/eigen_io_impl.hpp b/src/common/math_utils/include/math_utils/details/eigen_io_impl.hpp index b05aaae8b..535510df2 100644 --- a/src/common/math_utils/include/math_utils/details/eigen_io_impl.hpp +++ b/src/common/math_utils/include/math_utils/details/eigen_io_impl.hpp @@ -18,9 +18,9 @@ #include #include #include +#include #include -#include #define STB_IMAGE_IMPLEMENTATION #include "stb_image.h" @@ -79,8 +79,8 @@ bool EigenIO::WriteToFile( bool overwrite) { // check directory existence: create the directory if non-existent if (directory.empty()) return false; - if (!boost::filesystem::exists(directory)) { - if (!boost::filesystem::create_directories(directory)) { + if (!std::filesystem::exists(directory)) { + if (!std::filesystem::create_directories(directory)) { XLOG_ERROR("directory is not found and failed to be created - {}", directory); return false; @@ -89,7 +89,7 @@ bool EigenIO::WriteToFile( // get full file name and check file existence filename = directory + "/" + filename; - if (boost::filesystem::exists(filename)) { + if (std::filesystem::exists(filename)) { if (!overwrite) { // File exists, but overwriting is not allowed. Abort. XLOG_ERROR("file already exists - {}", filename); @@ -167,8 +167,8 @@ bool EigenIO::WriteToImage( bool overwrite) { // check directory existence: create the directory if non-existent if (directory.empty()) return false; - if (!boost::filesystem::exists(directory)) { - if (!boost::filesystem::create_directories(directory)) { + if (!std::filesystem::exists(directory)) { + if (!std::filesystem::create_directories(directory)) { XLOG_ERROR("directory is not found and failed to be created - {}", directory); return false; @@ -177,7 +177,7 @@ bool EigenIO::WriteToImage( // get full file name and check file existence filename = directory + "/" + filename; - if (boost::filesystem::exists(filename)) { + if (std::filesystem::exists(filename)) { if (!overwrite) { // File exists, but overwriting is not allowed. Abort. XLOG_ERROR("file already exists - {}", filename);