From 47f704277a5e782eb53b86a817da7d60335e1f78 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Tue, 3 Dec 2019 15:48:36 -0600 Subject: [PATCH] xrt: Let BUILD_TRACKING mean you need more than just the IMU fusion. This is required to build anything that uses the IMU fusion module without OpenCV. --- src/xrt/auxiliary/CMakeLists.txt | 51 ++++++++++++++----------- src/xrt/auxiliary/meson.build | 42 +++++++++++--------- src/xrt/auxiliary/tracking/t_kalman.cpp | 1 - src/xrt/targets/CMakeLists.txt | 2 +- 4 files changed, 53 insertions(+), 43 deletions(-) diff --git a/src/xrt/auxiliary/CMakeLists.txt b/src/xrt/auxiliary/CMakeLists.txt index 489b84481..c97b68e5b 100644 --- a/src/xrt/auxiliary/CMakeLists.txt +++ b/src/xrt/auxiliary/CMakeLists.txt @@ -25,25 +25,30 @@ set(OS_SOURCE_FILES ) set(TRACKING_SOURCE_FILES - tracking/t_calibration.cpp - tracking/t_calibration_opencv.hpp - tracking/t_convert.cpp - tracking/t_debug_hsv_filter.cpp - tracking/t_debug_hsv_picker.cpp - tracking/t_debug_hsv_viewer.cpp - tracking/t_file.cpp - tracking/t_fusion.hpp - tracking/t_hsv_filter.c - tracking/t_imu.h tracking/t_imu_fusion.hpp - tracking/t_kalman.cpp - tracking/t_lowpass.hpp + tracking/t_imu.cpp + tracking/t_imu.h tracking/t_lowpass_vector.hpp - tracking/t_tracker_psmv.cpp - tracking/t_tracker_psmv_fusion.hpp - tracking/t_tracker_psvr.cpp + tracking/t_lowpass.hpp tracking/t_tracking.h ) +if(BUILD_TRACKING) + list(APPEND TRACKING_SOURCE_FILES + tracking/t_calibration_opencv.hpp + tracking/t_calibration.cpp + tracking/t_convert.cpp + tracking/t_debug_hsv_filter.cpp + tracking/t_debug_hsv_picker.cpp + tracking/t_debug_hsv_viewer.cpp + tracking/t_file.cpp + tracking/t_fusion.hpp + tracking/t_hsv_filter.c + tracking/t_kalman.cpp + tracking/t_tracker_psmv_fusion.hpp + tracking/t_tracker_psmv.cpp + tracking/t_tracker_psvr.cpp + ) +endif() set(UTIL_SOURCE_FILES util/u_misc.c @@ -109,17 +114,19 @@ target_include_directories(aux_math SYSTEM PRIVATE ${EIGEN3_INCLUDE_DIR} ) +# Tracking library. +# Use OBJECT to not create a archive, since it just gets in the way. +add_library(aux_tracking OBJECT ${TRACKING_SOURCE_FILES}) +# Tracking files have extra includes. +target_include_directories(aux_tracking SYSTEM + PRIVATE + ${EIGEN3_INCLUDE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../../external + ) if(BUILD_TRACKING) - # Tracking library. - # Use OBJECT to not create a archive, since it just gets in the way. - add_library(aux_tracking OBJECT ${TRACKING_SOURCE_FILES}) - - # Tracking files have extra includes. target_include_directories(aux_tracking SYSTEM PRIVATE - ${EIGEN3_INCLUDE_DIR} ${OpenCV_INCLUDE_DIRS} - ${CMAKE_CURRENT_SOURCE_DIR}/../../external ) endif() diff --git a/src/xrt/auxiliary/meson.build b/src/xrt/auxiliary/meson.build index 9f8445757..d07a72d8c 100644 --- a/src/xrt/auxiliary/meson.build +++ b/src/xrt/auxiliary/meson.build @@ -101,32 +101,39 @@ aux_math = declare_dependency( ) tracking_srcs = [ - 'tracking/t_calibration.cpp', - 'tracking/t_calibration_opencv.hpp', - 'tracking/t_convert.cpp', - 'tracking/t_debug_hsv_filter.cpp', - 'tracking/t_debug_hsv_picker.cpp', - 'tracking/t_debug_hsv_viewer.cpp', - 'tracking/t_file.cpp', - 'tracking/t_fusion.hpp', - 'tracking/t_hsv_filter.c', 'tracking/t_imu.h', 'tracking/t_imu_fusion.hpp', - 'tracking/t_kalman.cpp', + 'tracking/t_imu.cpp', 'tracking/t_lowpass.hpp', 'tracking/t_lowpass_vector.hpp', - 'tracking/t_tracker_psmv.cpp', - 'tracking/t_tracker_psmv_fusion.hpp', - 'tracking/t_tracker_psvr.cpp', 'tracking/t_tracking.h', ] +tracking_deps = [eigen3] + +if build_tracking + tracking_srcs += [ + 'tracking/t_calibration.cpp', + 'tracking/t_calibration_opencv.hpp', + 'tracking/t_convert.cpp', + 'tracking/t_debug_hsv_filter.cpp', + 'tracking/t_debug_hsv_picker.cpp', + 'tracking/t_debug_hsv_viewer.cpp', + 'tracking/t_file.cpp', + 'tracking/t_fusion.hpp', + 'tracking/t_hsv_filter.c', + 'tracking/t_kalman.cpp', + 'tracking/t_tracker_psmv.cpp', + 'tracking/t_tracker_psmv_fusion.hpp', + 'tracking/t_tracker_psvr.cpp', + ] + tracking_deps += [opencv] +endif lib_aux_tracking = static_library( 'aux_tracking', files(tracking_srcs), include_directories: [xrt_include, external_include], - dependencies: [eigen3, opencv], - build_by_default: build_tracking, + dependencies: tracking_deps ) aux_tracking = declare_dependency( @@ -134,9 +141,6 @@ aux_tracking = declare_dependency( link_with: lib_aux_tracking, ) -all_aux = [aux_util, aux_os, aux_math] -if build_tracking - all_aux += [aux_tracking] -endif +all_aux = [aux_util, aux_os, aux_math, aux_tracking] aux = declare_dependency(dependencies: all_aux) diff --git a/src/xrt/auxiliary/tracking/t_kalman.cpp b/src/xrt/auxiliary/tracking/t_kalman.cpp index 8f6a7ba87..037cdba46 100644 --- a/src/xrt/auxiliary/tracking/t_kalman.cpp +++ b/src/xrt/auxiliary/tracking/t_kalman.cpp @@ -9,5 +9,4 @@ * @ingroup aux_tracking */ -#include "tracking/t_imu.cpp" #include "tracking/t_tracker_psmv_fusion.cpp" diff --git a/src/xrt/targets/CMakeLists.txt b/src/xrt/targets/CMakeLists.txt index 74f8c9780..56c123b1c 100644 --- a/src/xrt/targets/CMakeLists.txt +++ b/src/xrt/targets/CMakeLists.txt @@ -52,9 +52,9 @@ if(BUILD_DRIVER_VIVE) list(APPEND DRIVER_LIBRARIES ${ZLIB_LIBRARIES}) endif() +list(APPEND DRIVER_OBJECTS $) if(BUILD_TRACKING) - list(APPEND DRIVER_OBJECTS $) list(APPEND DRIVER_LIBRARIES ${OpenCV_LIBRARIES}) endif()